Results 1 to 3 of 3

Thread: Drag & drop items on the same QTreeView

  1. #1
    Join Date
    Sep 2006
    Posts
    10
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Windows

    Question Drag & drop items on the same QTreeView

    I want to drag & drop items on the same QTreeView. All is working great visually on the treeview,
    but i also need to change my data in the database. So i need to know which item is dragged and the location (index) where the item is dropped.

    I subbclassed QTreeView but can figure out how to get the index location of the dropped item. Any hints?

  2. #2
    Join Date
    Jan 2006
    Location
    travelling
    Posts
    1,116
    Thanks
    8
    Thanked 127 Times in 121 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Drag & drop items on the same QTreeView

    1) Do you use a custom model ?
    2) Does the view know the model type ?
    3) QAbstractItemView:indexAt(const QPoint&) should be useful (usually a static_cast is performed on the internalPointer() to get whatever object your model use and act on it...)
    Current Qt projects : QCodeEdit, RotiDeCode

  3. The following user says thank you to fullmetalcoder for this useful post:

    wind (11th October 2006)

  4. #3
    Join Date
    Sep 2006
    Posts
    10
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Drag & drop items on the same QTreeView

    indexAt is the right way. Tnx

Similar Threads

  1. Replies: 7
    Last Post: 8th September 2006, 16:19
  2. Drag and drop revisited
    By Big Duck in forum Newbie
    Replies: 2
    Last Post: 30th June 2006, 16:41
  3. Drag and drop items in view to sort order
    By Big Duck in forum Qt Programming
    Replies: 1
    Last Post: 25th May 2006, 19:43
  4. drag and drop from QTreeView
    By Untersander in forum Qt Programming
    Replies: 1
    Last Post: 10th April 2006, 09:00
  5. Drag & drop for QTreeView
    By yogeshm02 in forum Qt Programming
    Replies: 2
    Last Post: 30th January 2006, 14:32

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.