View Full Version : Which widget within the workspace window has "focus"?

15th September 2009, 09:32

I have a menu that builds up a list of visible dialogs (like some browsers do) and I want to sens which dialog is in front/has focus, i.e. I want to know which dialog that has the blue titlebar.

I tried hasFocus(), but none has. This seems logical as I at the moment is opening the menu.

I also tried isActiveWindow(), but this was true for all my dialogs inside the workspace.

Any suggestions?

15th September 2009, 10:40

The solution was not in the widget itself, but in the QWorkspace that owned the widget.

I used workspace->activeWindow() and compared it with each of the widgets in the workspace->windowList() and found out which had "focus".