[Solved] QML and Drag and Drop
Page |
3 |
Hi sfjam. Can you elaborate on your issue?
Are you scrolling to a second GridView or scrolling within the GridView?
My solution for scrolling within a GridView is on the previous page (fourth comment from bottom).
If you want multiple GridViews, the code gets more complex. Post back if this is what you desire (multi-grid draggable icon layout).
Wow, thanks xsacha for putting this together! It’s amazing how little code is involved to get such nice complex-looking behavior. :)
I suggest a small tweak to the code: it looks like if an item at a lower index is in the active state and is moved towards an item of a higher index in the model, the active item is drawn behind the item with the higher model index. Setting the z value of the active item in the state PropertyChanges definition should do the trick:
- PropertyChanges { target: item; x: loc.mouseX - width/2; y: loc.mouseY - height/2; scale: 0.5; z: 500 }
If I change line 23 in Main.qml to have “onPressed” instead of “onPressAndHold”, the application is not working properly (problem with index). Where is the problem and how to solve it?
EDIT: Adding hoverEnabled: true solved this issue. But I’m not sure whether hoverEnabled has important impact on efficiency?
You must log in to post a reply. Not a member yet? Register here!




