[Qt-interest] Dragging TreeWidgetItems in a QTreewidgets.
phil prentice
philp.cheer at talktalk.net
Wed Jan 28 15:12:18 CET 2009
Hi
I am using QT 4.2.1. I have created a tree structure of
icons(TreeWidgetItems). As far as my application is concerned the order of
the icons from top to bottom is important. I wish to give the user the
capability of moving the icons around the tree. However the user must not be
allowed to move an icon outside of its current level in the tree. For
example an icon at the top level should not be allowed to become a child of
another icon.
One obvious way to do this is to create up and down pushbuttons which move the
highlighted icon up and down the tree at the allowed level. However I was
trying to be adventurous and use drag and drop. The default implementation
allows icons to be dropped inside other icons in the tree. I derived a class
from QTreewidget and re-implement the method dragMoveEvent(), but was not
sure how to proceed from there.
Is it possible to do this using QT4.2.1 or should I stick to the nice simple
up/down push buttons?
Thanks for your help
Phil
More information about the Qt-interest-old
mailing list