Skip to content

Commit 60da747

Browse files
committed
Make controls dock closable and transparent title
Allow the left controls dock to be closed independently by adding QDockWidget.DockWidgetClosable to its features. Hide the docked title bar by applying a transparent stylesheet to the controls dock to improve visual integration. Also add a separator in the View menu before the Appearance submenu
1 parent e9b5d52 commit 60da747

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

dlclivegui/gui/main_window.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ def _setup_ui(self) -> None:
297297
self.controls_dock.setWidget(controls_widget)
298298
### Dock features
299299
self.controls_dock.setFeatures( # must not close independently
300-
QDockWidget.DockWidgetMovable | QDockWidget.DockWidgetFloatable
300+
QDockWidget.DockWidgetMovable | QDockWidget.DockWidgetFloatable | QDockWidget.DockWidgetClosable
301301
)
302302
self.addDockWidget(Qt.LeftDockWidgetArea, self.controls_dock)
303303
self.setDockOptions(
@@ -306,6 +306,13 @@ def _setup_ui(self) -> None:
306306
| QMainWindow.DockOption.GroupedDragging
307307
| QMainWindow.DockOption.AnimatedDocks
308308
)
309+
self.controls_dock.setStyleSheet(
310+
"""/* Docked title bar: fully transparent */
311+
QDockWidget#ControlsDock::title {
312+
background-color: rgba(0, 0, 0, 0);
313+
}
314+
"""
315+
)
309316

310317
self.setStatusBar(QStatusBar())
311318
self._build_menus()
@@ -384,6 +391,7 @@ def _build_menus(self) -> None:
384391
# View menu
385392
view_menu = self.menuBar().addMenu("&View")
386393
view_menu.addAction(self.controls_dock.toggleViewAction())
394+
view_menu.addSeparator()
387395
appearance_menu = view_menu.addMenu("Appearance")
388396
## Style actions
389397
self.action_dark_mode = QAction("Dark theme", self, checkable=True)

0 commit comments

Comments
 (0)