Painting on top of QQuickView
-
Is it at all possible to paint (using
QPainter
) on top of (i.e. like an overlay) aQQuickView
?I have a QML OSM map plugin loaded into a
QWidget
and I would like to draw on top of this usingQPainter
(rather than using QML). Is this achieveable?There appears to be no
paintEvent
or equivalent available when sub-classingQQuickView
-
You can create a transaprent QQuickPaintedItem that stretches over your whole QML window, and paint there.
Just keep in mind that painting with QPainter is slower than with QML or OpenGL.
-
@sierdzio Thanks for your comments. Unfortunately I don't think what I ultimately want to do is possible due to the way QML and the
QQuickPaintedItem
is implemented.Basically, I have a 3rd party COM object which draws nautical charts. My existing
QWidget
application allows me to draw these charts in thepaintEvent
where I capture thewinId
of theQWidget
and pass it to theBeginPaint/EndPaint
functions ready for painting this 3rd party chart.The act of obtaining the
winId
in aQQuickPaintedItem
causes a lot of issues and results in the underlying QML not being rendered.I've managed to implement this another way and it works so far.