Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Dialogs in Qt 6 using CMake
Forum Updated to NodeBB v4.3 + New Features

Dialogs in Qt 6 using CMake

Scheduled Pinned Locked Moved Solved QML and Qt Quick
10 Posts 4 Posters 1.4k Views 2 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.
  • Q Offline
    Q Offline
    qcoderpro
    wrote on last edited by qcoderpro
    #1

    Hi,

    Went for this page and read it until end, then created the following example just to make sure it works:

    dsfd.PNG

    The dialog is not shown! There's either no errors! What is the problem, please?

    Qt 6.2.2, CMake

    raven-worxR 1 Reply Last reply
    0
    • Q qcoderpro

      Hi,

      Went for this page and read it until end, then created the following example just to make sure it works:

      dsfd.PNG

      The dialog is not shown! There's either no errors! What is the problem, please?

      Qt 6.2.2, CMake

      raven-worxR Offline
      raven-worxR Offline
      raven-worx
      Moderators
      wrote on last edited by raven-worx
      #2

      @qcoderpro
      you must call open() on the dialog at some point. its not visible by default.
      https://doc.qt.io/qt-5/qml-qtquick-controls2-popup.html#details
      (Dialog inherits Popup)

      --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
      If you have a question please use the forum so others can benefit from the solution in the future

      Q 1 Reply Last reply
      1
      • raven-worxR raven-worx

        @qcoderpro
        you must call open() on the dialog at some point. its not visible by default.
        https://doc.qt.io/qt-5/qml-qtquick-controls2-popup.html#details
        (Dialog inherits Popup)

        Q Offline
        Q Offline
        qcoderpro
        wrote on last edited by
        #3

        @raven-worx

        Or simply, visible: true.
        Thank you for your brief and to the point reply.

        1 Reply Last reply
        0
        • Q Offline
          Q Offline
          qcoderpro
          wrote on last edited by qcoderpro
          #4

          Now if I want to add a simple FileDialog like this:

          FileDialog {
                 id: fileDialog
                 folder: StandardPaths.writableLocation(StandardPaths.DocumentsLocation)
             }
          

          The compiler gives me the error: FileDialog is not a type
          So I need import Qt.labs.platform. When I add that, this time I get an error about the Dialog!
          Dialog is an abstract base class

          Seemingly there can't be possible to have both the Dialog and FileDialog elements together in a project!

          1 Reply Last reply
          0
          • kkoehneK Offline
            kkoehneK Offline
            kkoehne
            Moderators
            wrote on last edited by
            #5

            @qcoderpro said in Dialogs in Qt 6 using CMake:

            The compiler gives me the error: FileDialog is not a type
            So I need import Qt.labs.platform.

            Dialog in FileDialog is in QtQuick.Dialogs import though: https://doc.qt.io/qt-6/qml-qtquick-dialogs-filedialog.html . Can you try this?

            Director R&D, The Qt Company

            Q 1 Reply Last reply
            0
            • kkoehneK kkoehne

              @qcoderpro said in Dialogs in Qt 6 using CMake:

              The compiler gives me the error: FileDialog is not a type
              So I need import Qt.labs.platform.

              Dialog in FileDialog is in QtQuick.Dialogs import though: https://doc.qt.io/qt-6/qml-qtquick-dialogs-filedialog.html . Can you try this?

              Q Offline
              Q Offline
              qcoderpro
              wrote on last edited by qcoderpro
              #6

              @kkoehne

              Apparently Qt6's elements are just being updated. Look the first example in that link where there's a folder property. Do you see it in on the list declared as FileDialog properties!? The Qt Creator's compiler also rises an error regarding that.

              1 Reply Last reply
              0
              • GrecKoG Offline
                GrecKoG Offline
                GrecKo
                Qt Champions 2018
                wrote on last edited by
                #7

                The 2 imports are clashing because they both contain a Dialog type. Use an "import as" to prevent this:

                import QtQuick
                import QtQuick.Controls
                import Qt.labs.platform as Labs
                
                Window {
                   // ...
                   Dialog {
                       // ...
                    }
                    Labs.FileDialog {
                        // ...
                    }
                }
                
                Q 1 Reply Last reply
                1
                • GrecKoG GrecKo

                  The 2 imports are clashing because they both contain a Dialog type. Use an "import as" to prevent this:

                  import QtQuick
                  import QtQuick.Controls
                  import Qt.labs.platform as Labs
                  
                  Window {
                     // ...
                     Dialog {
                         // ...
                      }
                      Labs.FileDialog {
                          // ...
                      }
                  }
                  
                  Q Offline
                  Q Offline
                  qcoderpro
                  wrote on last edited by qcoderpro
                  #8

                  @GrecKo

                  The 2 imports are clashing because they both contain a Dialog type. Use an "import as" to prevent this:

                  I'm glad to know that how you found this.

                  Still the compiler has an issue with the folder line!
                  ReferenceError: StandardPaths is not defined

                  Dialog {
                         id: dialog
                         x: 200
                         title: "test"
                         visible: true
                         standardButtons: Dialog.Ok | Dialog.Cancel
                     }
                  
                     Labs.FileDialog {
                         id: fileDialog
                         folder: StandardPaths.writableLocation(StandardPaths.DocumentsLocation)
                     }
                  
                  GrecKoG 1 Reply Last reply
                  1
                  • Q qcoderpro

                    @GrecKo

                    The 2 imports are clashing because they both contain a Dialog type. Use an "import as" to prevent this:

                    I'm glad to know that how you found this.

                    Still the compiler has an issue with the folder line!
                    ReferenceError: StandardPaths is not defined

                    Dialog {
                           id: dialog
                           x: 200
                           title: "test"
                           visible: true
                           standardButtons: Dialog.Ok | Dialog.Cancel
                       }
                    
                       Labs.FileDialog {
                           id: fileDialog
                           folder: StandardPaths.writableLocation(StandardPaths.DocumentsLocation)
                       }
                    
                    GrecKoG Offline
                    GrecKoG Offline
                    GrecKo
                    Qt Champions 2018
                    wrote on last edited by
                    #9

                    @qcoderpro said in Dialogs in Qt 6 using CMake:

                    I'm glad to know that how you found this.

                    I read https://doc.qt.io/qt-6/qmlreference.html

                    Q 1 Reply Last reply
                    1
                    • GrecKoG GrecKo

                      @qcoderpro said in Dialogs in Qt 6 using CMake:

                      I'm glad to know that how you found this.

                      I read https://doc.qt.io/qt-6/qmlreference.html

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

                      Still the problem with a property of FileDialog to bring the explorer window to select the file exits: Cannot assign to non-existent property "folder". I also tried currentfolder but the same error message!

                      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