QML: Avoid empty space when drag/drop between two views
-
Hi
I am using the QtQuick's Drag and Drop example (the Tiles part) to drag and drop tiles (representing buttons) from the list onto the grid as a way to dynamically lay out these buttons.When "removing" (i.e. reparenting) the tile from the list, an empty space is left. I would like the list to automatically reorganize to close this gap. Is that possible using the approach in the example where the drag/drop is simply done by reparenting the tile?
Thanks for your help!
-
@Diracsbracket
This question was answered on the StackOverflow forum. -
@Diracsbracket
do you mean the red/blue source lists (on the left and right side)? If so these areColumn
types and you can callforceLayout()
on them. -
@raven-worx
Yes, I mean those red tiles. I tried using your suggestion (theColumn
item'sid
isredSource
) as in the snippet below, but this does not do anything? I put the call toforceLayout()
in aStateChangeScript
inside thedrag.active
state, but to no effect.State { when: mouseArea.drag.active ParentChange { target: tile; parent: window.contentItem} StateChangeScript { name: "testScript" script: {console.debug("test"); redSource.forceLayout()} } AnchorChanges { target: tile; anchors.verticalCenter: undefined; anchors.horizontalCenter: undefined } }
-
@Diracsbracket
This question was answered on the StackOverflow forum.