From e2c3033a186a97d30c8da93c2a35cc598a94d79f Mon Sep 17 00:00:00 2001 From: Carlos Cordoba Date: Sat, 15 Jul 2023 13:46:26 -0500 Subject: [PATCH] Stylesheet: Make QTabBar scroll button icons smaller on Windows and Mac --- spyder/utils/stylesheet.py | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/spyder/utils/stylesheet.py b/spyder/utils/stylesheet.py index 56bce7fd796..bc220c5dce6 100644 --- a/spyder/utils/stylesheet.py +++ b/spyder/utils/stylesheet.py @@ -300,13 +300,14 @@ def set_stylesheet(self): css = self.get_stylesheet() buttons_color = QStylePalette.COLOR_BACKGROUND_1 - # Set style for scroller buttons + # Set style for scroll buttons css[f'QTabBar{self.OBJECT_NAME} QToolButton'].setValues( background=buttons_color, borderRadius='0px', borderRight=f'{self.BORDER_RIGHT_WIDTH} solid {buttons_color}' ) + # Hover and pressed state for scroll buttons for state in ['hover', 'pressed', 'checked', 'checked:hover']: if state == 'hover': color = QStylePalette.COLOR_BACKGROUND_2 @@ -316,6 +317,7 @@ def set_stylesheet(self): background=color ) + # Set width for scroll buttons # This makes one button huge and the other very small in PyQt 5.9 if not OLD_PYQT: css['QTabBar::scroller'].setValues( @@ -412,6 +414,12 @@ def set_stylesheet(self): right='-3px' if WIN else '-1px' ) + # Make scroll button icons smaller on Windows and Mac + if WIN or MAC: + css[f'QTabBar{self.OBJECT_NAME} QToolButton'].setValues( + padding='9px', + ) + class DockTabBarStyleSheet(BaseTabBarStyleSheet): """ @@ -509,6 +517,12 @@ def set_stylesheet(self): borderRightColor=f'{QStylePalette.COLOR_BACKGROUND_4}' ) + # Make scroll button icons smaller on Windows and Mac + if WIN or MAC: + css['QTabBar QToolButton'].setValues( + padding='10px', + ) + PANES_TABBAR_STYLESHEET = PanesTabBarStyleSheet() DOCK_TABBAR_STYLESHEET = DockTabBarStyleSheet()