Cmd-H shortcut on Mac OS
-
Hi all,
I'm developing a background application without menu nor dock icon, and only a systray icon.
When I show the main window, I can close it with Cmd-W by overloading the keyPressEvent method.
I'm using hide() and show() on myQWidget.
When I hide the same window by using Cmd-H, it hides, but the show() method on it does not call it back. I have to quit my program and restart to be able to see the window back.What would be the right way to hide the window properly or set it back without show() ? I tried showNormal() too and it didn't resolv my problem.
Thank you !
-
If you press Cmd-H on Mac OS X the widget is hidden with the operating system's methods. It is another kind of hide than with the hide() slot. In case of Cmd-H hide, the window appears in the dock (as far as I know you cannot prevent this - if it's possible I'd like to know how).
You can add a menu entry to the systray icon and connect the actions's triggered() to the slot raise() of your window. At least with a regular QMainWindow this works. You might have to call activateWindow() too.