IOS Photo Gallery View in Qt



  • Hi,
    I want to implement Photo Gallery View for IOS devices, quite researched regarding this, found something called UIImagePickerController but i don't have any idea how to use this in Qt. Can anyone plz help me with solution and some sample code to implement.


  • Lifetime Qt Champion

    Hi and welcome to devnet,

    IIRC, you can already access the Photo Gallery using QFileDialog.



  • Thank you for the reply SGaist :)

    I have used QFileDialog it works fine, but problem with that is it open's computer style file browser in which I need to go through the file system, its doesn't give the native UI feel or it doesn't provide Images in grid or list format, for example the android photo gallery in which we can see it in grid style, that is not possible from QFileDialog.



  • When using FileDialog in QML, set the property

    folder:shortcuts.pictures
    


  • Thanks you @Schluchti,

    That is similar to QStandardPaths::standardLocations(QStandardPaths::PicturesLocation) in Qt both doesn't serve my purpose.


  • Qt Champions 2016

    @Manohar_SL Hi , you may take a look with this sample code:

    quickios/qisystemutils.mm at master · benlau/quickios

    It launch UIImagePickerController and return the selected image via a custom messenger class. The repo also contains an example project that you could try it on phone.



  • Thanks you @benlau
    Its great i just had a look, it works. Its good example to explore on Object -c with Qt.
    @SGaist , I had tried following piece of code with QFileDialog am able to achieve my task in IOS

    const QStringList picturesLocations = QStandardPaths::standardLocations(QStandardPaths::PicturesLocation);
    dialog.setDirectory(picturesLocations.isEmpty() ? QDir::currentPath() : picturesLocations.last());
    
    QStringList mimeTypeFilters;
    const QByteArrayList supportedMimeTypes = acceptMode == QFileDialog::AcceptOpen
            ? QImageReader::supportedMimeTypes() : QImageWriter::supportedMimeTypes();
    foreach (const QByteArray &mimeTypeName, supportedMimeTypes)
        mimeTypeFilters.append(mimeTypeName);
    mimeTypeFilters.sort();
    dialog.setMimeTypeFilters(mimeTypeFilters);
    dialog.selectMimeTypeFilter("image/jpeg");
    if (acceptMode == QFileDialog::AcceptSave)
        dialog.setDefaultSuffix("jpg");


  • Hi!
    You can also have at a look at V-Play Engine, which offers to easily access the native iOS or Android photo gallery picker from QML with their NativeUtils component.

    Cheers,
    GT


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.