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 issue
Forum Updated to NodeBB v4.3 + New Features

QMdiSubWindow close issue

Scheduled Pinned Locked Moved Unsolved General and Desktop
6 Posts 3 Posters 821 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.
  • R Offline
    R Offline
    Roler
    wrote on last edited by Roler
    #1

    Sorry for bad description.
    Here is my problem, I got a QMdiArea and set view mode to "QMdiArea::TabbedView."
    Then I add some QMdiSubWidnow into the QMdiArea, and subwindow will close after double right-click in tabbar.
    Does anybody know how to aviod it?
    By the way, Qt version is 5.12.0.

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi and welcome to devnet,

      Are you sure they are not shaded ?

      In any case, please provide a minimal compilable example that shows that behaviour.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      1
      • R Offline
        R Offline
        Roler
        wrote on last edited by
        #3

        Thank you very much for reply.
        Here is my debug code, it's quite simple.

            for (int i=0; i<3; i++)
            {
                QMdiSubWindow *pSubWindow = new QMdiSubWindow;
                pSubWindow->setWidget(new QWidget);
                pSubWindow->setAttribute(Qt::WA_DeleteOnClose);
                ui->mdiArea->addSubWindow(pSubWindow);
                pSubWindow->showMaximized();
            }
            ui->mdiArea->setViewMode(QMdiArea::TabbedView);
        

        alt text

        As I said in picture, the subWindow will be closed after I double right-click it tabBar.
        It's been bothering me for while.

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          Can you provide a minimal compilable example that shows that behaviour.

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0
          • B Offline
            B Offline
            Bonnie
            wrote on last edited by Bonnie
            #5

            I think it is because that the first right click will popup a context menu with a close action, and the second right click will trigger the action (by clicking at it).
            You can avoid that by disable the system menu of QMdiSubWindow.

            pSubWindow->setSystemMenu(Q_NULLPTR);
            

            But if you want to keep the menu, then you cannot avoid it.
            Without the menu, the subwindows can still be closed by add close button to the tabs.

            ui->mdiArea->setTabsClosable(true);
            
            1 Reply Last reply
            0
            • R Offline
              R Offline
              Roler
              wrote on last edited by Roler
              #6

              Hi Bonnie, thanks for reply.
              I notice that context menu too, and I don't know if it is a bug.
              Because if you just right click and context menu will popup, then don't move cursor do another right click, the subwindow will not be closed. If it is second right click that trigger the close action it should be closed as well.
              Subwindow will be closed only if you double right click quickly.

              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