PDA

View Full Version : Events of floating QDockWidget



harregui
25th March 2011, 10:02
Hi,

Is there any way in MainWindow to receive events of a floating QDockWidget?

Thank you in advance.

mattc
25th March 2011, 13:16
QDockWidget already emits a few useful signals, is that what you are looking for?
http://doc.qt.nokia.com/4.7/qdockwidget.html#signals

harregui
30th March 2011, 11:11
Thanks mattc, but, none gives me information about intermediate events happening.
For example

void dockLocationChanged ( Qt::DockWidgetArea area )
is emitted once the drag/drop of the dockwidget has finished. I need to follow the movement itself.

high_flyer
30th March 2011, 11:16
I think you will have to subclass and override the mouseMoveEvent().

harregui
30th March 2011, 13:05
And how could MainWindow have information about that, high_flyer?
Should I create signals in my subclassed dockWidget and connect to MainWindow's slots?
Wouldn't that be quite inefficient?

high_flyer
30th March 2011, 14:24
Lets take a step back.
What is it that you are trying to achieve?
Not in terms of implementation, but functionality - what should happen from a user point of view?

harregui
30th March 2011, 14:50
My aim is to control the QDockWidget drag/drop.
When a user starts to drag a dockWidget, the MainWindow shows several arrows (four general arrows and four arrows + tab relative to other dockwidgets).
When the mouse is released over one of these arrows, the dockwidget is docked in that position.

By now, my solution works while the dockWidgets remain docked. If a dockWidget is not released over an arrow, it becomes floating. But then, if I want to start drag/dropping it again, the MainWindow has lost the control.

rocker
8th February 2013, 10:03
My aim is to control the QDockWidget drag/drop.
When a user starts to drag a dockWidget, the MainWindow shows several arrows (four general arrows and four arrows + tab relative to other dockwidgets).
When the mouse is released over one of these arrows, the dockwidget is docked in that position.

By now, my solution works while the dockWidgets remain docked. If a dockWidget is not released over an arrow, it becomes floating. But then, if I want to start drag/dropping it again, the MainWindow has lost the control.

You can overrite mousemove event or move function of qdockwidget.
It will serve your problem

thibs
20th January 2017, 16:21
Use QEvent::move for this!