@@ -68,8 +68,7 @@ def __init__(self, figure):
68
68
print ('FigureCanvasQtAgg: ' , figure )
69
69
FigureCanvasQT .__init__ (self , figure )
70
70
FigureCanvasAgg .__init__ (self , figure )
71
- self .drawRect = False
72
- self .rect = []
71
+ self ._drawRect = None
73
72
self .blitbox = None
74
73
self .setAttribute (QtCore .Qt .WA_OpaquePaintEvent )
75
74
# it has been reported that Qt is semi-broken in a windows
@@ -90,8 +89,7 @@ def __init__(self, figure):
90
89
self ._priv_update = self .update
91
90
92
91
def drawRectangle (self , rect ):
93
- self .rect = rect
94
- self .drawRect = True
92
+ self ._drawRect = rect
95
93
self .repaint ()
96
94
97
95
def paintEvent (self , e ):
@@ -131,10 +129,10 @@ def paintEvent(self, e):
131
129
p .drawPixmap (QtCore .QPoint (0 , 0 ), QtGui .QPixmap .fromImage (qImage ))
132
130
133
131
# draw the zoom rectangle to the QPainter
134
- if self .drawRect :
132
+ if self ._drawRect is not None :
135
133
p .setPen (QtGui .QPen (QtCore .Qt .black , 1 , QtCore .Qt .DotLine ))
136
- p . drawRect ( self . rect [ 0 ], self .rect [ 1 ],
137
- self . rect [ 2 ], self . rect [ 3 ] )
134
+ x , y , w , h = self ._drawRect
135
+ p . drawRect ( x , y , w , h )
138
136
p .end ()
139
137
140
138
# This works around a bug in PySide 1.1.2 on Python 3.x,
@@ -159,7 +157,7 @@ def paintEvent(self, e):
159
157
p .drawPixmap (QtCore .QPoint (l , self .renderer .height - t ), pixmap )
160
158
p .end ()
161
159
self .blitbox = None
162
- self .drawRect = False
160
+ self ._drawRect = None
163
161
164
162
def draw (self ):
165
163
"""
0 commit comments