QQuickImageProvider not recieving Unicode from Qml - cannot find image
Unsolved
QML and Qt Quick
-
wrote on 8 Mar 2017, 07:42 last edited by
Hi,
I am building an application with a QML image source that is set from C++ backend. My problem being the QQuickImageProvider I have attached to my application engine as an image provider takes in the image source data as a QString in the requestPixmap function - using the example provided in QQuickImageProvider docclass ColorImageProvider : public QQuickImageProvider { public: ColorImageProvider() : QQuickImageProvider(QQuickImageProvider::Pixmap) { } QPixmap requestPixmap(const QString &id, QSize *size, const QSize &requestedSize) { int width = 100; int height = 50; if (size) *size = QSize(width, height); QPixmap pixmap(requestedSize.width() > 0 ? requestedSize.width() : width, requestedSize.height() > 0 ? requestedSize.height() : height); pixmap.fill(QColor(id).rgba()); return pixmap; } };
How can I ensure the Unicode string properly propagates from C++ backend to QML back to QQuickImageProvider::requestPixmap()?
Thanks!
-
Hi,
Can you show how you are using your provider in your code ? As well as an example of string ?
1/2