How to Drag over other objects?



  • Can someone help me understand how to reference objects like dropbucket001, dropbucket002, dropbucket003 while I drag dragthis over those objects?

    What I am trying to do is make the dropbuckets glow or shake or some other visual effect to indicate that you can drop the object on it.

    @

    import QtQuick 1.0

    Rectangle {
    id: screen
    color: "white"
    width: 400
    height: 300

    Rectangle {
    id: dropbucket001
    x: 10
    y: 10
    color: "blue"
    width: 60
    height: 60
    }

    Rectangle {
    id: dropbucket002
    x: 80
    y: 10
    color: "blue"
    width: 60
    height: 60
    }

    Rectangle {
    id: dropbucket003
    x: 150
    y: 10
    color: "blue"
    width: 60
    height: 60
    }

    Rectangle {
    id: dragthis
    x: 10
    y: 80
    color: "green"
    width: 50
    height: 50
    MouseArea {
    anchors.fill: parent
    drag.target: dragthis
    }

    }
    

    }
    @



  • @Rectangle {
    id: dragthis
    x: 10
    y: 80
    color: "green"
    width: 50
    height: 50
    MouseArea {
    anchors.fill: parent
    drag.target: dragthis
    drag.axis = XandYAxis
    drag.active = true
    }

    }@


  • What are you trying to say CMGeorge?
    Did you check your code?

    [quote author="CMGeorge" date="1305232932"]@Rectangle {
    id: dragthis
    x: 10
    y: 80
    color: "green"
    width: 50
    height: 50
    MouseArea {
    anchors.fill: parent
    drag.target: dragthis
    drag.axis = XandYAxis
    drag.active = true
    }

    }@[/quote]
    

Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.