E5Graphics/E5GraphicsView.py

branch
5_2_x
changeset 2029
51e8278f2c3d
parent 1509
c0b5e693b0eb
child 2303
0ed4ed026c16
equal deleted inserted replaced
2022:674ef50b5004 2029:51e8278f2c3d
33 self.setRenderHint(QPainter.Antialiasing, True) 33 self.setRenderHint(QPainter.Antialiasing, True)
34 self.setDragMode(QGraphicsView.RubberBandDrag) 34 self.setDragMode(QGraphicsView.RubberBandDrag)
35 self.setAlignment(Qt.Alignment(Qt.AlignLeft | Qt.AlignTop)) 35 self.setAlignment(Qt.Alignment(Qt.AlignLeft | Qt.AlignTop))
36 self.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOn) 36 self.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOn)
37 self.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOn) 37 self.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOn)
38 38 self.setViewportUpdateMode(QGraphicsView.SmartViewportUpdate)
39 # available as of Qt 4.3
40 try:
41 self.setViewportUpdateMode(QGraphicsView.SmartViewportUpdate)
42 except AttributeError:
43 pass
44 39
45 self.setWhatsThis(self.trUtf8("<b>Graphics View</b>\n" 40 self.setWhatsThis(self.trUtf8("<b>Graphics View</b>\n"
46 "<p>This graphics view is used to show a diagram. \n" 41 "<p>This graphics view is used to show a diagram. \n"
47 "There are various actions available to manipulate the \n" 42 "There are various actions available to manipulate the \n"
48 "shown items.</p>\n" 43 "shown items.</p>\n"
117 112
118 def setSceneSize(self, width, height): 113 def setSceneSize(self, width, height):
119 """ 114 """
120 Public method to set the scene size. 115 Public method to set the scene size.
121 116
122 @param width width for the scene (integer) 117 @param width width for the scene (float)
123 @param height height for the scene (integer) 118 @param height height for the scene (float)
124 """ 119 """
125 rect = self.scene().sceneRect() 120 rect = self.scene().sceneRect()
126 rect.setHeight(height) 121 rect.setHeight(height)
127 rect.setWidth(width) 122 rect.setWidth(width)
128 self.setSceneRect(rect) 123 self.scene().setSceneRect(rect)
129 124
130 def _getDiagramRect(self, border=0): 125 def _getDiagramRect(self, border=0):
131 """ 126 """
132 Protected method to calculate the minimum rectangle fitting the diagram. 127 Protected method to calculate the minimum rectangle fitting the diagram.
133 128

eric ide

mercurial