Results 1 to 2 of 2

Thread: Drag and drop reordering in a QTableWidget

  1. #1
    Join Date
    May 2009
    Posts
    16
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Drag and drop reordering in a QTableWidget

    Greets!

    So I have this QTableWidget, which I'm trying to keep in sync with an ordered list of objects. I've allowed internal drag and drop reordering, which seems to work okay in the table itself, but when the drag occurs, I need some way to figure out what row was moved, and where it was moved *to*. How can I do this?

    Bart

  2. #2
    Join Date
    Aug 2009
    Posts
    10
    Thanks
    1
    Thanked 2 Times in 2 Posts

    Default Re: Drag and drop reordering in a QTableWidget

    override mousePressEvent and store the item. override dropEvent and in there you can get the item that received the drop. You might want to look into view/model classes. There is a learning curve, but it is more than worth it.

Similar Threads

  1. Drag & Drop rows in a QTableWidget
    By vycke in forum Qt Programming
    Replies: 7
    Last Post: 19th January 2012, 01:01
  2. Drag and Drop QTableWidget in UI file.
    By tpf80 in forum Qt Programming
    Replies: 3
    Last Post: 21st January 2009, 00:02
  3. Change cursor & status during Drag & Drop
    By ronlongo in forum Qt Programming
    Replies: 0
    Last Post: 1st December 2008, 17:56
  4. Drag and Drop QTableWidget and QTableView
    By scorpion11 in forum Qt Programming
    Replies: 5
    Last Post: 8th April 2008, 10:33
  5. Drag & Drop using QTableWidget
    By Israa in forum Qt Programming
    Replies: 21
    Last Post: 12th April 2007, 20:35

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.