Results 1 to 3 of 3

Thread: Drag and drop

  1. #1
    Join Date
    Apr 2007
    Posts
    4
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Drag and drop

    I have drag and drop implemented using a QTreeView (setItemsExpandable is false), and everything is working nicely. The problem I'm having, however, is that I need to get the row number that an item was dropped FROM when said item gets dropped (within the same view). Is there any way to do this?
    Last edited by iswm; 10th April 2007 at 01:02.

  2. #2
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Thanks
    8
    Thanked 541 Times in 521 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Drag and drop

    If I am not mistaking, when you build the mime data and the drag data for drag and drop, in QTreeWidget::mimeData, you're being passed a list of QTreeWidgetItems.
    Couldn't you find out the selected item's row here and include it somehow in the drag data?

  3. #3
    Join Date
    Apr 2007
    Posts
    4
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Drag and drop

    I've considered doing this, and even tried to implement it. The problem is that it's just so messy. My reimplementation of QAbstractItemModel::mimeData() is passed at least 4 indexes at a time (4 colummns per row), so it turns into a logistical mess that feels pretty dirty.

Similar Threads

  1. Drag and Drop
    By allensr in forum Qt Programming
    Replies: 1
    Last Post: 11th December 2006, 20:50
  2. Replies: 7
    Last Post: 8th September 2006, 16:19
  3. Drag and drop outside the application
    By jpn in forum Newbie
    Replies: 7
    Last Post: 27th August 2006, 15:37
  4. Drag and drop revisited
    By Big Duck in forum Newbie
    Replies: 2
    Last Post: 30th June 2006, 16:41
  5. Drag 'n Drop problem
    By kiker99 in forum Qt Programming
    Replies: 4
    Last Post: 16th January 2006, 16: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.