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. Qt Quick Controls Dialog?
QtWS25 Last Chance

Qt Quick Controls Dialog?

Scheduled Pinned Locked Moved QML and Qt Quick
9 Posts 3 Posters 3.1k 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.
  • J Offline
    J Offline
    JesperWe
    wrote on last edited by
    #1

    Ok, complete noob here who was tempted by the 5.2 beta announcement to check out QML for the first time.

    I installed the beta, fired up QtCreator 3, and started a new "Qt Quick 2 UI with controls" project to play around. I started to recreate the UI of my last GUI project, and immediatly hit the wall.

    How do I do the good old "Help > About ..." dialog?

    I found the ColorDialog and FileDialog, but no mention of a generic dialog in the docs. Googling yieds some references to an experimental dialog component in 5.1 and some ways to do dialogs using Qt Quick 1.0 without controls, which is probably not what I want.

    What would the proper way of doing this with 5.2 be?

    1 Reply Last reply
    0
    • sierdzioS Offline
      sierdzioS Offline
      sierdzio
      Moderators
      wrote on last edited by
      #2

      Calling C++ for help is probably the only option.

      (Z(:^

      1 Reply Last reply
      0
      • J Offline
        J Offline
        JesperWe
        wrote on last edited by
        #3

        (and yeah, I know this is stone age ui style, that's not the point....)

        1 Reply Last reply
        0
        • J Offline
          J Offline
          JesperWe
          wrote on last edited by
          #4

          So I am to understand that as things stand in 5.2, QT Quick Controls are only useable in my main application window, and any dialogs or popups should be implemented in C++?

          1 Reply Last reply
          0
          • sierdzioS Offline
            sierdzioS Offline
            sierdzio
            Moderators
            wrote on last edited by
            #5

            You can use Window QML element, AFAIK. I'm not too fluent in Quick Controls, so I can't say for sure, though.

            (Z(:^

            1 Reply Last reply
            0
            • J Offline
              J Offline
              JesperWe
              wrote on last edited by
              #6

              OK, got it after a bit more digging. It wasn't hard at all, it's just that there is no docs for QtQCntrl 5.2 yet and a lot of the stuff on Stackoverflow and Youtube is very outdated...

              1 Reply Last reply
              0
              • sierdzioS Offline
                sierdzioS Offline
                sierdzio
                Moderators
                wrote on last edited by
                #7

                That could very well be. Please post the solution if you may, it might be useful to others, myself included :D

                (Z(:^

                1 Reply Last reply
                0
                • JKSHJ Offline
                  JKSHJ Offline
                  JKSH
                  Moderators
                  wrote on last edited by
                  #8

                  Hi,

                  I haven't used it myself, but have a look at "QtQuick.Window":http://qt-project.org/doc/qt-5.1/qtquick/qml-qtquick-window2-window.html I'd imagine you can create a modal window to act as an About box.

                  EDIT: That was exactly what Sierdzio recommended earlier. I need to read better :P

                  Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

                  1 Reply Last reply
                  0
                  • J Offline
                    J Offline
                    JesperWe
                    wrote on last edited by
                    #9

                    @import QtQuick 2.1
                    import QtQuick.Controls 1.0
                    import QtQuick.Window 2.0

                    ApplicationWindow {
                    title: qsTr("Hello World")
                    id: mainWindow
                    width: 640
                    height: 480

                    menuBar: MenuBar {
                        Menu {
                            title: qsTr("File")
                            MenuItem {
                                text: qsTr("Exit")
                                onTriggered: Qt.quit();
                            }
                        }
                        Menu {
                            title: qsTr("Help")
                            MenuItem {
                                text: qsTr("About...")
                                onTriggered: aboutWin.show();
                            }
                        }
                    }
                    
                    Button {
                        text: qsTr("Hello World")
                        anchors.horizontalCenter: parent.horizontalCenter
                        anchors.verticalCenter: parent.verticalCenter
                    }  
                    
                    Window {
                        id: aboutWin;
                        color: "black";
                        title: "About Me";
                    
                        x: mainWindow.x + mainWindow.width/2 - width/2
                        y: mainWindow.y + mainWindow.height/2 - height/2
                    
                        Rectangle {
                            anchors.fill: parent
                            anchors.margins: 10
                    
                            Text {
                                anchors.centerIn: parent
                                text: "Glory Be!"
                            }
                        }
                    }
                    

                    }
                    @

                    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