Results 1 to 2 of 2

Thread: QTableView / QAbstractItemView Dragging rows internally

  1. #1
    Join Date
    May 2013
    Posts
    1
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default QTableView / QAbstractItemView Dragging rows internally

    I have subclassed the QAbstractItemView as the model for my qtableview. And I want to add the ability to move
    rows around in the Table. I did setMovable and it does allow me to move the rows. I also have multiselect activated
    on the tableview so I can select multiple rows.

    However I have no way of moving multiple rows. I would like to be able to select multiple rows using the ctrl key
    and then have the mousemove event move the selected rows up or down.

    I have searched for a solution to this and thus far the only two things that seem to make sense is that possibly
    in a different selection mode I could possibly make the drag feature work. Or I would need to reimplement
    the mousepress and the mousemove events in my table.

    I am not sure what will work and what to put in the reimplemented events if that were what I needed to do.

    Thank you

  2. #2
    Join Date
    Mar 2011
    Location
    Hyderabad, India
    Posts
    1,882
    Thanks
    3
    Thanked 452 Times in 435 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows
    Wiki edits
    15

    Default Re: QTableView / QAbstractItemView Dragging rows internally

    I have searched for a solution to this and thus far the only two things that seem to make sense is that possibly
    in a different selection mode I could possibly make the drag feature work. Or I would need to reimplement
    the mousepress and the mousemove events in my table.

    I am not sure what will work and what to put in the reimplemented events if that were what I needed to do.
    I don't think muli-selection drag & drop results can be defined in general terms for a wide range of usage, and hence are not possible with generic itemViews.

    And yes you have already figured out the possible solutions, those are your options.
    When you know how to do it then you may do it wrong.
    When you don't know how to do it then it is not that you may do it wrong but you may not do it right.

Similar Threads

  1. Replies: 1
    Last Post: 15th February 2012, 13:37
  2. Replies: 5
    Last Post: 25th February 2010, 17:29
  3. Moving (dragging) QTableView Columns
    By stefanadelbert in forum Qt Programming
    Replies: 2
    Last Post: 24th February 2010, 22:35
  4. Dragging an item from QTableView to a QPushButton
    By steg90 in forum Qt Programming
    Replies: 2
    Last Post: 23rd May 2007, 11:57
  5. QTableView header dragging
    By cmaxb in forum Qt Programming
    Replies: 1
    Last Post: 9th December 2006, 12:11

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.