Important: Please read the Qt Code of Conduct -

Reordering QListWidgetItems in QListWidget (iconMode) by Drag and Drop movement

  • I got a QListWidget with viewMode = IconMode and flow = LeftToRight to display some icon.
    Now i want the User to be able to move the items around to change their order (movement is set to "Snap" with a fixed gridSize) and add new items via Drag and Drop from another QListWidget.
    So far this is working, but when moving items inside the QListWidget it leaves an empty space where the item used to be.
    While searching for a solution i found doItemsLayout() which in fact clears the empty spaces but lays them out in order of creation.

    What is the right way to achieve this behavior?

Log in to reply