Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. TaskBar-Icon hidden when MainWindow hidden

TaskBar-Icon hidden when MainWindow hidden

Scheduled Pinned Locked Moved Solved General and Desktop
8 Posts 4 Posters 2.8k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    Toby
    wrote on 20 Feb 2019, 06:47 last edited by
    #1

    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

    1 Reply Last reply
    0
    • P Offline
      P Offline
      Pl45m4
      wrote on 20 Feb 2019, 19:13 last edited by
      #2

      Hello,

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

      this->setWindowState(Qt::WindowMinimized);
      

      https://doc.qt.io/qt-5/qwidget.html#setWindowState


      If debugging is the process of removing software bugs, then programming must be the process of putting them in.

      ~E. W. Dijkstra

      1 Reply Last reply
      0
      • S Offline
        S Offline
        SGaist
        Lifetime Qt Champion
        wrote on 20 Feb 2019, 19:17 last edited by
        #3

        Hi,

        Out of curiosity, do you really need several QMainWindow ?

        What is the workflow of your application ?

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

        1 Reply Last reply
        0
        • T Offline
          T Offline
          Toby
          wrote on 21 Feb 2019, 06:00 last edited by Toby
          #4

          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.

          1 Reply Last reply
          0
          • T Offline
            T Offline
            Toby
            wrote on 21 Feb 2019, 06:25 last edited by
            #5

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

            J 1 Reply Last reply 21 Feb 2019, 08:00
            0
            • T Toby
              21 Feb 2019, 06:25

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

              J Offline
              J Offline
              jsulm
              Lifetime Qt Champion
              wrote on 21 Feb 2019, 08:00 last edited by
              #6

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

              https://forum.qt.io/topic/113070/qt-code-of-conduct

              1 Reply Last reply
              2
              • T Offline
                T Offline
                Toby
                wrote on 21 Feb 2019, 10:54 last edited by
                #7

                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?

                J 1 Reply Last reply 21 Feb 2019, 11:59
                1
                • T Toby
                  21 Feb 2019, 10:54

                  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?

                  J Offline
                  J Offline
                  jsulm
                  Lifetime Qt Champion
                  wrote on 21 Feb 2019, 11:59 last edited by
                  #8

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

                  https://forum.qt.io/topic/113070/qt-code-of-conduct

                  1 Reply Last reply
                  1

                  1/8

                  20 Feb 2019, 06:47

                  • Login

                  • Login or register to search.
                  1 out of 8
                  • First post
                    1/8
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • Users
                  • Groups
                  • Search
                  • Get Qt Extensions
                  • Unsolved