Please nominate your Qt Champions for 2021!

[SOLVED]Opening of same independed sub_mainwindows from a mainwindow

  • Hi,

    I trying to develop an application that needs to open from my mainwindow
    some other mainwindows.(lets call them submainwindows)

    My problem is that every time i open a new submainwindow my
    previews submainwindow takes the variables of the new one
    (and i don't want this)

    I tried to make an array of this submainwindows, so that everyone
    will be separate than the others...
    but this way my problem is that the compiler gives me an error
    that may not be initialized.

    Does anybody can help me with this?

    PS: I would prefer not to use an array of mainwindows
    (but if it is necessary i will do it)

    Thank you in advance

  • From your problem, there seems to be a parent child relationship between the mainwindow and the so called sub windows. If that is not required you should consider them to be re-parented. i.e remove the parent child relationships and see.

  • Thank you prady_80,
    I will try to learn about this relation.. ( Since then, I just observe that they probably have not that kind of
    relationship...) In their header file is:
    explicit MySubMainWindow(QWidget *parent = 0);@

    I think that my problem is that in the cpp file before Widget start, i define some parameters that i need...
    (So they are probably external for my whole program)
    I doing this because i haven't find a better solution to pass argument in the SLOTS...
    Probably is time to find another way...

    Thank you anyway,
    I will check the relationship of QWidgets too...

  • Finally i found a better solution and now i dont have a problem...
    Insteed of defining my parameters on the top of the cpp fole, i defined them
    as private in the header...
    So,every new (sub)mainwindow has its own parameters

Log in to reply