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. All MDI windows are active
Forum Updated to NodeBB v4.3 + New Features

All MDI windows are active

Scheduled Pinned Locked Moved Unsolved General and Desktop
14 Posts 3 Posters 2.9k Views 2 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.
  • Aleksey_KA Offline
    Aleksey_KA Offline
    Aleksey_K
    wrote on last edited by Aleksey_K
    #1

    I am getting a weird issue. I have a few MDI windows in QMainWindow and catching windowStateChanged() in one of MDI to show/hide docking widget. Everything works fine here.

    But if I try to put one of that window to dock (not adding it to mdiArea()) like this :

    myMDIWindow->setWindowFlags(Qt::Widget | Qt::CustomizeWindowHint | Qt::FramelessWindowHint);
    
    // Create dock window and put my mdi window into it
    QDockWidget *dock = new QDockWidget(myMDIWindow->windowTitle(), this);
    dock->setFloating(true);
    dock->setFeatures(QDockWidget::DockWidgetFloatable | QDockWidget::DockWidgetMovable);
    dock->setAllowedAreas(Qt::RightDockWidgetArea);
    dock->setWidget(myMDIWindow);      // Wrap mdi window into dock
    mainWindow()->addDockWidget(Qt::RightDockWidgetArea, dock);
    

    then all other MDI windows become persistently active and I can't catch windowStateChanged signal. Converting MDI window to a simple widget does not help as well.

    What could be the problem here? Is this a Qt bug?

    More detailed info: http://stackoverflow.com/questions/36332562/all-mdi-windows-are-active

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

      Hi,

      Sounds strange indeed. How are you creating myMDIWindow ?

      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
      • Aleksey_KA Offline
        Aleksey_KA Offline
        Aleksey_K
        wrote on last edited by
        #3

        With new myMDIWindow() without parent. In constructor nothing special:

        ui->setupUI(this);
        setWindowTitle("some")
        
        
        
        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by SGaist
          #4

          I meant how are you creating it your QMainWindow subclass ?

          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
          • Aleksey_KA Offline
            Aleksey_KA Offline
            Aleksey_K
            wrote on last edited by
            #5

            : QMainWindow(parent),
            ui(new Ui::MyMainWindow),
            mWorkspaceBrowser(parent)
            {
            setWindowFlags(Qt::Widget); // Let QMainWindow act as a common widget here
            }

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

              Where's myMDIWindow ?

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

              Aleksey_KA 1 Reply Last reply
              0
              • Aleksey_KA Offline
                Aleksey_KA Offline
                Aleksey_K
                wrote on last edited by Aleksey_K
                #7

                New info: myMDIWindow with tree widget have signal connected to mdi window which creates it (Let's call it first mdi window). This signal connected to a slot which creates new MDI window according to user double-click in this tree widget. In this case all mdi windows become active. If I create MDI window by clicking a button in first mdi window - all become normal again. Code to create mdi window is the same in both cases:

                  mdiArea->addSubWindow(newMDI);
                  newMDI->setMainWindow(this);
                  newMDI->show();
                  newMDI->raise();
                  mdiArea->setActiveSubWindow(newMDI);
                

                "this" is main window. Could this be dock widget has focus or smth like this on mdi creation?

                1 Reply Last reply
                0
                • SGaistS SGaist

                  Where's myMDIWindow ?

                  Aleksey_KA Offline
                  Aleksey_KA Offline
                  Aleksey_K
                  wrote on last edited by
                  #8

                  @SGaist said:

                  Where's myMDIWindow ?

                  As I said above simple new Widget() without parent created in first mdi window.

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

                    Can you create a minimal compilable example that shows that behavior ?

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

                    Aleksey_KA 1 Reply Last reply
                    0
                    • SGaistS SGaist

                      Can you create a minimal compilable example that shows that behavior ?

                      Aleksey_KA Offline
                      Aleksey_KA Offline
                      Aleksey_K
                      wrote on last edited by
                      #10

                      @SGaist need some time. Probably tomorrow.

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

                        No problem

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

                        Aleksey_KA 1 Reply Last reply
                        0
                        • SGaistS SGaist

                          No problem

                          Aleksey_KA Offline
                          Aleksey_KA Offline
                          Aleksey_K
                          wrote on last edited by
                          #12

                          @SGaist created bug report for now: https://bugreports.qt.io/browse/QTBUG-52287

                          A 1 Reply Last reply
                          0
                          • Aleksey_KA Aleksey_K

                            @SGaist created bug report for now: https://bugreports.qt.io/browse/QTBUG-52287

                            A Offline
                            A Offline
                            alex_malyu
                            wrote on last edited by
                            #13

                            @Aleksey_K

                            Correct me if I am wrong, are you trying to create an instance QMdiSubWindow and put it on the dock widget?

                            In this case it loses its relation to QMDiArea and is treated as a regular widget on the dock widget.
                            So you can't expect QMainWindow windowStateChanged() to be sent.
                            You may try to watch focus on all such widgets and organize equivalent "active" status for them,
                            but QMainWindow will not help you here.

                            Aleksey_KA 1 Reply Last reply
                            0
                            • A alex_malyu

                              @Aleksey_K

                              Correct me if I am wrong, are you trying to create an instance QMdiSubWindow and put it on the dock widget?

                              In this case it loses its relation to QMDiArea and is treated as a regular widget on the dock widget.
                              So you can't expect QMainWindow windowStateChanged() to be sent.
                              You may try to watch focus on all such widgets and organize equivalent "active" status for them,
                              but QMainWindow will not help you here.

                              Aleksey_KA Offline
                              Aleksey_KA Offline
                              Aleksey_K
                              wrote on last edited by
                              #14

                              @alex_malyu yes, You are wrong. Read attentively. I'm not trying to catch signal in mdi going to dock, also I tried to convert it to simple widget which was no such signal.

                              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