Results 1 to 2 of 2

Thread: QListWidget - reordering

  1. #1
    Join Date
    Apr 2009
    Location
    www.JaminGrey.com
    Posts
    71
    Thanks
    10
    Thanked 1 Time in 1 Post
    Qt products
    Qt5
    Platforms
    Windows

    Default QListWidget - reordering

    I have a QListWidget. How can I know when a item in it gets moved, and how can I know where it gets moved to? (It only gets moved inside of the QListWidget, not outside of it. I'd like the index that it gets moved to)

    Is there some signal that does it? Like: itemMoved(index previous, index current)

    [Edit:]

    Or, if not, what do I need to watch for, in QStandardItemModel, to implement such a signal myself? I'm new to QT's Model/View system.

    Should I reimplement QStandardItemModel::setItem(), like this:
    Qt Code:
    1. MyReimplementedStandardItemModel::setItem(int row, int column, QStandardItem * item )
    2. {
    3. QModelIndex oldIndex = item->index();
    4. QStandardItemModel::setItem(row, column, item);
    5. QModelIndex newIndex = item->index();
    6.  
    7. emit: customSignal(oldIndex, newIndex);
    8. }
    To copy to clipboard, switch view to plain text mode 

    Or am I going about it the wrong way?
    Last edited by ComServant; 21st August 2010 at 21:47.

  2. #2
    Join Date
    Apr 2009
    Location
    www.JaminGrey.com
    Posts
    71
    Thanks
    10
    Thanked 1 Time in 1 Post
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: QListWidget - reordering

    Well, nevermind. Couldn't figure it out, but I changed the way my objects are moved anyway, so it's not needed anymore.

    Thanks anyway.

Similar Threads

  1. QListWidget
    By bismitapadhy in forum Qt Programming
    Replies: 17
    Last Post: 22nd March 2010, 11:44
  2. Drag and drop reordering in a QTableWidget
    By Lendrick in forum Qt Programming
    Replies: 1
    Last Post: 22nd November 2009, 23:19
  3. QTreeWidget Column Reordering
    By jimc1200 in forum Newbie
    Replies: 1
    Last Post: 8th January 2009, 08:51
  4. reordering QListWidgetItems of a QListWidget
    By OriginalCopy in forum Qt Programming
    Replies: 14
    Last Post: 4th December 2007, 15:49
  5. Another QListWidget bug?
    By SkripT in forum Qt Programming
    Replies: 12
    Last Post: 15th April 2006, 13:40

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.