PDA

View Full Version : Strange behavior with Drag and Drop (not always drops)



Mona Shokrof
27th May 2007, 14:58
Hi all

I have a strange problem with Drag and drop items between widgets
I use a widget extended from QTabWidget which includes some custom widgets
The tab widget allows drops and also the widgets in the tabs
and both DragEnterEvent and Drop event are handled in the tab widget and the also the tabs

I implemented DragMoveEvent in the tab widget so as to acheive the following performance:
while I am dragging some item ,and I move the mouse on the tab bar,the tab which the mouse is moving on should be activated to allow dropping in it.

The problem is when I drop an item on the tab widget ,sometimes it succeeds but it fails on another time
I tried to figure out how could this happen,
it seemed to be that the event doesn't fire at all
I remove my finger away from the mouse button but no drop event fires (even not mouse released) and the dragging cursor remains
but when I move the mouse or deactivate the window the desired behavior happened(which means that the drop event fired)

I discovered another strange issue which is that when the event doesn't fire and I pressed a mouse button before moving the mouse it continue dragging as if nothing happened

I dont know is it sth related to the application or to the tab widget which make the event delayed in firing or what really happened

I tried to describe the problem as much as I could

any help will be greatly appreciated

Best Regrads
Mona

marcel
27th May 2007, 18:00
Could you explain in more detail what the widget structure is?
Your problem could be because another widget ( that you have created there ) is stealing the drop event from the tab widget.

If I get it correctly you have reimplemented dragMoveEvent in the QTabWidget. Is that right ?
And you did that to highlight the tabs in the tab widget.

But the tabs are actually a QTabBar. Are you sure the QTabBar is not stealing this event from the tab widget?
If so, you could try installing the tab widget as event filter in the tab bar, and accept it's drag move and drop events.

If this doesn't solve the problem, then you can explain some more :).

Regards