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. Draggable Popup

Draggable Popup

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

    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

    ODБOïO 1 Reply Last reply
    0
    • GrecKoG Offline
      GrecKoG Offline
      GrecKo
      Qt Champions 2018
      wrote on last edited by
      #2

      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.

      1 Reply Last reply
      0
      • A adaptine

        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

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

        @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

        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