PDA

View Full Version : QListWidget elements sorting using drag&drop



Chiz
16th February 2011, 10:23
I have QListWidget. I added elements in there using
new QListWidgetItem(text, qlwElements);. Later I will use icons for elements, so I plan to use another code
QListWidgetItem *newItem = new QListWidgetItem(text, qlwElements);
newItem->setIcon(iconPath);
Question: how to sort elements using drug and drop functionality and after that add some more elements?
I want to add three elements - 1, 2, 3. Then drag first one (1) to the end, so they will be 2, 3, 1. And then I want to add element 4. So after adding fourth element I want 2, 3, 1, 4.
Now I have 1,2,3,4 after adding fourth element.
Is there some functionality to "auto sort elements" after drop? Or where, when and in what method I can get info about where user drop element?