Details
-
Bug
-
Resolution: Invalid
-
P2: Important
-
None
-
6.9.0
-
None
-
{{kinfo}} returns:
{quote}{code:yaml}
Operating System: Fedora Linux 42
KDE Plasma Version: 6.3.5
KDE Frameworks Version: 6.13.0
Qt Version: 6.9.0
Kernel Version: 6.14.5-300.fc42.x86_64 (64-bit)
Graphics Platform: Wayland
Processors: 12 × AMD Ryzen 5 7600X 6-Core Processor
Memory: 30.4 GiB of RAM
Graphics Processor 1: AMD Radeon RX 5700
Graphics Processor 2: AMD Radeon Graphics
Manufacturer: ASRock
Product Name: X670E Taichi
{code}{quote}{{kinfo}} returns: {quote}{code:yaml} Operating System: Fedora Linux 42 KDE Plasma Version: 6.3.5 KDE Frameworks Version: 6.13.0 Qt Version: 6.9.0 Kernel Version: 6.14.5-300.fc42.x86_64 (64-bit) Graphics Platform: Wayland Processors: 12 × AMD Ryzen 5 7600X 6-Core Processor Memory: 30.4 GiB of RAM Graphics Processor 1: AMD Radeon RX 5700 Graphics Processor 2: AMD Radeon Graphics Manufacturer: ASRock Product Name: X670E Taichi {code}{quote}
Description
Undocking a QDockWidget embedded inside an MdiSubWindow causes the QDockWidget to be unmovable, and subsequently impossible to re-embed (yet the button remains clickable).
import sys from PyQt6.QtWidgets import ( QApplication, QMainWindow, QDockWidget, QLabel, QMdiArea, QMdiSubWindow ) from PyQt6.QtCore import Qt class MinimalMdiDockApp(QMainWindow): def __init__(self): super().__init__() self.setWindowTitle("Minimal QMdiArea with QDockWidget Inside Sub-Window") self.setGeometry(100, 100, 800, 600) self.mdi_area = QMdiArea() self.setCentralWidget(self.mdi_area) # Create a QMdiSubWindow sub_window = QMdiSubWindow() sub_window.setWindowTitle("Sub-Window with Dock Widget") # Create the QDockWidget dock_widget = QDockWidget("Internal Dock", sub_window) # Parent is sub_window, not QMainWindow # Set the required features for the QDockWidget dock_widget.setFeatures( QDockWidget.DockWidgetFeature.DockWidgetClosable | QDockWidget.DockWidgetFeature.DockWidgetMovable | QDockWidget.DockWidgetFeature.DockWidgetFloatable ) # Create content for the dock widget dock_content = QLabel("This is supposed to be a dock!") dock_content.setAlignment(Qt.AlignmentFlag.AlignCenter) dock_widget.setWidget(dock_content) # Set the QDockWidget directly as the content of the QMdiSubWindow # This is the key change. sub_window.setWidget(dock_widget) # Attempting to put QDockWidget directly self.mdi_area.addSubWindow(sub_window) sub_window.show() if __name__ == "__main__": app = QApplication(sys.argv) window = MinimalMdiDockApp() window.show() sys.exit(app.exec())