aboutsummaryrefslogtreecommitdiffstats
path: root/examples/declarative/dragtarget/launcher/launcher.qml
diff options
context:
space:
mode:
authorAndrew den Exter <andrew.den-exter@nokia.com>2011-06-24 14:09:46 +1000
committerAndrew den Exter <andrew.den-exter@nokia.com>2011-06-24 14:14:03 +1000
commit024c2942338efd02f9464ed1eebc75f941cddc90 (patch)
treeb444ac84a5a047bf59465728f3e8ad45d0072f91 /examples/declarative/dragtarget/launcher/launcher.qml
parent6e47798a7c4b7c603a7699afe02083b7c169aefb (diff)
Add a javascript accessor for items in a visual item model.
Rework visualdatamodel example to use a repositioned delegate from the model as the composer instead of an item created elsewhere.
Diffstat (limited to 'examples/declarative/dragtarget/launcher/launcher.qml')
-rw-r--r--examples/declarative/dragtarget/launcher/launcher.qml10
1 files changed, 5 insertions, 5 deletions
diff --git a/examples/declarative/dragtarget/launcher/launcher.qml b/examples/declarative/dragtarget/launcher/launcher.qml
index d7ec46f0d3..d3233c937e 100644
--- a/examples/declarative/dragtarget/launcher/launcher.qml
+++ b/examples/declarative/dragtarget/launcher/launcher.qml
@@ -58,13 +58,12 @@ Rectangle {
onEntered: {
sourceIndex = drag.data
- destinationIndex = applicationsView.indexAt(drag.x, drag.y)
+ destinationIndex = sourceIndex
}
onPositionChanged: {
var index = applicationsView.indexAt(drag.x, drag.y)
if (index != -1) {
- if (destinationIndex != -1)
- applicationsVisualModel.move(destinationIndex, index, 1)
+ applicationsVisualModel.move(destinationIndex, index, 1)
destinationIndex = index
}
}
@@ -97,6 +96,7 @@ Rectangle {
}
// onDropped: applicationsModel.move(sourceIndex, destinationIndex, 1)
// onExited: applicationsModel.move(destinationIndex, sourceIndex, 1)
+ onExited: applicationsVisualModel.insert(sourceIndex, favoritesVisualModel, destinationIndex, 1)
}
Rectangle {
@@ -155,7 +155,7 @@ Rectangle {
onEntered: {
sourceIndex = drag.data
- destinationIndex = favoritesView.indexAt(drag.x, drag.y)
+ destinationIndex = sourceIndex
}
onPositionChanged: {
var index = favoritesView.indexAt(drag.x, drag.y)
@@ -195,7 +195,7 @@ Rectangle {
}
}
// onDropped: favoritesModel.move(sourceIndex, destinationIndex, 1)
-// onExited: favoritesModel.move(destinationIndex, sourceIndex, 1)
+ onExited: favoritesVisualModel.insert(sourceIndex, applicationsVisualModel, destinationIndex, 1)
}
}
}