windows 7 - Qt app, minimized to tray, on Win7 there's a problem with focus stealing prevention -


i have qt app which, skype, minimized tray. when user clicks tray icon, app window shown.

this works fine on linux , winxp. on win7 however, app window shown stays below other windows - unless active window qt creator, or app (before minimized tray). must have focus stealing prevention.

i know skype written in qt, , don't have problem, must fixable.

here's code:

 void mainwindow::togglevisible(qsystemtrayicon::activationreason reason) {     if (qsystemtrayicon::trigger == reason)         setvisible(!isvisible()); } 

[edit] turns out had call activatewindow. changed code to:

 void mainwindow::togglevisible(qsystemtrayicon::activationreason reason) {     if (qsystemtrayicon::trigger == reason)     {         if (isvisible())         {             hide();         }         else         {             show();             raise();             activatewindow();         }     } } 

it works on win7 now.

i use following code make application visible when clicked tray;

setwindowstate(windowstate() & ~qt::windowminimized | qt::windowactive); 

this handle case in minimized , click tray icon.


Comments

Popular posts from this blog

java - SNMP4J General Variable Binding Error -

windows - Python Service Installation - "Could not find PythonClass entry" -

Determine if a XmlNode is empty or null in C#? -