Opening a child window causes icon to disappear



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


  • Lifetime Qt Champion

    Hi,

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



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



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


  • Moderators

    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.



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


  • Lifetime Qt Champion

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


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.