Results 1 to 2 of 2

Thread: Drag and Drop indicator Position

  1. #1
    Join Date
    May 2006
    Posts
    108
    Thanks
    35
    Thanked 2 Times in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Question Drag and Drop indicator Position

    Hi,

    i have reimplement the dragMoveEvent from a QTreeWidget, to know if the drop is on the item, before it or after it. A Drop before should not allowed.

    Qt Code:
    1. void MyTreeWidget::dragMoveEvent(QDragMoveEvent *event)
    2. {
    3. if ( this->dropIndicatorPosition() == QAbstractItemView::AboveItem )
    4. {
    5. event->ignore();
    6. }
    7. }
    To copy to clipboard, switch view to plain text mode 

    The event was only ignored before and after the dragged item. Whats going wrong?

    Thanks

  2. #2
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Drag and Drop indicator Position

    Try this:
    Qt Code:
    1. void MyTreeWidget::dragMoveEvent(QDragMoveEvent *event)
    2. {
    3. if ( this->dropIndicatorPosition() == QAbstractItemView::AboveItem )
    4. {
    5. event->ignore();
    6. return;
    7. }
    8.  
    9. event->accept();
    10. }
    To copy to clipboard, switch view to plain text mode 
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

Similar Threads

  1. Replies: 4
    Last Post: 21st May 2015, 17:04
  2. Replies: 2
    Last Post: 13th October 2010, 21:51
  3. Replies: 0
    Last Post: 4th May 2010, 10:24
  4. Drag and drop indicator
    By iswm in forum Qt Programming
    Replies: 2
    Last Post: 19th April 2007, 18:58
  5. Replies: 7
    Last Post: 8th September 2006, 16:19

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.