Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Best way to display many Images in GridView (QtQuickControls2, iOS)

Best way to display many Images in GridView (QtQuickControls2, iOS)

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
qqc2iosgridview
3 Posts 2 Posters 1.1k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • ekkescornerE Offline
    ekkescornerE Offline
    ekkescorner
    Qt Champions 2016
    wrote on last edited by
    #1

    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 PHCachingImageManager, PHImageManager ...

    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
    first.
    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 ?

    ekke ... Qt Champion 2016 | 2024 ... mobile business apps
    5.15 --> 6.8 https://t1p.de/ekkeChecklist
    QMake --> CMake https://t1p.de/ekkeCMakeMobileApps

    1 Reply Last reply
    0
    • VRoninV Offline
      VRoninV Offline
      VRonin
      wrote on last edited by
      #2

      Can I ask how you are adding photos in the model? Is it a C++ model?

      "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
      ~Napoleon Bonaparte

      On a crusade to banish setIndexWidget() from the holy land of Qt

      ekkescornerE 1 Reply Last reply
      0
      • VRoninV VRonin

        Can I ask how you are adding photos in the model? Is it a C++ model?

        ekkescornerE Offline
        ekkescornerE Offline
        ekkescorner
        Qt Champions 2016
        wrote on last edited by ekkescorner
        #3

        @VRonin yes - it's a list of QObject*
        each entry describes a File:

        • Folder, File
        • Type (Image, Video, PDF, ...)
        • Path
        • 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];
        

        ekke ... Qt Champion 2016 | 2024 ... mobile business apps
        5.15 --> 6.8 https://t1p.de/ekkeChecklist
        QMake --> CMake https://t1p.de/ekkeCMakeMobileApps

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved