[Qt-qml] DropArea onDropped signal
andrew.den-exter at nokia.com
andrew.den-exter at nokia.com
Fri Dec 16 00:35:34 CET 2011
Hi,
> Today by an accident i discovered DropArea qml element and wanted to try
> it out.. i couldn't find any example applications that uses onDropped signal
> handler, but i would expect that it logs a message in my test application (
> http://codepaster.europe.nokia.com/?id=48688 ). This is what i receive in
> output:
>
> Is there anything missing in my code ? Thanks.
Yes, a drop. Changing the active property from true to false doesn't generate a drop, you'll need to do that yourself by calling the drop function on the Drag object. Try adding the following to your MouseArea.
onReleased: request.Drag.drop()
Andrew
> ------------------------------------
> import QtQuick 2.0
>
> Rectangle {
> id: win
> width: 800
> height: 800
> color: "lightblue"
>
> MouseArea {
> id: requestDrag
> drag.target: request
> width: 100; height: 100
>
> Rectangle {
> id: request
> color: "darkred"
> width: 100; height: 100
> border {color: "black"; width: 3}
> anchors {
> horizontalCenter: parent.horizontalCenter;
> verticalCenter: parent.verticalCenter
> }
> //z: 3
>
> Drag.keys: "Qt"
> Drag.active: requestDrag.drag.active
> Drag.hotSpot.x: 5
> Drag.hotSpot.y: 5
>
> states: [
> State {
> when: request.Drag.active
> ParentChange {
> target: request
> parent: win
> }
> PropertyChanges {
> target: request
> opacity: 0.5
> }
> AnchorChanges {
> target: request
> anchors.horizontalCenter: undefined
> anchors.verticalCenter: undefined
>
> }
> }
> ]
> }
> }
>
> DropArea {
> id: dragTargetChunk
> keys: "Qt"
> width: win.width / 2; height: 102
> y: win.height - height; x: 0
>
>
> onDropped: {
> console.log(" Dropped ??? ")
> }
> onEntered: {
> console.log(" enter ")
> }
> onPositionChanged: {
> console.log(" pos ")
> }
> onExited: {
> console.log(" exit ")
> }
>
> Rectangle {
> id: targetChunk
> anchors.fill: parent
> color: "green"
>
> states: [
> State {
> when: dragTargetChunk.containsDrag
> PropertyChanges {
> target: targetChunk
> color: "grey"
> }
> }
> ]
> }
> }
>
> }
>
>
>
>
>
> _______________________________________________
> Qt-qml mailing list
> Qt-qml at qt.nokia.com
> http://lists.qt.nokia.com/mailman/listinfo/qt-qml
More information about the Qt-qml
mailing list