[Qt-interest] QTReeWidget Drag and Drop

sarvesh saran aquarian.thunder at gmail.com
Fri Mar 18 11:26:33 CET 2011


Hi Sujan,

you can get some pointers on how to begin here:
http://doc.qt.nokia.com/latest/model-view-programming.html#using-drag-and-drop-with-item-views

and an example can be seen here:
http://sector.ynet.sk/qt4-tutorial/dnd.html

hope this helps!

-Sarvesh

On Fri, Mar 18, 2011 at 3:08 PM, Sujan Dasmahapatra <sdh at lmwindpower.com>wrote:

>  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 <%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.
>
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at qt.nokia.com
> http://lists.qt.nokia.com/mailman/listinfo/qt-interest
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20110318/8d9f761b/attachment.html 


More information about the Qt-interest-old mailing list