Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

In the qml documentation there is a drag'n'drop example:

import QtQuick 2.0

Item {
    width: 200; height: 200

    DropArea {
        x: 75; y: 75
        width: 50; height: 50

        onDropped: console.log("dropped")
        onEntered: console.log("entered")

        Rectangle {
            anchors.fill: parent
            color: "green"

            visible: parent.containsDrag

    Rectangle {
        x: 10; y: 10
        width: 20; height: 20
        color: "red"
        Drag.hotSpot.x: 10
        Drag.hotSpot.y: 10

        MouseArea {
            id: dragArea
            anchors.fill: parent


I have added the two lines with "onDropped" and "onEntered". While "onEntered" is triggered by dragging the small rectangle, I can not make the "onDropped" to trigger.

What do I have to do to make it trigger?

share|improve this question
up vote 5 down vote accepted

Apparently a drop needs to be generated explicitly by calling the drop() method on the Drag object

Try adding this line inside of the MouseArea, just above parent

onReleased: parent.Drag.drop()
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.