[Qt-interest] QTReeWidget Drag and Drop

Sujan Dasmahapatra sdh at lmwindpower.com
Fri Mar 18 10:38:56 CET 2011


Dear Friends
I am trying to implement drag and drop for QTreeWidgetItem.I have some
toplevelitems and some of them have children items. I want to implement
hte drag and drop functionality for the toplevel items, when an item if
dragged and dropped the toplevele items and its children items all
should occupy the new place. Somekind of reordering I want to achieve.
Please give me some guidelines.
I am curreny trying to implement startDrag() but its crashing.

void Tree::startDrag(Qt::DropActions supportedActions)
{
QDrag *drag = new QDrag(this);
QMimeData *data = new QMimeData;
data->setText(currentItem()->text(0));
drag->setMimeData(data);
drag->exec(supportedActions, Qt::MoveAction);
}

Thanks in advance

 

 

Kind Regards,

 

 

Sujan Dasmahapatra
Project Leader, Aero Group
Aero Group

Tel    +91 80 66470248
Mob  

sdh at lmwindpower.com <mailto:%25EMAIL%25> 

 

LM Wind Power Blades

lmwindpower.com

 

Together we capture the wind to power a cleaner world

________________________________

 

This e-mail and any attachments are confidential. If you are not the
named or intended recipient, please notify the sender immediately and do
not disclose the contents to any other person, use it for any purpose,
or store or copy the information in any medium. Any unauthorized
disclosure, use or storage is prohibited and might be unlawful.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20110318/42ad6573/attachment.html 


More information about the Qt-interest-old mailing list