當前位置: 首頁>>代碼示例>>Python>>正文


Python QPainter.drawPixmap方法代碼示例

本文整理匯總了Python中qwt.qt.QtGui.QPainter.drawPixmap方法的典型用法代碼示例。如果您正苦於以下問題:Python QPainter.drawPixmap方法的具體用法?Python QPainter.drawPixmap怎麽用?Python QPainter.drawPixmap使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在qwt.qt.QtGui.QPainter的用法示例。


在下文中一共展示了QPainter.drawPixmap方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: paintEvent

# 需要導入模塊: from qwt.qt.QtGui import QPainter [as 別名]
# 或者: from qwt.qt.QtGui.QPainter import drawPixmap [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)
開發者ID:petebachant,項目名稱:python-qwt,代碼行數:56,代碼來源:plot_canvas.py

示例2: eventFilter

# 需要導入模塊: from qwt.qt.QtGui import QPainter [as 別名]
# 或者: from qwt.qt.QtGui.QPainter import drawPixmap [as 別名]
 def eventFilter(self, obj_, event):
     if event.type() == QEvent.Paint:
         self.reset()
         if self.__data.seriesItem:
             pe = event  #XXX: cast to QPaintEvent
             canvas = self.__data.seriesItem.plot().canvas()
             painter = QPainter(canvas)
             painter.setClipRegion(pe.region())
             doCopyCache = self.testAttribute(self.CopyBackingStore)
             if doCopyCache:
                 plotCanvas = canvas  #XXX: cast to QwtPlotCanvas
                 if plotCanvas:
                     doCopyCache = qwtHasBackingStore(plotCanvas)
                     if doCopyCache:
                         painter.drawPixmap(plotCanvas.contentsRect().topLeft(),
                                            plotCanvas.backingStore())
             if not doCopyCache:
                 qwtRenderItem(painter, canvas.contentsRect(),
                               self.__data.seriesItem,
                               self.__data.from_, self.__data.to)
             return True
     return False
開發者ID:berrosse,項目名稱:PythonQwt,代碼行數:24,代碼來源:plot_directpainter.py

示例3: paintEvent

# 需要導入模塊: from qwt.qt.QtGui import QPainter [as 別名]
# 或者: from qwt.qt.QtGui.QPainter import drawPixmap [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()
開發者ID:petebachant,項目名稱:python-qwt,代碼行數:25,代碼來源:legend_label.py


注:本文中的qwt.qt.QtGui.QPainter.drawPixmap方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。