Results 1 to 1 of 1

Thread: QListWidget elements sorting using drag&drop

  1. #1
    Join Date
    Dec 2010
    Location
    Ukraine, Kharkiv
    Posts
    17
    Thanks
    3
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Question QListWidget elements sorting using drag&drop

    I have QListWidget. I added elements in there using
    Qt Code:
    1. new QListWidgetItem(text, qlwElements);
    To copy to clipboard, switch view to plain text mode 
    . Later I will use icons for elements, so I plan to use another code
    Qt Code:
    1. QListWidgetItem *newItem = new QListWidgetItem(text, qlwElements);
    2. newItem->setIcon(iconPath);
    To copy to clipboard, switch view to plain text mode 
    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?
    Last edited by Chiz; 16th February 2011 at 10:32.

Similar Threads

  1. Drag and drop between QListWidget's
    By estanisgeyer in forum Qt Programming
    Replies: 4
    Last Post: 17th February 2011, 05:29
  2. Replies: 3
    Last Post: 10th June 2010, 16:13
  3. Replies: 1
    Last Post: 22nd October 2009, 01:02
  4. QListWidget/QTreeWidget Drag and Drop
    By hlvietlong in forum Qt Programming
    Replies: 2
    Last Post: 30th June 2009, 19:09
  5. Drag from QTreeWidget and drop in QListWidget
    By WXNSNW in forum Qt Programming
    Replies: 1
    Last Post: 25th August 2008, 01:15

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.