[Interest] Interactively reparent dock widgets - how to fetch all layered widgetsAt(x, y)

Dirk Thomas dthomas at sim.tu-darmstadt.de
Wed Nov 23 00:09:37 CET 2011


Hi,

I am trying to interactively move a QDockWidget from one QMainWindow to another.
After pressing the mouse button and moving the mouse the dock widget should be reparented to another main window (underlying at the current mouse position) in order to get instant visual feedback.
While the basic concept works I need to determine the top-most QMainWindow which is under the current cursor position.

Since the dock widget is moved together with the mouse it is the top-most widget returned by qApp->widgetAt(mouse_position).
In order to look "below" this dock widget I currently hide the dock widget, call widgetAt() and show the dock widget again (indeed very hacky)

This results in flickering of the dock widget and does not work if the widget below is not a main window.
Actually I would need to do the (hide, widgetAt, show) recursively until I find a main window or no widget at all.

Is there any function which provides me a list of widget which are layered at a specific coordinate (at best ordered top-down)?
I am aware that this might be costly to calculate.
Or is there another way to get this information?

Thank you for your feedback,
Dirk

-- 

Dr.-Ing. Dirk Thomas                E-Mail: dthomas at sim.tu-darmstadt.de
Simulation, Systems Optimization    Phone:  ++49 (0) 6151-16-4722
and Robotics Group (SIM)            Mobil:  ++49 (0) 176-231 241 56
Technische Universitaet Darmstadt   http://www.sim.tu-darmstadt.de
Hochschulstr. 10                    D-64289 Darmstadt, Germany



More information about the Interest mailing list