本文整理匯總了Python中qwt.qt.QtGui.QPainter.fillRect方法的典型用法代碼示例。如果您正苦於以下問題:Python QPainter.fillRect方法的具體用法?Python QPainter.fillRect怎麽用?Python QPainter.fillRect使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類qwt.qt.QtGui.QPainter
的用法示例。
在下文中一共展示了QPainter.fillRect方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: legendIcon
# 需要導入模塊: from qwt.qt.QtGui import QPainter [as 別名]
# 或者: from qwt.qt.QtGui.QPainter import fillRect [as 別名]
def legendIcon(self, index, size):
if size.isEmpty():
return QwtGraphic()
graphic = QwtGraphic()
graphic.setDefaultSize(size)
graphic.setRenderHint(QwtGraphic.RenderPensUnscaled, True)
painter = QPainter(graphic)
painter.setRenderHint(QPainter.Antialiasing,
self.testRenderHint(QwtPlotItem.RenderAntialiased))
if self.__data.legendAttributes == 0 or\
(self.__data.legendAttributes & QwtPlotCurve.LegendShowBrush):
brush = self.__data.brush
if brush.style() == Qt.NoBrush and self.__data.legendAttributes == 0:
if self.style() != QwtPlotCurve.NoCurve:
brush = QBrush(self.pen().color())
elif self.__data.symbol and\
self.__data.symbol.style() != QwtSymbol.NoSymbol:
brush = QBrush(self.__data.symbol.pen().color())
if brush.style() != Qt.NoBrush:
r = QRectF(0, 0, size.width(), size.height())
painter.fillRect(r, brush)
if self.__data.legendAttributes & QwtPlotCurve.LegendShowLine:
if self.pen() != Qt.NoPen:
pn = self.pen()
# pn.setCapStyle(Qt.FlatCap)
painter.setPen(pn)
y = .5*size.height()
QwtPainter.drawLine(painter, 0., y, size.width(), y)
if self.__data.legendAttributes & QwtPlotCurve.LegendShowSymbol:
if self.__data.symbol:
r = QRectF(0, 0, size.width(), size.height())
self.__data.symbol.drawSymbol(painter, r)
return graphic
示例2: defaultIcon
# 需要導入模塊: from qwt.qt.QtGui import QPainter [as 別名]
# 或者: from qwt.qt.QtGui.QPainter import fillRect [as 別名]
def defaultIcon(brush, size):
icon = QwtGraphic()
if not size.isEmpty():
icon.setDefaultSize(size)
r = QRectF(0, 0, size.width(), size.height())
painter = QPainter(icon)
painter.fillRect(r, brush)
return icon
示例3: legendIcon
# 需要導入模塊: from qwt.qt.QtGui import QPainter [as 別名]
# 或者: from qwt.qt.QtGui.QPainter import fillRect [as 別名]
def legendIcon(self, index, size):
"""
:param int index: Index of the legend entry (ignored as there is only one)
:param QSizeF size: Icon size
:return: Icon representing the curve on the legend
.. seealso::
:py:meth:`qwt.plot.QwtPlotItem.setLegendIconSize()`,
:py:meth:`qwt.plot.QwtPlotItem.legendData()`
"""
if size.isEmpty():
return QwtGraphic()
graphic = QwtGraphic()
graphic.setDefaultSize(size)
graphic.setRenderHint(QwtGraphic.RenderPensUnscaled, True)
painter = QPainter(graphic)
painter.setRenderHint(QPainter.Antialiasing,
self.testRenderHint(QwtPlotItem.RenderAntialiased))
if self.__data.legendAttributes == 0 or\
(self.__data.legendAttributes & QwtPlotCurve.LegendShowBrush):
brush = self.__data.brush
if brush.style() == Qt.NoBrush and self.__data.legendAttributes == 0:
if self.style() != QwtPlotCurve.NoCurve:
brush = QBrush(self.pen().color())
elif self.__data.symbol and\
self.__data.symbol.style() != QwtSymbol.NoSymbol:
brush = QBrush(self.__data.symbol.pen().color())
if brush.style() != Qt.NoBrush:
r = QRectF(0, 0, size.width(), size.height())
painter.fillRect(r, brush)
if self.__data.legendAttributes & QwtPlotCurve.LegendShowLine:
if self.pen() != Qt.NoPen:
pn = self.pen()
# pn.setCapStyle(Qt.FlatCap)
painter.setPen(pn)
y = .5*size.height()
painter.drawLine(0., y, size.width(), y)
if self.__data.legendAttributes & QwtPlotCurve.LegendShowSymbol:
if self.__data.symbol:
r = QRectF(0, 0, size.width(), size.height())
self.__data.symbol.drawSymbol(painter, r)
return graphic