Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Best way to display many Images in GridView (QtQuickControls2, iOS)
Because iOS native Image Picker doesn’t allow multi-select,
I built my own GridView.
works perfect - have access to alll the Albums and Photos.
will publish the solution soon
people can have many Photos on their iPhone, so in the
future I'll try to deal with
For now in my QtQuickControls2 app I’m using GridView with Images
to get a flicker free scrolling I had to use
- async Loader for the Component
- async Image inside Component
- Image source is path from iOS
per ex. assets-library://asset/asset.JPG?id=AF3C1...9F1B2&ext=JPG
- Image sourceSize was set to something smaller as my GridView’s cellSize
Did some tests with cacheBuffer. GridView’s default is 320
changed default: model.length < 40? 900 : 320
now small albums with < 40 Photos are completely load and can scroll up / down without any reloading/refreshing
but for larger Photo collections scrolling up/down reloads Photos
only question I have: when opening first time and set the model of GridView,
the very first Photo was displayed, then it took some time before the other
visible Photos will be displayed - Qt seems to load Photos outside visible area
Is there any way I can change it that visible Images will be loaded from top down ?
Or do you have any other ideas HowTo make it better ?
VRonin last edited by
Can I ask how you are adding photos in the model? Is it a C++ model?
@VRonin yes - it's a list of QObject*
each entry describes a File:
- Folder, File
- Type (Image, Video, PDF, ...)
- Name (obsolet for iOS Photos)
- entries (if Folder)
and I'm constructing the collection per ex. from
PHFetchResult *smartAlbums = [PHAssetCollection fetchAssetCollectionsWithType:PHAssetCollectionTypeSmartAlbum subtype:PHAssetCollectionSubtypeAlbumRegular options:nil];