|
如果你能用qml的话,直接用那个folderListModel,也就一百行不到的代码就搞定了。我给你贴一段。- ////////////////////////////////////////////////////////////////// file model
- FolderListModel {
- id: modelFolder
- folder: folderPath
- nameFilters: ["*.jpg", "*.jpeg", "*.JPG", "*.JPEG", "*.PNG", "*.png", "*.gif", "*.GIF"]
- }
- ////////////////////////////////////////////////////////////////// photo gridview
- GridView {
- id: gvPhoto
- anchors.fill: parent
- cellWidth: width / 3
- cellHeight: cellWidth
- model: modelFolder
- delegate: delegatePhoto
- }
- // delegate 我省略了,你自己可以试着放一个Image
复制代码 |
|