Results 1 to 5 of 5

Thread: List-centred table view: How to implement DND and moving rows.

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jul 2008
    Posts
    16
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11
    Thanks
    2
    Thanked 1 Time in 1 Post

    Default Re: List-centred table view: How to implement DND and moving rows.

    Yes, this is what I have done already. But the thing is, that it will copy the row several times and not just move it. How do I turn this off, then?

  2. #2
    Join Date
    Jul 2008
    Posts
    16
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11
    Thanks
    2
    Thanked 1 Time in 1 Post

    Default Re: List-centred table view: How to implement DND and moving rows.

    Hmm. Ok, I have found a way to avoid the duplication. In my model, I added:

    Qt Code:
    1. bool dropMimeData(const QMimeData *data, Qt::DropAction action,
    2. int row, int column, const QModelIndex &parent) {
    3. return QAbstractTableModel::dropMimeData(data, action,
    4. row, 0, parent);
    5. }
    To copy to clipboard, switch view to plain text mode 

    Doesn’t look to smart to me, but it keeps the rows ‘aligned’ when dragging and dropping.

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

    Default Re: List-centred table view: How to implement DND and moving rows.

    It basically depends on the drop action you perform. If the action is DropMove, you should remove the old item after the drop.
    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.


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
  •  
Qt is a trademark of The Qt Company.