Results 1 to 2 of 2

Thread: Moving Items in QTableView with QSortFilterProxyModel

  1. #1
    Join Date
    Feb 2012
    Posts
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default Moving Items in QTableView with QSortFilterProxyModel

    I need to implement a view that represents data in multiple columns.
    The items in the list can be filtered using the proxymodel. So I ended up using the QTableView

    What I need to do is move the items in the view by using a set of pushbuttons (up, down, top, bottom)

    I'm having problems when the filter is active, because the movement operations are happening in the model, not the view.
    I.e. my filtered view shows the items with verticalheader index 1, 5, 8, 10. If I move 8 down by one, it becomes 9 and is it will still be listed above 10.
    Can I find out the source of the line below (or above, for up), so I can swap them?

    Using drag & drop only works properly when I'm dragging the index in the verticalheader;
    if I allow the items to be draggable and droppable, I can mess up the table by dragging an item from one column onto the other.
    (The complete rows indents onto that column)
    Is there a way to prevent this from happening?

    Any guidance would be greatly appreciated.

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Moving Items in QTableView with QSortFilterProxyModel

    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. Moving items in a QTreeWidget
    By sudheer168 in forum Qt Programming
    Replies: 0
    Last Post: 7th November 2011, 15:01
  2. Replies: 1
    Last Post: 9th August 2009, 19:51
  3. Moving Items with itemChange?
    By konvex in forum Qt Programming
    Replies: 5
    Last Post: 21st November 2008, 14:36
  4. Moving items within a model
    By iswm in forum Qt Programming
    Replies: 1
    Last Post: 11th April 2007, 08:29
  5. Moving items between two views.
    By YuriyRusinov in forum Qt Programming
    Replies: 11
    Last Post: 2nd April 2007, 13:53

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.