Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

adding subwindow to MDI area



  • The attached code does add subwindoiw as minimized , however I have not found an easy way to add the object to the area - for real .

    I am actually ignorant about the "double square " icon name on the window status bar. That one put the correct window size to the MDI area - but manually - by clicking it.

    Can that be done in code ?

    mdiArea->addSubWindow(DDD)->
    setWindowState(Qt::WindowMinimized) ;

    de8b4701-660f-47cb-868f-2f757b1ee7f4-image.png



  • Hi @AnneRanch,

    Not sure about what you mean by "add the object the area - for real".
    But did you try setWindowState(Qt::WindowMaximized); ?

    Note you can also use the "Tabbed" view mode using QMdiArea::setViewMode(QMdiArea::ViewMode mode)
    hope it helps



  • @Gojir4 The code "minimized" is NOT desired - hence it is not for real IMHO.
    Yes the "maximized" works fine.
    The task is to add the subwindow - such as default to "upper left corner of size the object " not as currently "minimized".
    The TAB is not my objective for now, but I'll try it.

    PS
    Can anybody name the "double square icon " ?



  • @AnneRanch If you need to display the subwindow using its original size (sizehint). I think you should probably not call setWindowState at all.

    The "double square icon" corrsespond to the window flag Qt::WindowMaximizeButtonHint



  • @Gojir4 Found the definition of the icon - officially called "restore".
    It is assuming that the window was set maximize or minimize.
    Then it can be "restored".
    For yet unknown reason I cannot find how to build desired size of the dialog,
    only minimized or maximized.

    Since my code builds the area subwindow as minimized.
    I should be able to "restore" it in code.
    Thus I need to replace manually clicking on the "restore " icon and size the result.
    Not sure where - in dialog or area...



  • @AnneRanch said in adding subwindow to MDI area:

    Since my code builds the area subwindow as minimized.

    Well, don't do that then.

    default to "upper left corner of size the object "

    I do not know what this even means.

    If you want to position or resize the QMdiSubWindow then:

    • Capture the pointer to the QMdiSubWindow returned by QMdiArea::addSubWindow() (that your code line currently discards)
    • Then call QMdiSubWindow::resize() and/or QMdiSubWindow::move()


  • @ChrisW67 Before I read the last reply , I did this .
    Works as required

       
           Form_SYSTEM *FS = new  Form_SYSTEM();
            
            mdiArea->addSubWindow(FS)->
                    setWindowState(Qt::WindowMinimized) ;
            //modify current / last addition 
             mdiArea->currentSubWindow()->showNormal();
             mdiArea->currentSubWindow()->resize(400,400);
    

    SOLVED


Log in to reply