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. Opening a child window causes icon to disappear
Qt 6.11 is out! See what's new in the release blog

Opening a child window causes icon to disappear

Scheduled Pinned Locked Moved General and Desktop
7 Posts 4 Posters 1.8k Views 1 Watching
  • 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.
  • N Offline
    N Offline
    noastick
    wrote on last edited by
    #1

    Hi.
    I've got a problem that I guess it may be easy to solve.
    I have a window A, in which I want to open a window B when clicking a button, but hiding A at the same time. The thing is, I want to be able to return to A from B through a button too, so i define A as B parent.
    However, when doing so, whenever I do the A->hide(), the icon in the taskbar disappears, making the window imposible to access from it.
    I tried using showMinimized, but this solution causes A to be accesible, which I don't want.
    What can I do considering the restrains?
    Thanks!

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      Are you trying to do a wizard ? If not is B a dialog ?

      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
      • N Offline
        N Offline
        noastick
        wrote on last edited by
        #3

        [quote author="SGaist" date="1424738007"]Hi,

        Are you trying to do a wizard ? If not is B a dialog ?[/quote]

        I've not tried wizard. And no, B is not a dialog, but a MainWindow

        1 Reply Last reply
        0
        • jerome_isAviableJ Offline
          jerome_isAviableJ Offline
          jerome_isAviable
          wrote on last edited by
          #4

          i'm not sure you can open an other mainwindow from/inside an existing mainwindow without have many problems from shared sources...
          so, maybe you have to open an other "B" application (who then open this mainwindow) and communicate by files or slot bewteen them or other way... OR open a dialog box from your mainwindow.

          you can also use a MDI container...

          but i think you have to think about your design for find the best solution you need.

          1 Reply Last reply
          0
          • JKSHJ Offline
            JKSHJ Offline
            JKSH
            Moderators
            wrote on last edited by
            #5

            Hi,

            [quote author="noastick" date="1424733281"]I have a window A, in which I want to open a window B when clicking a button, but hiding A at the same time.[/quote]What about using a "QStackedWidget":http://doc.qt.io/qt-5/qstackedwidget.html to switch between the two?

            [quote author="noastick" date="1424733281"]The thing is, I want to be able to return to A from B through a button too, so i define A as B parent.[/quote]That's not the intended role of parents.

            [quote author="noastick" date="1424733281"]However, when doing so, whenever I do the A->hide(), the icon in the taskbar disappears, making the window imposible to access from it.
            I tried using showMinimized, but this solution causes A to be accesible, which I don't want.[/quote]I don't quite understand: Do you want A to be accessible or inaccessible?

            [quote author="jerome_isAviable?" date="1424747027"]i'm not sure you can open an other mainwindow from/inside an existing mainwindow without have many problems from shared sources...[/quote]A QMainWindow is just another QWidget. You can usually create multiple windows without any problems.

            Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

            1 Reply Last reply
            0
            • N Offline
              N Offline
              noastick
              wrote on last edited by
              #6

              I know the parent is not used for that, but passing the parent as the parameter on the constructor helps my purpose.
              I want A to be inaccessible when B is opened.

              1 Reply Last reply
              0
              • SGaistS Offline
                SGaistS Offline
                SGaist
                Lifetime Qt Champion
                wrote on last edited by
                #7

                Then QStackedWidget or QStackedLayout like suggested by JKSH should be of interest

                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

                • Login

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