QListWidget IconMode causes items to overlap
-
I am currently developing my own desktop environment for LinuxOS using Qt.
To remember the user's desktop icon arrangement,
I save the item positions using JSON and in the next session
I restore the positions using setPositionForIndex.
However, when I add a new item, it overlaps with the existing items whose positions I have changed.
-
I am currently developing my own desktop environment for LinuxOS using Qt.
To remember the user's desktop icon arrangement,
I save the item positions using JSON and in the next session
I restore the positions using setPositionForIndex.
However, when I add a new item, it overlaps with the existing items whose positions I have changed.
@taaDeveloper
Well, I imagine, yes. The system does not know the consequences of your explicit, non-default set positions. I would assume it thinks items are/are to be laid out "consecutively in their slots". Looking at your picture, the first two of the bottom line should be at the right of the second line, and the final one on the bottom line should be at the left of that line. Which would leave the position you show for the new item, second along at the bottom, being the "correct" position for the latest item.I know nothing about this, but you may have to explicitly set position for all new items if you expect them to be placed where you want them with this layout.
-
@taaDeveloper
Well, I imagine, yes. The system does not know the consequences of your explicit, non-default set positions. I would assume it thinks items are/are to be laid out "consecutively in their slots". Looking at your picture, the first two of the bottom line should be at the right of the second line, and the final one on the bottom line should be at the left of that line. Which would leave the position you show for the new item, second along at the bottom, being the "correct" position for the latest item.I know nothing about this, but you may have to explicitly set position for all new items if you expect them to be placed where you want them with this layout.
@JonB Yes, but QListWidget does not seem to have a function to specify row and column and insert an object, so I am wondering what other method I can use...