PDA

View Full Version : drag and drop QToolButton in QToolBar



NBilal
13th December 2008, 04:24
Hello,

I am trying to do a Drag and Drop of a QToolButton in the same QToolBar. It's working but I have some problems:

- QDragLeaveEvent:
This method is supposed to be called when the drag go out of the toolbar, but it's called two when the drag is on a child of the toolbar (one of the others QToolButton).
How to solve this problems ?
I tried to overwrite dragEnterEvent for all the buttons:


void dragEnterEvent(QDragEnterEvent *event)
{
event->ignore();
}

but this is not working.

- dropEvent:
dropEvent is called only if a drop occure inside the toolbar. How to detect a drop outside the toolbar ?

- Drag interruption:
How to interrupt a drag ? to start the drag I use drag->start(), but If I want to end the drag when the mouse is outside the widget, how can I do that ? I need something like drag->end().

Thank you

jpn
28th December 2008, 20:11
Perhaps it would be easier to do it within mouse event handlers instead of drag and drop?