Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. Module "QtMobility.gallery" is not installed
QtWS25 Last Chance

Module "QtMobility.gallery" is not installed

Scheduled Pinned Locked Moved Solved Installation and Deployment
qmlandroidqt 5qtmobility
21 Posts 3 Posters 3.0k 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.
  • J jsulm
    8 Nov 2021, 10:30

    @qAminzzz Does your app request access to images storage?

    Q Offline
    Q Offline
    qAminzzz
    wrote on 8 Nov 2021, 10:43 last edited by qAminzzz 11 Aug 2021, 12:04
    #12

    @jsulm i just did it

    QtAndroid::PermissionResultMap resultHash = QtAndroid::requestPermissionsSync(QStringList(
                                                                                      {
                                                                                          "android.permission.WRITE_EXTERNAL_STORAGE",
                                                                                          "android.permission.READ_EXTERNAL_STORAGE"
                                                                                      }
                                                                                      ));
    

    and works fine
    should i request permission more?

    Q 1 Reply Last reply 8 Nov 2021, 12:06
    0
    • Q qAminzzz
      8 Nov 2021, 10:43

      @jsulm i just did it

      QtAndroid::PermissionResultMap resultHash = QtAndroid::requestPermissionsSync(QStringList(
                                                                                        {
                                                                                            "android.permission.WRITE_EXTERNAL_STORAGE",
                                                                                            "android.permission.READ_EXTERNAL_STORAGE"
                                                                                        }
                                                                                        ));
      

      and works fine
      should i request permission more?

      Q Offline
      Q Offline
      qAminzzz
      wrote on 8 Nov 2021, 12:06 last edited by qAminzzz 11 Aug 2021, 12:07
      #13

      @qAminzzz
      i can show video in my app with these codes

          Video
          {
              id: video
              anchors.fill: parent
              source: "file:///storage/emulated/0/download/video.mp4"
              visible: true
              volume: 20
      
      
              MouseArea
              {
                  anchors.fill: parent
                  onClicked:
                  {
                      video.play()
                  }
              }
      

      and this works fine.
      now i want create a class and get all videos in android device with a function and return them to Video.source

      J 1 Reply Last reply 8 Nov 2021, 12:35
      0
      • Q qAminzzz
        8 Nov 2021, 12:06

        @qAminzzz
        i can show video in my app with these codes

            Video
            {
                id: video
                anchors.fill: parent
                source: "file:///storage/emulated/0/download/video.mp4"
                visible: true
                volume: 20
        
        
                MouseArea
                {
                    anchors.fill: parent
                    onClicked:
                    {
                        video.play()
                    }
                }
        

        and this works fine.
        now i want create a class and get all videos in android device with a function and return them to Video.source

        J Offline
        J Offline
        jsulm
        Lifetime Qt Champion
        wrote on 8 Nov 2021, 12:35 last edited by
        #14

        @qAminzzz said in Module "QtMobility.gallery" is not installed:

        now i want create a class and get all videos in android device with a function and return them to Video.source

        Then you can go through all the paths where the user can store something (not only images/videos locations) and then use https://doc.qt.io/qt-5/qdir.html#entryList-1 for each of these paths to get the files there and filter those by file extension.

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

        Q 1 Reply Last reply 8 Nov 2021, 12:41
        0
        • J jsulm
          8 Nov 2021, 12:35

          @qAminzzz said in Module "QtMobility.gallery" is not installed:

          now i want create a class and get all videos in android device with a function and return them to Video.source

          Then you can go through all the paths where the user can store something (not only images/videos locations) and then use https://doc.qt.io/qt-5/qdir.html#entryList-1 for each of these paths to get the files there and filter those by file extension.

          Q Offline
          Q Offline
          qAminzzz
          wrote on 8 Nov 2021, 12:41 last edited by
          #15

          @jsulm this link shows to get all files in a directory
          but might be there a directory in that directory
          or might be there 10 directory in one directory and we can't search all them

          but in device gallery there is all media like screen shots, apps, downloads and ...
          but in this way we can just see all files in a directory not in device
          is there any way to do gallery device work?

          1 Reply Last reply
          0
          • J Offline
            J Offline
            jsulm
            Lifetime Qt Champion
            wrote on 8 Nov 2021, 12:43 last edited by
            #16

            You can also use https://doc.qt.io/qt-5/qdiriterator.html which is reqursive

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

            1 Reply Last reply
            0
            • Q Offline
              Q Offline
              qAminzzz
              wrote on 8 Nov 2021, 12:56 last edited by
              #17

              no which does not my request ):, may i have to use java ):
              thank you for help (:

              J 1 Reply Last reply 8 Nov 2021, 12:59
              0
              • Q qAminzzz
                8 Nov 2021, 12:56

                no which does not my request ):, may i have to use java ):
                thank you for help (:

                J Offline
                J Offline
                jsulm
                Lifetime Qt Champion
                wrote on 8 Nov 2021, 12:59 last edited by
                #18

                @qAminzzz said in Module "QtMobility.gallery" is not installed:

                no which does not my request

                Not sure what this means?

                "but in device gallery there is all media like screen shots, apps, downloads and" - because the gallery app collects the files from many different locations on the device...
                I don't know whether there is an Java API on Android for that.

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

                Q 1 Reply Last reply 8 Nov 2021, 13:06
                0
                • J jsulm
                  8 Nov 2021, 12:59

                  @qAminzzz said in Module "QtMobility.gallery" is not installed:

                  no which does not my request

                  Not sure what this means?

                  "but in device gallery there is all media like screen shots, apps, downloads and" - because the gallery app collects the files from many different locations on the device...
                  I don't know whether there is an Java API on Android for that.

                  Q Offline
                  Q Offline
                  qAminzzz
                  wrote on 8 Nov 2021, 13:06 last edited by
                  #19

                  @jsulm yeah gallery does it. how can i do this me too?
                  can i search all directories with QDiriterator ?

                  im new in qt (just 4 month). i know what you feel -
                  thank you for help

                  J 1 Reply Last reply 8 Nov 2021, 13:08
                  0
                  • Q qAminzzz
                    8 Nov 2021, 13:06

                    @jsulm yeah gallery does it. how can i do this me too?
                    can i search all directories with QDiriterator ?

                    im new in qt (just 4 month). i know what you feel -
                    thank you for help

                    J Offline
                    J Offline
                    jsulm
                    Lifetime Qt Champion
                    wrote on 8 Nov 2021, 13:08 last edited by
                    #20

                    @qAminzzz said in Module "QtMobility.gallery" is not installed:

                    can i search all directories with QDiriterator ?

                    yes, at least those where your app has read access

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

                    Q 1 Reply Last reply 8 Nov 2021, 13:38
                    0
                    • J jsulm
                      8 Nov 2021, 13:08

                      @qAminzzz said in Module "QtMobility.gallery" is not installed:

                      can i search all directories with QDiriterator ?

                      yes, at least those where your app has read access

                      Q Offline
                      Q Offline
                      qAminzzz
                      wrote on 8 Nov 2021, 13:38 last edited by qAminzzz 11 Aug 2021, 13:39
                      #21

                      @jsulm thank you so much
                      it worked with these code:

                      function:

                      void searchPaths(QVariant path)
                      {
                          QStringList files; // add files to this ( paths )
                          QStringList filter; // mp4 files filter
                      
                          filter << "*.mp4"; // add filter
                      
                          qInfo("-----");
                      
                          QDirIterator dir(path.toString(), filter, QDir::Files, QDirIterator::Subdirectories); // get all files in directory
                          while (dir.hasNext())
                          {
                              qInfo() << dir.next();
                              files << dir.next(); // 
                          }
                      }
                      
                      

                      use:

                      searchPaths("enter path here") 
                      
                      

                      now i can sleep easy. thanks

                      1 Reply Last reply
                      1

                      21/21

                      8 Nov 2021, 13:38

                      • Login

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