QMdiSubWindow Buttons Merged With Menubar
Unsolved
Language Bindings
-
My setup:
PyQt 5.9
Python 3.6.3
Ubuntu 17.10I'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.
Here's what I would expect (positioning and sizing the window manually).
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? -
Hi and welcome to devnet,
It might very well be a Ubuntu specific behaviour, can you recheck that with another window manager than Unity ?