Skip to content

Cairo rendering for Qt5 #8771

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

Closed
wants to merge 13 commits into from
Closed

Cairo rendering for Qt5 #8771

wants to merge 13 commits into from

Conversation

anntzer
Copy link
Contributor

@anntzer anntzer commented Jun 18, 2017

This PR implements a cairo based renderer for Qt canvas, under the name "Qt4Cairo"/"Qt5Cairo". Test e.g. by setting the MPLBACKEND environment variable to qt4cairo/qt5cairo.

The quoted text below is no longer relevant (the corresponding PRs have been merged).

The first three commits include a number of cleanups to specific backends code, some of them related to the issue at hand and some of them not so much. They are also the object of a separate PR (#8772), that may be merged first (and independently) to simplify review.

The fourth commit ("backend class to factor out common code") implements a class-based approach to define the various functions needed by a backend module, in order to remove large chunks of copy-pasted code. It does not modify the public API though. Likewise, it is the object of a separate PR (#8773) that may be merged second to simplify review.

The following commits implement the Qt5Cairo backend, then the Qt4Cairo backend, and redistributes relevant code chunks between the various backend_qt* modules in order to maximize code reuse, and then update the docs. I would suggest restricting comments for this PR to the diff of these last commits.

As a side effect of the refactoring of the Qt canvas classes, this also closes #8618 (PySide2 support).

Note that because of the way the cairo backend is currently written, all the drawing occurs during the Qt draw event, instead of being buffered before it as in Agg. The third party mplcairo backend works around this limitation, but this PR is still useful to cleanly separate the windowing and rendering parts of the code.

PR Checklist

  • Has Pytest style unit tests
    -> see test_backends_interactive.py
  • 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/whats_new.rst if major new feature
  • Documented in doc/api/api_changes.rst if API changed in a backward-incompatible way

anntzer added 12 commits January 8, 2018 22:27
(Apparently the version parsing can sometimes fail on Travis.)
gdk_window_process_updates is deprecated since GDK 3.22.  Agg animations
run fine without it, and removing it makes mpl_cairo animations faster.

Being drawable is synonym to being mapped and visible.
Vector surfaces do not report their extents, so we need to pass them in
manually.
@anntzer
Copy link
Contributor Author

anntzer commented Jan 9, 2018

I would really appreciate if this could make it in 2.2 because it is more or less a prerequisite for me to make a first release of mplcairo (i.e. with a working GUI backend). So labeling it as such, but feel free to retag if you think this is too hard.

@anntzer anntzer added the Release critical For bugs that make the library unusable (segfaults, incorrect plots, etc) and major regressions. label Jan 9, 2018
@anntzer anntzer modified the milestones: v3.0, v2.2 Jan 9, 2018
@jklymak
Copy link
Member

jklymak commented Jan 9, 2018

@anntzer I'd be OK w/ it if it were more self contained. What are good tests that the changes in backend_qt5, backend_qt5agg etc don't have bad knock-on effects? Is the test suite adequate for this?

I agree it would be very nice to see this in for 2.2. It seems that cairo is a great way forward, particularly as it can be used to drive openGL if I understand correctly.

@anntzer
Copy link
Contributor Author

anntzer commented Jan 9, 2018

Splitting out the nonessential parts...

@anntzer
Copy link
Contributor Author

anntzer commented Jan 15, 2018

Superseded by #10210.

@anntzer anntzer closed this Jan 15, 2018
@anntzer anntzer deleted the qtcairo branch January 15, 2018 00:55
@anntzer anntzer restored the qtcairo branch January 29, 2018 22:01
@QuLogic QuLogic modified the milestones: needs sorting, v2.2.0 Feb 13, 2018
@anntzer anntzer deleted the qtcairo branch February 15, 2018 02:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend: cairo GUI: Qt Release critical For bugs that make the library unusable (segfaults, incorrect plots, etc) and major regressions. status: duplicate
Projects
None yet
Development

Successfully merging this pull request may close these issues.

pyside2 as qt5 backend
5 participants