PDA

View Full Version : Get keyboard focus on mouse over (hover to activate)



mortoray
7th December 2010, 17:31
Is there a generic way to enable window activation by mouse hovering? Some of my users benefit from a mode where the keyboard focus automatically follows the mouse -- moving over a window activates that window and it starts receiving keyboard events.

I know I can do this simply by watching mouse events, but I also recall this used to be a standard interface behaviour on some systems. Thus I was wondering if QT had a toggle to enable such a mode without me having to code it on every window specially.

Kaylx
7th September 2011, 18:36
I would be quite interested in this too? Did you ever find a solution?

Also with your mouseMoveEvent solution, i take it i would have to enable mouseTracking, also check if mouse pos is within frameGeometry(), check isActiveWindow() is false then call activateWindow() ?

Sorry if these questions sound stupid, i'm new to Qt. :)

mortoray
7th September 2011, 18:56
Quick answer: No, I never found a solution.

On Linux I was able to get my method working reasonably, but on windows you can't steal keyboard focus. That's it, nothing you can do. Nothing Qt can do. Windows 7 has a global mode to enable this across all apps, but that isn't likely to be a popular option.

Kaylx
7th September 2011, 19:23
Thanks for letting me know. :)