PDA

View Full Version : qtreewidget and drop event detection



eric_vi
12th February 2010, 22:17
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

wysota
19th February 2010, 11:20
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.