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. QMdiSubWindow close problem
Qt 6.11 is out! See what's new in the release blog

QMdiSubWindow close problem

Scheduled Pinned Locked Moved General and Desktop
1 Posts 1 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.
  • ? Offline
    ? Offline
    A Former User
    wrote on last edited by
    #1

    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?

    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