Results 1 to 2 of 2

Thread: How to reimplement QTreeWidget::dropEvent?

  1. #1
    Join Date
    Oct 2010
    Posts
    2
    Qt products
    Qt4
    Platforms
    Windows

    Default How to reimplement QTreeWidget::dropEvent?

    I need to override the dropEvent() method in QTreeWidget to give me some additional control over drag and drop. More specifically I want to apply a set of rules to prevent certain items being made children of other items. (E.g. list items containing text 'a' cannot be dragged underneath list items containing text 'b').

    I have started by copying the contents of qtreewidget::dropEvent() into an overidden version of dropEvent() but this calls 'dropOn' which would also have to be pulled in and I fear that I'm starting to suck in the whole of QT!

    My questions are as follows:

    Am I taking the correct approach?

    If not, what are the alternatives?

    If yes, can you give any advise on including the existing functionality in my overidden version of dropEvent()?

    Thank you.

    Adrian.

  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 to reimplement QTreeWidget::dropEvent?

    Do it in dragMoveEvent() and not dropEvent(), then it'll be very easy.
    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.


Similar Threads

  1. dropEvent() is never called
    By kervich in forum Qt Programming
    Replies: 1
    Last Post: 10th September 2010, 13:13
  2. about dropEvent in mac
    By yxtx1984 in forum Newbie
    Replies: 1
    Last Post: 19th March 2010, 06:17
  3. QGraphicsScene and dropEvent
    By prof.ebral in forum Newbie
    Replies: 14
    Last Post: 6th March 2010, 09:16
  4. Advice catching dropEvent
    By DirtyBrush in forum Qt Programming
    Replies: 5
    Last Post: 15th July 2009, 16:43
  5. Drag and Drop, dropEvent not being called?
    By steg90 in forum Qt Programming
    Replies: 36
    Last Post: 22nd May 2007, 07:03

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.