Important: Please read the Qt Code of Conduct -

TaskBar-Icon hidden when MainWindow hidden

  • 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

  • Hello,

    if you hide a QMainWindow, the icon disappears.
    To keep the icon visible, minimize your window with


  • Lifetime Qt Champion


    Out of curiosity, do you really need several QMainWindow ?

    What is the workflow of your application ?

  • 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...

    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.

  • 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 ;-)

  • Lifetime Qt Champion

    @Toby I'm not sure why your login window does anything else than the log-in procedure. This doesn't sound like good design.

  • 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?

  • Lifetime Qt Champion

    @Toby Yes, in general it is a good idea to decouple UI and logic.

Log in to reply