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. Add checkbox to QFileDialog

Add checkbox to QFileDialog

Scheduled Pinned Locked Moved Unsolved General and Desktop
8 Posts 3 Posters 2.4k 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.
  • krzysieklfcK Offline
    krzysieklfcK Offline
    krzysieklfc
    wrote on last edited by
    #1

    I'm calling QFileDialog::getExistingDirectory, but I would like to add a checkbox on the bottom right. What is the best way of doing it?

    1 Reply Last reply
    0
    • Christian EhrlicherC Offline
      Christian EhrlicherC Offline
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on last edited by
      #2

      You have to write your own dialog - QFileDialog does not support this.

      Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
      Visit the Qt Academy at https://academy.qt.io/catalog

      krzysieklfcK 1 Reply Last reply
      3
      • Christian EhrlicherC Christian Ehrlicher

        You have to write your own dialog - QFileDialog does not support this.

        krzysieklfcK Offline
        krzysieklfcK Offline
        krzysieklfc
        wrote on last edited by krzysieklfc
        #3

        @Christian-Ehrlicher

        I tried this solution but I don't get how to extract the layout from subclassed QFileDialog.

        QGridLayout* mainLayout = dynamic_cast<QGridLayout*>(this->layout());
        

        This doesn't work.

        1 Reply Last reply
        0
        • Christian EhrlicherC Offline
          Christian EhrlicherC Offline
          Christian Ehrlicher
          Lifetime Qt Champion
          wrote on last edited by
          #4

          How to you execute the dialog? You have to use exec(), not one of the static functions...

          Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
          Visit the Qt Academy at https://academy.qt.io/catalog

          krzysieklfcK 1 Reply Last reply
          3
          • Christian EhrlicherC Christian Ehrlicher

            How to you execute the dialog? You have to use exec(), not one of the static functions...

            krzysieklfcK Offline
            krzysieklfcK Offline
            krzysieklfc
            wrote on last edited by
            #5

            @Christian-Ehrlicher I'm calling exec(), but the thing is that this->layout() returns 0 in my case. I have no idea why is that considering my code looks pretty much the same as in the example here

            Pl45m4P 1 Reply Last reply
            0
            • Christian EhrlicherC Offline
              Christian EhrlicherC Offline
              Christian Ehrlicher
              Lifetime Qt Champion
              wrote on last edited by
              #6

              Please provide some code.

              Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
              Visit the Qt Academy at https://academy.qt.io/catalog

              1 Reply Last reply
              0
              • krzysieklfcK krzysieklfc

                @Christian-Ehrlicher I'm calling exec(), but the thing is that this->layout() returns 0 in my case. I have no idea why is that considering my code looks pretty much the same as in the example here

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

                @krzysieklfc

                From your "example":

                - Are you using QFileDialog::DontUseNativeDialog ?
                -> I am now! Problem solved - thanks.
                

                Have you tried this?

                Make sure, that your this-Pointer is not NULL


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

                ~E. W. Dijkstra

                krzysieklfcK 1 Reply Last reply
                2
                • Pl45m4P Pl45m4

                  @krzysieklfc

                  From your "example":

                  - Are you using QFileDialog::DontUseNativeDialog ?
                  -> I am now! Problem solved - thanks.
                  

                  Have you tried this?

                  Make sure, that your this-Pointer is not NULL

                  krzysieklfcK Offline
                  krzysieklfcK Offline
                  krzysieklfc
                  wrote on last edited by
                  #8

                  @Pl45m4 That solved it. Thanks for help

                  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