Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Unsolved How do I choose from photos stored on my phone

    QML and Qt Quick
    5
    8
    279
    Loading More Posts
    • 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.
    • M
      Mikeeeeee last edited by

      Hi!
      How do I choose from photos stored on my phone?
      For example, so do in messengers.

      1 Reply Last reply Reply Quote 0
      • IntruderExcluder
        IntruderExcluder last edited by

        Use FileDialog from platform module. Probably you need correct rights to acces photos from your app.

        1 Reply Last reply Reply Quote 1
        • M
          Mikeeeeee last edited by

          But FileDialog shows all files and folders. How can I preview all photos in one window?

          jsulm 1 Reply Last reply Reply Quote 0
          • jsulm
            jsulm Lifetime Qt Champion @Mikeeeeee last edited by jsulm

            @mikeeeeee You did not read the documentation, right?
            For QML: https://doc.qt.io/qt-5/qml-qtquick-dialogs-filedialog.html#nameFilters-prop
            For Widgets: https://doc.qt.io/qt-5/qfiledialog.html#setNameFilter (one of the possibilities)

            "How can I preview all photos in one window?" - I don't think you can as on Android photos can be stored in different locations.

            https://forum.qt.io/topic/113070/qt-code-of-conduct

            1 Reply Last reply Reply Quote 1
            • M
              Mikeeeeee last edited by

              But for example, Skype and other messengers display pictures from all over the phone. So it can be done. I wonder how it can be done?

              JonB 1 Reply Last reply Reply Quote 0
              • JonB
                JonB @Mikeeeeee last edited by JonB

                @mikeeeeee
                So if you/we do not know of a "phone system call" to do this, and QML/Qt does not offer anything for it, you have to look over the phone/in known locations to find the photos, and roll your own "file chooser" for it instead of FileDialog. Perhaps that is all Skype etc. are doing in code.

                1 Reply Last reply Reply Quote 0
                • IntruderExcluder
                  IntruderExcluder last edited by

                  To do this you will probably need to go deeper use phone OS native API.

                  1 Reply Last reply Reply Quote 1
                  • J.Hilk
                    J.Hilk Moderators last edited by J.Hilk

                    this, blog post is probably exactly what you're looking for, even has an example project, if I see that correctly

                    accroding to the poster, the example doesn't work out of the box for newer versions of android, you'll have to apply some fixes apparently.

                    Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct

                    Qt Needs YOUR vote: https://bugreports.qt.io/browse/QTQAINFRA-4121


                    Q: What's that?
                    A: It's blue light.
                    Q: What does it do?
                    A: It turns blue.

                    1 Reply Last reply Reply Quote 2
                    • First post
                      Last post