diff --git a/src/ert/gui/main_window.py b/src/ert/gui/main_window.py index 273157e8779..97689022c82 100644 --- a/src/ert/gui/main_window.py +++ b/src/ert/gui/main_window.py @@ -9,6 +9,7 @@ from qtpy.QtGui import QCloseEvent, QCursor, QIcon from qtpy.QtWidgets import ( QAction, + QButtonGroup, QFrame, QHBoxLayout, QMainWindow, @@ -50,6 +51,7 @@ BUTTON_STYLE_SHEET + """ QToolButton:hover {background-color: rgba(50, 50, 50, 90);} + QToolButton:checked {background-color: rgba(50, 50, 50, 120);} """ ) @@ -57,6 +59,7 @@ BUTTON_STYLE_SHEET + """ QToolButton:hover {background-color: rgba(30, 30, 30, 150);} + QToolButton:checked {background-color: rgba(30, 30, 30, 120);} """ ) @@ -87,6 +90,7 @@ def __init__( self.central_widget.setLayout(self.central_layout) self.facade = LibresFacade(self.ert_config) self.side_frame = QFrame(self) + self.button_group = QButtonGroup(self.side_frame) if self.is_dark_mode(): self.side_frame.setStyleSheet("background-color: rgb(64, 64, 64);") @@ -233,6 +237,7 @@ def post_init(self) -> None: def _add_sidebar_button(self, name: str, icon: QIcon) -> QToolButton: button = QToolButton(self.side_frame) + button.setCheckable(True) button.setFixedSize(85, 95) button.setCursor(QCursor(Qt.CursorShape.PointingHandCursor)) @@ -254,6 +259,7 @@ def _add_sidebar_button(self, name: str, icon: QIcon) -> QToolButton: button.clicked.connect(self.select_central_widget) button.setProperty("index", name) + self.button_group.addButton(button) return button def __add_help_menu(self) -> None: