Results 1 to 5 of 5

Thread: How do I show the drop indicator BETWEEN rows, not on them in QTreeView

  1. #1
    Join Date
    Apr 2007
    Posts
    6
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11

    Default How do I show the drop indicator BETWEEN rows, not on them in QTreeView

    Hi there,

    I'm trying to create a (flat) list that allows items to be dragged into a new order. I'm using QTreeView ( I like how it looks ) with a flat heirarchy and a subclassed QAbstractItemModel. I've gotten drag n' drop reordering of the list to work, but the drop sites that get shown are rectangles that surround the current row/column element that I am over. What I'd like to show is a thick horizontal line drawn BETWEEN the rows where I will drop the selected items.

    Can anyone tell me what I need to override, or what setting I need to make, to influence how the drop targets get shown in QTreeView?

    Thanks!
    Dave

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

    Default Re: How do I show the drop indicator BETWEEN rows, not on them in QTreeView


  3. #3
    Join Date
    Apr 2007
    Posts
    6
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11

    Default got this answer from Trolltech...

    Hi Dave

    This is currently a lot harder than it should be. You basically have to
    it yourself.

    I've shown how you can do this in the attached example. I've also
    created a task for the developers about this issue. You can track the
    progress of the task here:

    http://www.trolltech.com/developer/t...0&method=entry

    best regards

    Anders Bakken - Support Engineer
    --
    Trolltech Inc
    Attached Files Attached Files

  4. #4
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: How do I show the drop indicator BETWEEN rows, not on them in QTreeView

    With wysota's suggestion it would be this simple. Maybe not as pretty though.
    Attached Files Attached Files
    J-P Nurmi

  5. #5
    Join Date
    Feb 2011
    Posts
    354
    Thanks
    17
    Thanked 27 Times in 24 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Windows

    Default Re: How do I show the drop indicator BETWEEN rows, not on them in QTreeView

    It looks like the drop indicator is shown for only one column. In my application I need to move whole rows, so I'd like to show drop indicator as wide as the row. Is it possible?
    Last edited by mentalmushroom; 26th September 2011 at 14:19.

Similar Threads

  1. How to show progess in a QTreeView item ?
    By tanminh in forum Qt Programming
    Replies: 69
    Last Post: 3rd March 2008, 18:55
  2. Drag & drop items on the same QTreeView
    By wind in forum Qt Programming
    Replies: 2
    Last Post: 11th October 2006, 15:29
  3. drag and drop from QTreeView
    By Untersander in forum Qt Programming
    Replies: 1
    Last Post: 10th April 2006, 10:00
  4. [Qt 4.x] Highliting rows in a QTreeView
    By Moppel in forum Qt Programming
    Replies: 3
    Last Post: 10th March 2006, 11:00
  5. Drag & drop for QTreeView
    By yogeshm02 in forum Qt Programming
    Replies: 2
    Last Post: 30th January 2006, 15: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.