QMdiSubWindow close problem



  • Hello!

    I work on an IDE and I use QMdiArea and QMdiSubwindow to display textEdit area and Diagram Area as you can see in screen below:

    http://tinypic.com/r/f9o7ew/6

    I used the following snippet of code to activate close buttons:

    @
    Q_FOREACH (QTabBar* tab, ui->mdiArea->findChildren<QTabBar*>())
    {
    tab->setTabsClosable(true);
    tab->setMovable(true);
    }
    @

    And also the are two classes derived from QMdiSubWindow, one for diagram and one for TextEditor.
    For diagram DeleteOnClose is not a option because I only need it to hide, so I re-implemented QMdiSubWindow::closeEvent(QCloseEvent):

    @
    void MdiDiagram::closeEvent(QCloseEvent *closeEvent)
    {
    Q_UNUSED(closeEvent);
    visible = false;
    mdiParent->removeSubWindow(this);
    }
    @
    where mdiParent is QMdiArea

    When I have multiple Editor tabs + diagram and try to close Diagram Window:

    http://tinypic.com/r/28c0e48/6

    everything turns up like this:

    http://tinypic.com/r/1zoj5vm/6

    and Editor Windows return to initial state if I press maximize button.

    How can I avoid this behavior, or how can I set the rest of windows to be maximized again?


Log in to reply
 

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