本文整理匯總了Python中qwt.qt.QtGui.QPainter.restore方法的典型用法代碼示例。如果您正苦於以下問題:Python QPainter.restore方法的具體用法?Python QPainter.restore怎麽用?Python QPainter.restore使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類qwt.qt.QtGui.QPainter
的用法示例。
在下文中一共展示了QPainter.restore方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: paintEvent
# 需要導入模塊: from qwt.qt.QtGui import QPainter [as 別名]
# 或者: from qwt.qt.QtGui.QPainter import restore [as 別名]
def paintEvent(self, event):
painter = QPainter(self)
if not self.contentsRect().contains(event.rect()):
painter.save()
painter.setClipRegion(event.region() & self.frameRect())
self.drawFrame(painter)
painter.restore()
painter.setClipRegion(event.region() & self.contentsRect())
self.drawContents(painter)
示例2: paintEvent
# 需要導入模塊: from qwt.qt.QtGui import QPainter [as 別名]
# 或者: from qwt.qt.QtGui.QPainter import restore [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)
示例3: paintEvent
# 需要導入模塊: from qwt.qt.QtGui import QPainter [as 別名]
# 或者: from qwt.qt.QtGui.QPainter import restore [as 別名]
def paintEvent(self, e):
cr = self.contentsRect()
painter = QPainter(self)
painter.setClipRegion(e.region())
if self.__data.isDown:
qDrawWinButton(painter, 0, 0, self.width(), self.height(),
self.palette(), True)
painter.save()
if self.__data.isDown:
shiftSize = buttonShift(self)
painter.translate(shiftSize.width(), shiftSize.height())
painter.setClipRect(cr)
self.drawContents(painter)
if not self.__data.icon.isNull():
iconRect = QRect(cr)
iconRect.setX(iconRect.x()+self.margin())
if self.__data.itemMode != QwtLegendData.ReadOnly:
iconRect.setX(iconRect.x()+BUTTONFRAME)
iconRect.setSize(self.__data.icon.size())
iconRect.moveCenter(QPoint(iconRect.center().x(),
cr.center().y()))
painter.drawPixmap(iconRect, self.__data.icon)
painter.restore()