How do I make my QMainWindow's contents dynamically resize after floating a QDockWidget?
-
I managed to boil the problem down to a single example:
from PySide6.QtCore import Qt from PySide6.QtWidgets import QApplication, QDockWidget, QLabel, QMainWindow, QPushButton class MainWindow (QMainWindow): def __init__ (self): super().__init__() btn = QPushButton('Create Dock') btn.clicked.connect(self.evt_clicked) self.setCentralWidget(btn) def evt_clicked (self) -> None: dock = QDockWidget('Dock', self) dock.setWidget(QLabel('Label')) self.addDockWidget(Qt.BottomDockWidgetArea, dock) if __name__ == '__main__': app = QApplication() window = MainWindow() window.show() app.exec()I clicked the button a few times to create a few docked widgets, then dragged one out of the QMainWindow area and onto my desktop to float it. After I did this, NONE of the QMainWindow's contents, the button and all remaining docks included, will resize when I resize the window itself. Taking any floating dock and re-attaching it to the window fixes this problem.
I made a short video that showcases the problem: https://youtu.be/Gfpu0l4zN5M
Does anyone else know how to fix this?
-
This is a known bug in dock widgets which should be fixed in 6.11.2 AFAIK.
-
I tried this code on a different machine with Ot/PySide6 6.11.0 and it worked as expected. Thank you!
EDIT: For completeness, apparently this issue only impacts very specific QT versions: https://stackoverflow.com/questions/79999518/how-do-i-make-my-qmainwindows-contents-dynamically-resize-after-floating-a-qdoc/79999535#79999535
-
I tried this code on a different machine with Ot/PySide6 6.11.0 and it worked as expected. Thank you!
EDIT: For completeness, apparently this issue only impacts very specific QT versions: https://stackoverflow.com/questions/79999518/how-do-i-make-my-qmainwindows-contents-dynamically-resize-after-floating-a-qdoc/79999535#79999535
@FatesealMagic said in How do I make my QMainWindow's contents dynamically resize after floating a QDockWidget?:
I tried this code on a different machine with Ot/PySide6 6.11.0 and it worked as expected. Thank you!
EDIT: For completeness, apparently this issue only impacts very specific QT versions: https://stackoverflow.com/questions/79999518/how-do-i-make-my-qmainwindows-contents-dynamically-resize-after-floating-a-qdoc/79999535#79999535
Indeed: https://qt-project.atlassian.net/browse/QTBUG-147209