Results 1 to 2 of 2

Thread: qtreewidget and drop event detection

  1. #1
    Join Date
    Aug 2009
    Posts
    81
    Platforms
    MacOS X Windows

    Default qtreewidget and drop event detection

    i would like to detect (before the action is done) that a new branch will be created as a result of a move of an item inside the tree, so i can prevent it.

    Through DropEvent I can get the proposed action for move but cannot figure out that the proposed action will also create a branch.
    how can i do that?


    An other way for me to solve it, would be to authorize move, but prevent branch creation, i don't know either how to do that.



    Many Thanks in advance

  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: qtreewidget and drop event detection

    For QTreeWidget it won't be that easy. If you were using the model approach, you could simply return false from QAbstractItemModel::insertRows() implementation if it would create a branch. It is possible you can obtain a similar effect with the tree widget if you clear the ItemIsDropEnabled flag on leaves of the tree.
    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. QTreeWidget Drag and drop
    By zell99 in forum Newbie
    Replies: 15
    Last Post: 7th August 2010, 13:28
  2. QtreeWidget drag and drop
    By addu in forum Qt Programming
    Replies: 4
    Last Post: 30th June 2009, 09:41
  3. Mouse press event detection
    By A.H.M. Mahfuzur Rahman in forum Qt Programming
    Replies: 1
    Last Post: 14th June 2009, 13:08
  4. QTreeWidget drag/drop
    By s_a_white in forum Newbie
    Replies: 1
    Last Post: 10th February 2007, 22:04
  5. Drag and drop with QTreeWidget
    By JSPoly in forum Qt Programming
    Replies: 5
    Last Post: 6th February 2007, 22:31

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.