[Matplotlib-devel] Backend for use with Qt/QML

Thomas Caswell tcaswell at gmail.com
Fri Nov 22 13:55:48 EST 2019


Sietse,

The methods are only removed from the c++ classes (which is what you are
accessing via `_renderer`) which we consider private and will change with
no warning (see https://github.com/matplotlib/matplotlib/pull/11735 for the
PR where this was done).  It looks like there are still public methods with
the same name on RendererAgg.

I also suggest having a look at how we are doing this in our qt5agg backend
(
https://github.com/matplotlib/matplotlib/blob/616d6729368e6f4997bb759b171051a2b9ad882c/lib/matplotlib/backends/backend_qt5agg.py#L61-L75).
Is there a reason you can not directly use the QWidget sub-class we provide
(
https://github.com/matplotlib/matplotlib/blob/616d6729368e6f4997bb759b171051a2b9ad882c/lib/matplotlib/backends/backend_qt5agg.py#L17
)?

Tom

On Thu, Nov 21, 2019 at 8:48 AM s.achterop at rug.nl <s.achterop at rug.nl> wrote:

>      Hallo List,
>
> I need to embed matplotlib in a Qt5/QML application, and found a starting
> point created
> by Frederic Collonval.
> It is a fairly old version, and not working anymore, so I forked it to
> create an updated version.
> It can be found on
>      https://github.com/SietseAchterop/matplotlib_qtquick_playground
> I only updated the backend and the QtQuick version 2 example.
>
> But I am stuck in the backend, in backend_qquick5agg.py.
> In the QtQuick.QQuickPaintedItem function paint in line 118 there is:
>       stringBuffer = self.renderer._renderer.tostring_bgra()
>
> Both tostring_xxx functions do not exist anymore. How can I solve this?
> Is the byteorder problem solved somewhere else? Is this a qt4/qt5 issue?
>
> Hopefully someone can point me in a direction. It would be very nice to
> have
> a possibility to use matplotlib within QML apps.
>
>     Thanks in advance,
>         Sietse
> _______________________________________________
> Matplotlib-devel mailing list
> Matplotlib-devel at python.org
> https://mail.python.org/mailman/listinfo/matplotlib-devel
>


-- 
Thomas Caswell
tcaswell at gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/matplotlib-devel/attachments/20191122/d0a44fa9/attachment.html>


More information about the Matplotlib-devel mailing list