Thanks to visit codestin.com
Credit goes to github.com

Skip to content

FIX: qt recursive draw #9199

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Sep 26, 2017
Merged

Conversation

tacaswell
Copy link
Member

  • 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)

closes #9134

PR Summary

PR Checklist

  • Has Pytest style unit tests
  • Code is PEP 8 compliant
  • New features are documented, with examples if plot related
  • Documentation is sphinx and numpydoc compliant
  • Added an entry to doc/users/next_whats_new/ if major new feature (follow instructions in README.rst there)
  • Documented in doc/api/api_changes.rst if API changed in a backward-incompatible way

 - 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)
@tacaswell tacaswell added the Release critical For bugs that make the library unusable (segfaults, incorrect plots, etc) and major regressions. label Sep 18, 2017
@tacaswell tacaswell added this to the 2.1 (next point release) milestone Sep 18, 2017
@anntzer
Copy link
Contributor

anntzer commented Sep 18, 2017

LGTM (and thanks for the patch!), although you may want to check whether this means we should remove a now extraneous draw_idle in other backends? (not that it would really matter as the draw_idles should get compressed into a single one).

@tacaswell
Copy link
Member Author

This now fails the Qt5 DPI test... yay!

The resizeEvent call does put another paint onto the event queue,
however it seems that processEvents only processes events on the queue
when it is called (not events added while it is processing).  This is
not clearly documented, but makes sense as this method is for keeping
GUIs responsive during otherwise long-running tasks so it should not
be able to extend it's run indefinitely by populating the queue.

This is required because a previous commit removed the explicit
processEvents call in paintEvent as it would occasionally cause
recursive painting which may kill Qt.
This prevents flickering during window resize.  The issue is that the
resize event triggers a paint and we have marked the figure as stale
and requiring a re-draw.  Sometimes the paint from the resize will
process before the single-shot to trigger __draw_idle_agg and there
will be a size-mismatch between the QImage and the buffer we are
trying to fill it with which results in a visible flicker.
@tacaswell
Copy link
Member Author

@dopplershift This also fixes the flicker you noticed.

@anntzer
Copy link
Contributor

anntzer commented Sep 26, 2017

thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Release critical For bugs that make the library unusable (segfaults, incorrect plots, etc) and major regressions.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants