Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. get a QList<QUrl> from folder
Forum Updated to NodeBB v4.3 + New Features

get a QList<QUrl> from folder

Scheduled Pinned Locked Moved Solved General and Desktop
5 Posts 3 Posters 892 Views 1 Watching
  • 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.
  • N Offline
    N Offline
    NguyenMinh
    wrote on last edited by
    #1

    Hello,
    I'm trying to get a list url of the mp3 file from a folder.
    I have tried

    urlList=QFileDialog::getOpenFileUrls(nullptr,QString(),temp,"*.mp3",nullptr,QFileDialog::ShowDirsOnly);
    

    but it still let me chose file instead of folder.
    Is there any other way to do what I want?

    jsulmJ 1 Reply Last reply
    0
    • N NguyenMinh

      Hello,
      I'm trying to get a list url of the mp3 file from a folder.
      I have tried

      urlList=QFileDialog::getOpenFileUrls(nullptr,QString(),temp,"*.mp3",nullptr,QFileDialog::ShowDirsOnly);
      

      but it still let me chose file instead of folder.
      Is there any other way to do what I want?

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

      @NguyenMinh said in get a QList<QUrl> from folder:

      but it still let me chose file instead of folder

      Isn't that what you want to do: get a list of mp3 files? Or do you mean it lets you select directories?
      If you want to select directory use https://doc.qt.io/qt-5/qfiledialog.html#getExistingDirectoryUrl

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

      N 1 Reply Last reply
      3
      • jsulmJ jsulm

        @NguyenMinh said in get a QList<QUrl> from folder:

        but it still let me chose file instead of folder

        Isn't that what you want to do: get a list of mp3 files? Or do you mean it lets you select directories?
        If you want to select directory use https://doc.qt.io/qt-5/qfiledialog.html#getExistingDirectoryUrl

        N Offline
        N Offline
        NguyenMinh
        wrote on last edited by
        #3

        @jsulm but I want to chose folder and get QList<QUrl> of all mp3 file in that folder

        getExistingDirectoryUrl only return a QUrl of that folder

        jsulmJ Pl45m4P 2 Replies Last reply
        0
        • N NguyenMinh

          @jsulm but I want to chose folder and get QList<QUrl> of all mp3 file in that folder

          getExistingDirectoryUrl only return a QUrl of that folder

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

          @NguyenMinh I really don't understand the problem: getOpenFileUrls opens a file dialog where you can navigate through all your directories and select files.
          If you want to select a directory when opening the dialog then take a look at documentation: https://doc.qt.io/qt-5/qfiledialog.html#getOpenFileUrls - there is dir parameter for that.
          If you want to know which directory user selected simply check the path of the first returned file URL - it will contain the whole path including the directory.

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

          1 Reply Last reply
          3
          • N NguyenMinh

            @jsulm but I want to chose folder and get QList<QUrl> of all mp3 file in that folder

            getExistingDirectoryUrl only return a QUrl of that folder

            Pl45m4P Offline
            Pl45m4P Offline
            Pl45m4
            wrote on last edited by
            #5

            @NguyenMinh

            EntryInfo together with a *.mp3 Filter should do the job.
            You can convert the absolute paths to QUrl, if you need to.


            If debugging is the process of removing software bugs, then programming must be the process of putting them in.

            ~E. W. Dijkstra

            1 Reply Last reply
            2

            • Login

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