8000 FIX: qt recursive draw · matplotlib/matplotlib@7ff959c · GitHub
[go: up one dir, main page]

Skip to content

Commit 7ff959c

Browse files
committed
FIX: qt recursive draw
- put draw_idle in the base canvas resize event - re-order our resize handling and Qt's resize handling (let Qt go first) - do not call processEvents from inside of the paint event (this maybe the critical fix)
1 parent 6ab5288 commit 7ff959c

File tree

3 files changed

+4
-3
lines changed

3 files changed

+4
-3
lines changed

lib/matplotlib/backend_bases.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1845,6 +1845,7 @@ def resize_event(self):
18451845
s = 'resize_event'
18461846
event = ResizeEvent(s, self)
18471847
self.callbacks.process(s, event)
1848+
self.draw_idle()
18481849

18491850
def close_event(self, guiEvent=None):
18501851
"""Pass a `CloseEvent` to all functions connected to ``close_event``.

lib/matplotlib/backends/backend_qt5.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -359,9 +359,10 @@ def resizeEvent(self, event):
359359
winch = w / dpival
360360
hinch = h / dpival
361361
self.figure.set_size_inches(winch, hinch, forward=False)
362-
FigureCanvasBase.resize_event(self)
363-
self.draw_idle()
362+
# pass back into Qt to let it finish
364363
QtWidgets.QWidget.resizeEvent(self, event)
364+
# emit our resize events
365+
FigureCanvasBase.resize_event(self)
365366

366367
def sizeHint(self):
367368
w, h = self.get_width_height()

lib/matplotlib/backends/backend_qt5agg.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,6 @@ def paintEvent(self, e):
7272
# since the latter doesn't guarantee that the event will be emitted
7373
# straight away, and this causes visual delays in the changes.
7474
self.resizeEvent(event)
75-
QtWidgets.QApplication.instance().processEvents()
7675
# resizeEvent triggers a paintEvent itself, so we exit this one.
7776
return
7877

0 commit comments

Comments
 (0)
0