SHOW:
|
|
- or go back to the newest paste.
1 | from PySide.QtGui import * | |
2 | - | from PySide.QtCore import * |
2 | + | |
3 | class PaintTest(QScrollArea): | |
4 | ||
5 | def __init__(self, parent=None): | |
6 | - | def __init__( self, parent=None ): |
6 | + | |
7 | self.mainWidget = QWidget() | |
8 | self.setWidget(self.mainWidget) | |
9 | self.setWidgetResizable(True) # DISABLE THIS WITH ABOVE WIDGET ADDED AND THE CUSTOM PAINT EVENT IS NOT TRIGGERED | |
10 | - | self.setWidgetResizable( True ) # DISABLE THIS WITH ABOVE WIDGET ADDED AND THE CUSTOM PAINT EVENT IS NOT TRIGGERED |
10 | + | |
11 | def paintEvent( self, event ): | |
12 | print 'painting' | |
13 | painter = QPainter() | |
14 | painter.begin(self.viewport()) | |
15 | - | painter.begin( self.viewport() ) |
15 | + | |
16 | painter.end() | |
17 | ||
18 | ||
19 | if __name__ == '__main__': | |
20 | import sys | |
21 | app = QApplication([]) | |
22 | app.setStyle("plastique") | |
23 | w = PaintTest() | |
24 | w.show() | |
25 | sys.exit(app.exec_()) |