I am trying to make taskbar icon of my application visible after minimizing my window. My window can be displayed by show() or showFullScreen(), so my code for hiding window is:
w.setWindowFlags(w.windowFlags() | Qt::WindowStaysOnTopHint);
I also tried
w.setWindowFlags(w.windowFlags() | Qt::WindowStaysOnTopHint | Qt::Tool | etc);
but still the same: application is minimized but there is no icon on taskbar.
From here I learned that setWindowFlags:
Note: This function calls setParent() when changing the flags for a window, causing the widget to be hidden. You must call show() to make the widget visible again
But I can't use show() 'cause I wanna hide it.
How this can be done? Should I use WinApi or there is a QT-way, that I missed? (Qt::WindowStaysOnTopHint flag is necessary)
UPD1: I have my own system tray implemented, by I need icon on taskbar
UPD2: I've tried both showMinimized() and setWindowState(Qt::WindowMinimized). In first case there is icon on taskbar but after restoring the window (which was showed by showFullScreen()) there are window controls: minimize, close. caption etc. In second case it minimizes and restores correctly as I want, but there is no icon on taskbar.
Qt::Tool
. Besides that, there is a difference between a hidden window and a minimized window. The former will not get a taskbar button. – IInspectableQSystemTrayIcon
? – PnotNPQWindow::showMinimized()
instead ofsetWindowFlags
? – Evgeny