PDA

View Full Version : Changing the position of an item in a QListWidget



Dark_Tower
11th April 2006, 10:52
Hi all, in my app I use a QListWidget and a fill it with QListWidgetItems in icon mode. One of the options in my app is to move a selected item up or down one position in the list. I want to know what's the best/"elegant" way to do it. I've thought in two ways: Extracting the item from the list with "QListWidget::takeItem" and inserting it again in the correct position with "QListWidget::insertItem()". Another solution could be in copying the contents (icon and text) between the current item and the "destination item". Is there any better/other solution to do this? Thanks.

zlatko
11th April 2006, 11:25
Maiby drag and drop ;)

Dark_Tower
11th April 2006, 11:35
Maiby drag and drop ;)

Drag and drop, as far as I know, is manually (the user has to move manually the item). What I want is just change the position of the item up or down automaticly by pressing a button :)

Dark_Tower
12th April 2006, 09:35
Any other suggestion, please?