Exemplo n.º 1
0
class TestBackingStoreWindow(QWindow):
    def __init__(self):
        super(TestBackingStoreWindow, self).__init__()
        self.backingStore = QBackingStore(self)
        self.text = QStaticText("BackingStoreWindow")

    def event(self, event):
        if event.type() == QEvent.Resize:
            self.backingStore.resize(self.size())
            self.render()
        elif event.type() == QEvent.UpdateRequest or event.type() == QEvent.Expose:
            self.backingStore.flush(QRegion(QRect(QPoint(0, 0), self.size())))

        return QWindow.event(self, event)

    def render(self):
        clientRect = QRect(QPoint(0, 0), self.size())
        painter = QPainter(self.backingStore.paintDevice())
        painter.fillRect(clientRect, QColor(Qt.green))
        painter.drawStaticText(QPoint(10, 10), self.text)
Exemplo n.º 2
0
 def __init__(self):
     super(TestBackingStoreWindow, self).__init__()
     self.backingStore = QBackingStore(self)
     self.text = QStaticText("BackingStoreWindow")