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.
  • Q qAminzzz

    @JKSH thanks (:

    i runned qt in android. now i just wanna get all videos in android device to make an application. something like gallery.
    i hope to do this with qt code. but i think there is a java code
    please help me to do this with qt

    jsulmJ Offline
    jsulmJ Offline
    jsulm
    Lifetime Qt Champion
    wrote on last edited by
    #6

    @qAminzzz Use https://doc.qt.io/qt-5/qstandardpaths.html to get the paths to video/image locations.
    Don't forget to request access rights from Android.

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

    Q 2 Replies Last reply
    0
    • jsulmJ jsulm

      @qAminzzz Use https://doc.qt.io/qt-5/qstandardpaths.html to get the paths to video/image locations.
      Don't forget to request access rights from Android.

      Q Offline
      Q Offline
      qAminzzz
      wrote on last edited by qAminzzz
      #7
      This post is deleted!
      1 Reply Last reply
      0
      • jsulmJ jsulm

        @qAminzzz Use https://doc.qt.io/qt-5/qstandardpaths.html to get the paths to video/image locations.
        Don't forget to request access rights from Android.

        Q Offline
        Q Offline
        qAminzzz
        wrote on last edited by qAminzzz
        #8

        @jsulm thanks for link.
        i searched in this link and i made this code :

        QStringList movies = QStandardPaths::standardLocations(QStandardPaths::PicturesLocation);
        
            
        
            foreach(QString file, movies)
        
            {
        
                qInfo() << "path: " << file;
        
            }
        
        output:
        
        path:  "/storage/emulated/0/Pictures"
        path:  "/storage/emulated/0/Android/data/org.qtproject.example.videoTesting/files/Pictures"
        

        i think it did not work correctly because in "/storage/emulated/0/Pictures" directory there is no all my android device pictures

        please help me

        jsulmJ 1 Reply Last reply
        0
        • Q qAminzzz

          @jsulm thanks for link.
          i searched in this link and i made this code :

          QStringList movies = QStandardPaths::standardLocations(QStandardPaths::PicturesLocation);
          
              
          
              foreach(QString file, movies)
          
              {
          
                  qInfo() << "path: " << file;
          
              }
          
          output:
          
          path:  "/storage/emulated/0/Pictures"
          path:  "/storage/emulated/0/Android/data/org.qtproject.example.videoTesting/files/Pictures"
          

          i think it did not work correctly because in "/storage/emulated/0/Pictures" directory there is no all my android device pictures

          please help me

          jsulmJ Offline
          jsulmJ Offline
          jsulm
          Lifetime Qt Champion
          wrote on last edited by
          #9

          @qAminzzz Where do you store the pictures on your device? Do you store them on sd card?

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

          Q 1 Reply Last reply
          0
          • jsulmJ jsulm

            @qAminzzz Where do you store the pictures on your device? Do you store them on sd card?

            Q Offline
            Q Offline
            qAminzzz
            wrote on last edited by
            #10

            @jsulm no only on internal storage. i just wanna get all files address that are in my gallery device

            jsulmJ 1 Reply Last reply
            0
            • Q qAminzzz

              @jsulm no only on internal storage. i just wanna get all files address that are in my gallery device

              jsulmJ Offline
              jsulmJ Offline
              jsulm
              Lifetime Qt Champion
              wrote on last edited by
              #11

              @qAminzzz Does your app request access to images storage?

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

              Q 1 Reply Last reply
              0
              • jsulmJ jsulm

                @qAminzzz Does your app request access to images storage?

                Q Offline
                Q Offline
                qAminzzz
                wrote on last edited by qAminzzz
                #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
                0
                • Q qAminzzz

                  @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 last edited by qAminzzz
                  #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

                  jsulmJ 1 Reply Last reply
                  0
                  • Q qAminzzz

                    @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

                    jsulmJ Offline
                    jsulmJ Offline
                    jsulm
                    Lifetime Qt Champion
                    wrote on 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
                    0
                    • jsulmJ jsulm

                      @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 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
                      • jsulmJ Offline
                        jsulmJ Offline
                        jsulm
                        Lifetime Qt Champion
                        wrote on 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 last edited by
                          #17

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

                          jsulmJ 1 Reply Last reply
                          0
                          • Q qAminzzz

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

                            jsulmJ Offline
                            jsulmJ Offline
                            jsulm
                            Lifetime Qt Champion
                            wrote on 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
                            0
                            • jsulmJ jsulm

                              @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 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

                              jsulmJ 1 Reply Last reply
                              0
                              • Q qAminzzz

                                @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

                                jsulmJ Offline
                                jsulmJ Offline
                                jsulm
                                Lifetime Qt Champion
                                wrote on 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
                                0
                                • jsulmJ jsulm

                                  @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 last edited by qAminzzz
                                  #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

                                  • Login

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