Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Language Bindings
  4. QMdiSubWindow Buttons Merged With Menubar
Qt 6.11 is out! See what's new in the release blog

QMdiSubWindow Buttons Merged With Menubar

Scheduled Pinned Locked Moved Unsolved Language Bindings
3 Posts 2 Posters 2.2k 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.
  • J Offline
    J Offline
    jmwright
    wrote on last edited by
    #1

    My setup:
    PyQt 5.9
    Python 3.6.3
    Ubuntu 17.10

    I'm not sure if this is expected behavior, or if I've made a mistake in my code. The following code gives me a result that doesn't seem intuitive. The minimize/maximize/close buttons for the QMdiSubWindows end up merged into the menubar area.

    import sys
    from PyQt5.QtCore import Qt
    from PyQt5.QtWidgets import QApplication, QMainWindow, QMdiArea, QMdiSubWindow, QPlainTextEdit
    
    class TestApp(QMainWindow):
        def __init__(self):
            super(TestApp, self).__init__()
    
            self.initUI()
    
        def initUI(self):
            self.mdiArea = QMdiArea()
            self.mdiArea.setHorizontalScrollBarPolicy(Qt.ScrollBarAsNeeded)
            self.mdiArea.setVerticalScrollBarPolicy(Qt.ScrollBarAsNeeded)
            self.setCentralWidget(self.mdiArea)
            # self.mdiArea.setViewMode(QMdiArea.TabbedView)
    
            self.setWindowTitle('Test App')
            self.statusBar().showMessage('Ready')
    
            self.menubar = self.menuBar()
            self.fileMenu = self.menubar.addMenu('&File')
    
            # self.toolbar = self.addToolBar('Main Tools')
            # self.toolbar.addWidget(logoLabel)
    
            self.showMaximized()
    
            subWin = QMdiSubWindow()
            child = QPlainTextEdit(self)
            subWin.setWidget(child)
            self.mdiArea.addSubWindow(subWin)
            subWin.setWindowState(Qt.WindowMaximized)
    
            subWin2 = QMdiSubWindow()
            child2 = QPlainTextEdit(self)
            subWin2.setWidget(child2)
            self.mdiArea.addSubWindow(subWin2)
            subWin2.setWindowState(Qt.WindowMaximized)
    
    if __name__ == '__main__':
        app = QApplication(sys.argv)
        testApp = TestApp()
    
        sys.exit(app.exec_())
    
    

    This is the result I get.
    0_1513911605742_Ubuntu_17-10_PyQt5.png
    Here's what I would expect (positioning and sizing the window manually).
    0_1513911776885_Screenshot_2017-12-21_22-02-42.png
    Is there something wrong with my code, or is there a setting for the MdiArea to keep the subwindow buttons from running into the menubar area?

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

      Hi and welcome to devnet,

      It might very well be a Ubuntu specific behaviour, can you recheck that with another window manager than Unity ?

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

        @SGaist Thanks for the reply. It has the same behavior in the MATE desktop environment. So far I've also tried in Unity and Gnome 3.0 as well.

        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