Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from PySide.QtGui import *
- class PaintTest(QScrollArea):
- def __init__(self, parent=None):
- super(PaintTest, self).__init__(parent)
- self.mainWidget = QWidget()
- self.setWidget(self.mainWidget)
- self.setWidgetResizable(True) # DISABLE THIS WITH ABOVE WIDGET ADDED AND THE CUSTOM PAINT EVENT IS NOT TRIGGERED
- def paintEvent( self, event ):
- print 'painting'
- painter = QPainter()
- painter.begin(self.viewport())
- painter.drawText(self.rect(), 'test')
- painter.end()
- if __name__ == '__main__':
- import sys
- app = QApplication([])
- app.setStyle("plastique")
- w = PaintTest()
- w.show()
- sys.exit(app.exec_())
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement