how to give source attribute in image while using repeater in qml??
-
For source I want to change the total array based on the repeater change ?
It is not quite clear what you are trying to do ? Do you mean you want to modify the whole C++ array even if there is 1 change in the array ?
May be you should check foronModelChanged
handler ? -
@p3c0
Sorry for the inconvinience I am having 4 different arrays for 4 different models.But I am struggling to use it in repeaterRepeater{ Model:4 Image{ //for 1st model I want the source as source:img1_array[0]; //for 2nd model I want the source as source:img2_array[0]; //for 3rd model I want the source as source:img3_array[0]; } }
-
@p3c0 img_array[0] It just return local file path as string from c++ to display the image.img_array is declared as string list in c++.
@Bharathi You can't access string list directly from QML unless make it accessible from C++.
Have a look at following:
http://doc.qt.io/qt-5/qtqml-cppintegration-exposecppattributes.html
http://doc.qt.io/qt-5/qtqml-cppintegration-contextproperties.htmlPerhaps you should add a
Q_INVOKABLE
function in the model which will return the path from your string list depending upon the index.