本文整理匯總了Python中qwt.qt.QtGui.QPainter.begin方法的典型用法代碼示例。如果您正苦於以下問題:Python QPainter.begin方法的具體用法?Python QPainter.begin怎麽用?Python QPainter.begin使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類qwt.qt.QtGui.QPainter
的用法示例。
在下文中一共展示了QPainter.begin方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: paintEvent
# 需要導入模塊: from qwt.qt.QtGui import QPainter [as 別名]
# 或者: from qwt.qt.QtGui.QPainter import begin [as 別名]
def paintEvent(self, event):
painter = QPainter(self)
painter.setClipRegion(event.region())
if self.testPaintAttribute(self.BackingStore) and\
self.__data.backingStore is not None:
bs = self.__data.backingStore
if bs.size() != self.size():
bs = QwtPainter.backingStore(self, self.size())
if self.testAttribute(Qt.WA_StyledBackground):
p = QPainter(bs)
qwtFillBackground(p, self)
self.drawCanvas(p, True)
else:
p = QPainter()
if self.__data.borderRadius <= 0.:
# print('**DEBUG: QwtPlotCanvas.paintEvent')
QwtPainter.fillPixmap(self, bs)
p.begin(bs)
self.drawCanvas(p, False)
else:
p.begin(bs)
qwtFillBackground(p, self)
self.drawCanvas(p, True)
if self.frameWidth() > 0:
self.drawBorder(p)
p.end()
painter.drawPixmap(0, 0, self.__data.backingStore)
else:
if self.testAttribute(Qt.WA_StyledBackground):
if self.testAttribute(Qt.WA_OpaquePaintEvent):
qwtFillBackground(painter, self)
self.drawCanvas(painter, True)
else:
self.drawCanvas(painter, False)
else:
if self.testAttribute(Qt.WA_OpaquePaintEvent):
if self.autoFillBackground():
qwtFillBackground(painter, self)
qwtDrawBackground(painter, self)
else:
if self.borderRadius() > 0.:
clipPath = QPainterPath()
clipPath.addRect(self.rect())
clipPath = clipPath.subtracted(self.borderPath(self.rect()))
painter.save()
painter.setClipPath(clipPath, Qt.IntersectClip)
qwtFillBackground(painter, self)
qwtDrawBackground(painter, self)
painter.restore()
self.drawCanvas(painter, False)
if self.frameWidth() > 0:
self.drawBorder(painter)
if self.hasFocus() and self.focusIndicator() == self.CanvasFocusIndicator:
self.drawFocusIndicator(painter)