Show QImage in the QML Image
-
In C++ code I generate some picture and store it in QImage then I would like to show it in QML.
C++:
class InfoViewContent : public QQuickItem { .............. Q_INVOCABLE QImage getPage() { return m_image } ....................................................... QImage m_image; }
QML:
Image { ........... InfoViewContent { ??? } source: ???
Is the way is proper?
how can I manege it?Thanks in advance
-
In C++ code I generate some picture and store it in QImage then I would like to show it in QML.
C++:
class InfoViewContent : public QQuickItem { .............. Q_INVOCABLE QImage getPage() { return m_image } ....................................................... QImage m_image; }
QML:
Image { ........... InfoViewContent { ??? } source: ???
Is the way is proper?
how can I manege it?Thanks in advance
@Milosz
When you depend on a Image element, the only way is viaQQuickImageProvider
approach
Alternatively you can implement a custom painting QML item - e.g. deriveQQuickPaintedItem
for simple QPainter API usage -
In C++ code I generate some picture and store it in QImage then I would like to show it in QML.
C++:
class InfoViewContent : public QQuickItem { .............. Q_INVOCABLE QImage getPage() { return m_image } ....................................................... QImage m_image; }
QML:
Image { ........... InfoViewContent { ??? } source: ???
Is the way is proper?
how can I manege it?Thanks in advance
hi @Milosz
usually, one uses a QQuickImageProvider to provide QML with a cpp QImage
here a small example app I created to learn how to use the ImageProvider Class
githublink -
hi @Milosz
usually, one uses a QQuickImageProvider to provide QML with a cpp QImage
here a small example app I created to learn how to use the ImageProvider Class
githublink