Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Draggable Popup



  • Hi, how can I achieve a dragable popup, which the user can move around the screen?
    I have a QML component with a MouseArea child using onClicked: myPopup.open()

    myPopup.qml:

    Popup {
        id: root
        x: 100
        closePolicy: Popup.CloseOnEscape 
    
        contentItem: GroupBox {
             // * Snip *
        }
    

    Qt Quick 5.12.10


  • Qt Champions 2018

    Popup are limited to stay inside their parent window for now.

    If you want something that can be moved outside, use a Window and not a Popup.



  • @adaptine hi
    You can define your contentItem like this to move it in your window

     contentItem: Rectangle{
            
                Drag.active: true
                MouseArea{
                    anchors.fill: parent
                    drag.target: parent
                }
     // the content 
    }
    

    You could also use a QML Window instead


Log in to reply