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. How do you add a popup window in QML?

How do you add a popup window in QML?

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
3 Posts 3 Posters 2.6k 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.
  • E Offline
    E Offline
    edorval
    wrote on last edited by
    #1

    How do you create a pop up window in QML, such that a separate window pops up, similar to that of the Qt C++ MainWindow function?

    ODБOïO S 2 Replies Last reply
    0
    • E edorval

      How do you create a pop up window in QML, such that a separate window pops up, similar to that of the Qt C++ MainWindow function?

      ODБOïO Offline
      ODБOïO Offline
      ODБOï
      wrote on last edited by
      #2

      @edorval hi
      see Qt Quick Popup Controls

      1 Reply Last reply
      2
      • E edorval

        How do you create a pop up window in QML, such that a separate window pops up, similar to that of the Qt C++ MainWindow function?

        S Offline
        S Offline
        sharath
        wrote on last edited by
        #3

        @edorval Hi,
        follow below example,

        Window {
            id: rootWindow
            visible: true
            width: 600
            height: 800
            property color popupBackGroundColor: "#b44"
            property color popupTextCOlor: "#ffffff"
        
            
            Popup {
                    id: popup
                    property alias popMessage: message.text
        
                    background: Rectangle {
                        implicitWidth: rootWindow.width
                        implicitHeight: 60
                        color: popupBackGroundColor
                    }
                    y: (rootWindow.height - 60)
                    modal: true
                    focus: true
                    closePolicy: Popup.CloseOnPressOutside
                    Text {
                        id: message
                        anchors.centerIn: parent
                        font.pointSize: 12
                        color: popupTextCOlor
                    }
                    onOpened: popupClose.start()
                }
        
                // Popup will be closed automatically in 2 seconds after its opened
                Timer {
                    id: popupClose
                    interval: 2000
                    onTriggered: popup.close()
                }
        }
        
        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