TaskBar-Icon hidden when MainWindow hidden
-
wrote on 20 Feb 2019, 06:47 last edited by
Hi everybody
i just experienced the problem, that my applications taskbar-icon hides when my primary QMainwindow is hidden and it doesnt show up after creating and showing another QMainWindow ( a child window ). How can i force QT to keep the taskbar-icon visible?
What i dont want to do, is to minimize my primary window instead of hiding ( its a login-window ).
QT-Version: 5.9.2
OS: Windows 7 -
wrote on 20 Feb 2019, 19:13 last edited by
Hello,
if you hide a QMainWindow, the icon disappears.
To keep the icon visible, minimize your window withthis->setWindowState(Qt::WindowMinimized);
-
Hi,
Out of curiosity, do you really need several QMainWindow ?
What is the workflow of your application ?
-
wrote on 21 Feb 2019, 06:00 last edited by Toby
Thanks for your replies so far :-)
Minimization can't be the way to go, because the user still has the option to maximize the window again.
I expected the taskbar-icon to represent a running application, not a single window...@SGaist
The workflow is the following:
QMainWindow ( the primary one ) is a login-window.
After a successful login-process i automatically open at least one working-window for the user, while the login-window is being hidden.
Although being hidden, the loginwindow still does a lot work, but shall not be visible, so closing the window is not an option.
E.g. it owns a "ConnectionManager" that manages a TcpSocket and organizes all working-windows ( creates, closes, saves window-configuration ). All working windows are children of the main loginwindow. -
wrote on 21 Feb 2019, 06:25 last edited by
I just found a solution:
Every QMainWindow you create, should not have a parent. As long as there is at least one visible QMainWindow without a parent ( or nullptr as parent ) the taskbar-icon stays visible.
But i'd still take suggestions according to my workflow ;-)
-
I just found a solution:
Every QMainWindow you create, should not have a parent. As long as there is at least one visible QMainWindow without a parent ( or nullptr as parent ) the taskbar-icon stays visible.
But i'd still take suggestions according to my workflow ;-)
@Toby I'm not sure why your login window does anything else than the log-in procedure. This doesn't sound like good design.
-
wrote on 21 Feb 2019, 10:54 last edited by
You are right. Its not really good design. It would be better to create a non-visible Object, which does all the communication and management-stuff and which generates windows on demand. Would you agree?
-
You are right. Its not really good design. It would be better to create a non-visible Object, which does all the communication and management-stuff and which generates windows on demand. Would you agree?
@Toby Yes, in general it is a good idea to decouple UI and logic.
1/8