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 I perform simple drag and drop?

How do I perform simple drag and drop?

Scheduled Pinned Locked Moved QML and Qt Quick
2 Posts 2 Posters 695 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.
  • B Offline
    B Offline
    bobbaluba
    wrote on last edited by
    #1

    I'm trying to drag and drop one square to another, using this code:

    @//where I want to drag from
    Connector {
    id: connector
    anchors.right: parent.right
    MouseArea {
    id:dragArea
    anchors.fill: parent
    drag.target: dragDummy
    onReleased: {
    console.log("Released");
    }
    Rectangle{
    id:dragDummy
    color:'pink'
    width:radius2
    height:radius
    2
    radius: 4
    }
    }
    }@

    @//where i want to drop something
    Connector {
    id: connector
    anchors.left: parent.left
    DropArea{
    anchors.fill: parent
    Rectangle{
    anchors.fill: parent
    color: "blue"
    }
    onDropped: {
    console.log("Dropped");
    }
    }
    }@

    I can see the pink circle moving when i drag it, but "Dropped" is never printed when I release it in the blue area.

    What am I missing?

    1 Reply Last reply
    0
    • V Offline
      V Offline
      Vincent007
      wrote on last edited by
      #2

      compare your code with Qt example.

      QTPATH\examples\quick\draganddrop

      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