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. Point QFileDialog to 'This PC'

Point QFileDialog to 'This PC'

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

    Hi I want a QFileDialog to open the This PC folder in Windows by default. I have tried passing the following to QFileDialog::getExistingDirectory(this, "Select Target Directory", enter folder here);:

    ::{20D04FE0-3AEA-1069-A2D8-08002B30309D}
    file:\\
    file:
    shell:mycomputerfolder
    

    Is this possible? If so how? Thanks!

    1 Reply Last reply
    0
    • Chris KawaC Offline
      Chris KawaC Offline
      Chris Kawa
      Lifetime Qt Champion
      wrote on last edited by
      #2

      You need to use the url variant of the method with a clsid scheme:

      QFileDialog::getExistingDirectoryUrl(this, "Select Target Directory", QUrl("clsid:0AC0837C-BBF8-452A-850D-79D08E667CA7"))
      
      C 1 Reply Last reply
      3
      • Chris KawaC Chris Kawa

        You need to use the url variant of the method with a clsid scheme:

        QFileDialog::getExistingDirectoryUrl(this, "Select Target Directory", QUrl("clsid:0AC0837C-BBF8-452A-850D-79D08E667CA7"))
        
        C Offline
        C Offline
        Crag_Hack
        wrote on last edited by
        #3

        @Chris-Kawa Thanks. QUrl doesn't convert to QString for the QFileDialog and if I do .toString() it doesn't work.

        1 Reply Last reply
        0
        • M Offline
          M Offline
          mchinand
          wrote on last edited by
          #4

          @Chris-Kawa said in Point QFileDialog to 'This PC':

          QFileDialog::getExistingDirectoryUrl

          The static method @Chris-Kawa mentioned for you to use is QFileDialog::getExistingDirectoryUrl()

          which takes a QUrl() as one of its parameters. https://doc.qt.io/qt-6/qfiledialog.html#getExistingDirectoryUrl

          1 Reply Last reply
          2
          • C Offline
            C Offline
            Crag_Hack
            wrote on last edited by
            #5

            Ah IC thanks, sorry bout that I can be a flaky coder sometimes

            1 Reply Last reply
            0

            • Login

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