Solved Multi images in QML using one QQuickImageProvider ?
-
Hi,
Does anyone know if it is possible to display multi images from C++ in QML using QQuickImageProvider?
i. e., I have two image elements in QML, and I want to show different images from C++ inside ths image elements. I don't want and even don't know if it is good to create separate QQuickImageProviders for each image. Consequently, I want to use the same QQuickImageProvider to pass the images to QML. Really need your help. Thanks.
-
@VincentLiu If I understand correctly, it is possible. Just use different id.
Here is its example:
http://doc.qt.io/qt-5/qquickimageprovider.html#an-example -
@VincentLiu If I understand correctly, it is possible. Just use different id.
Here is its example:
http://doc.qt.io/qt-5/qquickimageprovider.html#an-example -
Dear @p3c0 ,
Very thanks for your help. You are right. Here is my code for sharing to others having the same problem.
In .QML:
property int num1; property int num2; Image{ source: "image://*provider*/" + num1 } Image{ source: "image://*provider*/" + num2 } Button{ onClicked: { num1++; } } Button{ onClicked: { num2++; } }