[Interest] Tree widget: rearrange elements

Tibold Kandrai dom at dotzteam.com
Mon Aug 27 12:37:59 CEST 2012


Nice catch!

Set the flag since that you have to do that only when creating the item
and I guess Qt internally it will check the flag anyway.


On 2012-08-27 12:33, Sensei wrote:
> On 8/27/12 10:59am, Tibold Kandrai wrote:
>> Hi,
>> As I understood the task is this:
>> You want Qt to handle the drag and drop, but you want to control whether
>> you can or cannot drop the item.
>> For this you need to override one of the drag events not the drop event.
>> I think you need to use this:
>> http://doc.qt.nokia.com/4.7-snapshot/qtreeview.html#dragMoveEvent and
>> you have to accept or ignore the events here.
> While I was awaiting, I found a workaround, setting a flag:
>      i->setFlags(i->flags() & (~Qt::ItemIsDropEnabled));
> Which one would you suggest? Creating an event filter, or setting item 
> flags?
> I'm at a crossroad...
> Cheers!
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest

Tibold Kandrai
CEO @ Dotz Team

More information about the Interest mailing list