FolderListModel refresh list problem
Unsolved
QML and Qt Quick
-
I am using ListView using FolderListModel in Qt 5.2.1 on Ubuntu
Rectangle { id: listRect width: rootWindow.width height: rootWindow.height color: "transparent" visible: false Column { Rectangle { width: listRect.width height: 35 color: "transparent" Text { id: imgStr text: qsTr(""); color: "white" font.pixelSize: 20 anchors.verticalCenter: parent.verticalCenter x: 20 } } Rectangle { id: iHeader width: listRect.width height: 50 color: "blue" Text { id: tep text: qsTr("Image Viewer"); color: "white" font.pixelSize: 24 font.bold: true anchors.centerIn: iHeader } } Rectangle { width: listRect.width height: 20 color: "black" } Rectangle { width: rootWindow.width height: listRect.height - 105 color: "black" FolderListModel { id: imageModel folder: "file:///media/ubuntu/exSATA/QtVideoBoxDATA/Images" sortField: "Time" sortReversed: true } Component { id: fileDelegate Rectangle { width: imageList.width height: 20 color: "transparent" Text { x: 10 text: fileName color: "white" font.pixelSize: 16 anchors.verticalCenter: parent.verticalCenter } } } Component { id: imageHighlight Rectangle { width: imageList.width height: 20 color: "green" } } ListView { id: imageList width: rootWindow.width height: listRect.height - 105 spacing: 10 currentIndex: currentIndex model: imageModel delegate: fileDelegate highlight: imageHighlight } } } }
My program is adding files to the folder used by FolderListModel. But when i review the ListView after, the last file name in list shows the same as the first file name. But when i try to read property of that file name it shows right name. But the list view shows the wrong name.
If i restart the application it shows the right list.I display list using following at key event.
listRect.visible = true imageList.focus = true