From 384b7cb20a49bf6eb3b628a8dc4ed5e978acc306 Mon Sep 17 00:00:00 2001 From: xdustinface Date: Thu, 18 Jun 2020 04:45:49 +0200 Subject: [PATCH 1/3] qt: Add platform specific css style for scrollbars This disabled scrollbars.css loading and adds a "windows,other" section in general.css, dark.css and light.css where it adds customizations for scrollbars in each theme. --- src/qt/guiutil.cpp | 3 - src/qt/res/css/dark.css | 47 +++++++++-- src/qt/res/css/general.css | 157 +++++++++++++++++++++++++++++++++++-- src/qt/res/css/light.css | 45 +++++++++-- 4 files changed, 232 insertions(+), 20 deletions(-) diff --git a/src/qt/guiutil.cpp b/src/qt/guiutil.cpp index c8cf8537601b..2eeafab82ad6 100644 --- a/src/qt/guiutil.cpp +++ b/src/qt/guiutil.cpp @@ -1122,9 +1122,6 @@ void loadStyleSheet(QWidget* widget, bool fForceUpdate) std::vector vecFiles; // If light/dark theme is used load general styles first if (dashThemeActive()) { -#ifndef Q_OS_MAC - vecFiles.push_back(pathToFile("scrollbars")); -#endif vecFiles.push_back(pathToFile("general")); } vecFiles.push_back(pathToFile(getActiveTheme())); diff --git a/src/qt/res/css/dark.css b/src/qt/res/css/dark.css index 97c8dbfaaf8c..772ef71c1fe7 100644 --- a/src/qt/res/css/dark.css +++ b/src/qt/res/css/dark.css @@ -483,7 +483,8 @@ QScrollBar ******************************************************/ /* Do NOT apply any styles to QScrollBar here, -* it's OS dependent and should be handled via platform specific code. +* it's OS dependent and should be handled via platform specific code at the +* end of the file. */ /****************************************************** @@ -811,11 +812,45 @@ be kept in mind when adding sections to avoid unexpected overwriting. ******************************************************* ******************************************************/ - + -/* Example section to add styles for all operating systems - Remove any to exclude it. -*/ +/****************************************************** +QScrollBar +******************************************************/ - +QScrollBar::add-page, +QScrollBar::sub-page { + background-color: #39393b; +} +QScrollBar::handle:vertical, +QScrollBar::handle:horizontal { + background-color: #4a4a4b; +} +QScrollBar:handle:horizontal:hover, +QScrollBar:handle:vertical:hover { + background-color: #585858; +} +QScrollBar:handle:horizontal:pressed, +QScrollBar:handle:vertical:pressed { + background-color: #4a4a4b; +} +QScrollBar::add-line:vertical, +QScrollBar::sub-line:vertical, +QScrollBar::add-line:horizontal, +QScrollBar::sub-line:horizontal { + background-color: #585858; +} +QScrollBar::add-line:vertical:hover, +QScrollBar::sub-line:vertical:hover, +QScrollBar::add-line:horizontal:hover, +QScrollBar::sub-line:horizontal:hover { + background-color: #4a4a4b; +} +QScrollBar::add-line:vertical:pressed, +QScrollBar::sub-line:vertical:pressed, +QScrollBar::add-line:horizontal:pressed, +QScrollBar::sub-line:horizontal:pressed { + background-color: #39393b; +} + diff --git a/src/qt/res/css/general.css b/src/qt/res/css/general.css index a0e98789b053..9a4f7e874216 100644 --- a/src/qt/res/css/general.css +++ b/src/qt/res/css/general.css @@ -796,7 +796,8 @@ QScrollBar ******************************************************/ /* Do NOT apply any styles to QScrollBar here, -* it's OS dependent and should be handled via platform specific code. +* it's OS dependent and should be handled via platform specific code at the +* end of the file. */ /****************************************************** @@ -1865,12 +1866,156 @@ be kept in mind when adding sections to avoid unexpected overwriting. ******************************************************* ******************************************************/ + - +/****************************************************** +QScrollBar +******************************************************/ -/* Example section to add styles for all operating systems - Remove any to exclude it. -*/ +QScrollBar:vertical { /* Vertical Scroll Bar Attributes */ + border: 0; + width: 18px; + margin: 18px 0px 18px 0px; +} - +QScrollBar:horizontal { /* Horizontal Scroll Bar Attributes */ + border: 0; + height: 18px; + padding: 0px 18px 0px 18px; +} + +QScrollBar:handle:horizontal:hover, +QScrollBar:handle:vertical:hover { /* Horizontal Scroll Bar Attributes */ + background-color: red; +} + +QScrollBar:handle:horizontal:pressed, +QScrollBar:handle:vertical:pressed { /* Horizontal Scroll Bar Attributes */ + background-color: red; +} + +QScrollBar::handle:vertical { /* Scroll Bar Slider - vertical */ + background-color: red; + min-height: 10px; +} + +QScrollBar::handle:horizontal { /* Scroll Bar Slider - horizontal */ + background-color: red; + min-width: 10px; +} + +QScrollBar::add-page, +QScrollBar::sub-page { /* Scroll Bar Background */ + background-color: red; +} + +QScrollBar::add-line:vertical, +QScrollBar::sub-line:vertical, +QScrollBar::add-line:horizontal, +QScrollBar::sub-line:horizontal { /* Define Arrow Button Dimensions */ + background-color: red; + border: 0px solid red; + width: 18px; + height: 18px; +} + +QScrollBar::add-line:vertical:hover, +QScrollBar::sub-line:vertical:hover, +QScrollBar::add-line:horizontal:hover, +QScrollBar::sub-line:horizontal:hover { /* Define Arrow Button Dimensions */ + background-color: red; +} +QScrollBar::add-line:vertical:pressed, +QScrollBar::sub-line:vertical:pressed, +QScrollBar::add-line:horizontal:pressed, +QScrollBar::sub-line:horizontal:pressed { + background-color: red; +} + +QScrollBar::sub-line:vertical { /* Vertical - top button position */ + subcontrol-position: top; + subcontrol-origin: margin; +} + +QScrollBar::add-line:vertical { /* Vertical - bottom button position */ + subcontrol-position: bottom; + subcontrol-origin: margin; +} + +QScrollBar::sub-line:horizontal { /* Vertical - left button position */ + subcontrol-position: left; + subcontrol-origin: margin; +} + +QScrollBar::add-line:horizontal { /* Vertical - right button position */ + subcontrol-position: right; + subcontrol-origin: margin; +} + +QScrollBar:up-arrow, +QScrollBar:down-arrow, +QScrollBar:left-arrow, +QScrollBar:right-arrow { /* Arrows Icon */ + width: 18px; + height: 18px; +} + +QScrollBar:up-arrow { + border-image: url(':/images/arrow_up_normal'); +} +QScrollBar:up-arrow:hover { + border-image: url(':/images/arrow_up_hover'); +} +QScrollBar:up-arrow:pressed { + border-image: url(':/images/arrow_up_pressed'); +} +QScrollBar:up-arrow:disabled { + border-image: url(':/images/arrow_light_up_hover'); +} + +QScrollBar:down-arrow { + border-image: url(':/images/arrow_down_normal'); +} +QScrollBar:down-arrow:hover { + border-image: url(':/images/arrow_down_hover'); +} +QScrollBar:down-arrow:pressed { + border-image: url(':/images/arrow_down_pressed'); +} +QScrollBar:down-arrow:disabled { + border-image: url(':/images/arrow_light_down_hover'); +} + +QScrollBar:left-arrow { + border-image: url(':/images/arrow_left_normal'); +} +QScrollBar:left-arrow:hover { + border-image: url(':/images/arrow_left_hover'); +} +QScrollBar:left-arrow:pressed { + border-image: url(':/images/arrow_left_pressed'); +} +QScrollBar:left-arrow:disabled { + border-image: url(':/images/arrow_light_left_hover'); +} + +QScrollBar:right-arrow { + border-image: url(':/images/arrow_right_normal'); +} +QScrollBar:right-arrow:hover { + border-image: url(':/images/arrow_right_hover'); +} +QScrollBar:right-arrow:pressed { + border-image: url(':/images/arrow_right_pressed'); +} +QScrollBar:right-arrow:disabled { + border-image: url(':/images/arrow_light_right_hover'); +} + +QDialog#HelpMessageDialog QScrollBar:vertical, +QDialog#HelpMessageDialog QScrollBar:horizontal { + border: 0; +} + + diff --git a/src/qt/res/css/light.css b/src/qt/res/css/light.css index e6b04c824c62..2dd90e45315d 100644 --- a/src/qt/res/css/light.css +++ b/src/qt/res/css/light.css @@ -464,7 +464,8 @@ QScrollBar ******************************************************/ /* Do NOT apply any styles to QScrollBar here, -* it's OS dependent and should be handled via platform specific code. +* it's OS dependent and should be handled via platform specific code at the +* end of the file. */ /****************************************************** @@ -793,12 +794,46 @@ be kept in mind when adding sections to avoid unexpected overwriting. ******************************************************* ******************************************************/ + - +/****************************************************** +QScrollBar +******************************************************/ -/* Example section to add styles for all operating systems - Remove any to exclude it. -*/ +QScrollBar::add-page, +QScrollBar::sub-page { + background-color: #f2f2f4; +} +QScrollBar::handle:vertical, +QScrollBar::handle:horizontal { + background-color: #dcdcdc; +} +QScrollBar:handle:horizontal:hover, +QScrollBar:handle:vertical:hover { + background-color: #d2d2d2; +} +QScrollBar:handle:horizontal:pressed, +QScrollBar:handle:vertical:pressed { + background-color: #c7c7c7; +} +QScrollBar::add-line:vertical, +QScrollBar::sub-line:vertical, +QScrollBar::add-line:horizontal, +QScrollBar::sub-line:horizontal { + background-color: #dcdcdc; +} +QScrollBar::add-line:vertical:hover, +QScrollBar::sub-line:vertical:hover, +QScrollBar::add-line:horizontal:hover, +QScrollBar::sub-line:horizontal:hover { + background-color: #d2d2d2; +} +QScrollBar::add-line:vertical:pressed, +QScrollBar::sub-line:vertical:pressed, +QScrollBar::add-line:horizontal:pressed, +QScrollBar::sub-line:horizontal:pressed { + background-color: #e0e0e0; +} From 44de8a93f235b7d67c1a154ba1fed2023899ad3a Mon Sep 17 00:00:00 2001 From: xdustinface Date: Thu, 18 Jun 2020 04:47:13 +0200 Subject: [PATCH 2/3] qt: Remove scrollbar.css and all its remaining mentions --- src/Makefile.qt.include | 1 - src/qt/dash.qrc | 1 - src/qt/guiutil.cpp | 3 +-- src/qt/res/css/general.css | 3 +-- 4 files changed, 2 insertions(+), 6 deletions(-) diff --git a/src/Makefile.qt.include b/src/Makefile.qt.include index b975e8161342..36cc1b17879b 100644 --- a/src/Makefile.qt.include +++ b/src/Makefile.qt.include @@ -352,7 +352,6 @@ RES_CSS = \ qt/res/css/dark.css \ qt/res/css/general.css \ qt/res/css/light.css \ - qt/res/css/scrollbars.css \ qt/res/css/traditional.css RES_FONTS = \ diff --git a/src/qt/dash.qrc b/src/qt/dash.qrc index 392e0ce6cf8c..4877def6f61a 100644 --- a/src/qt/dash.qrc +++ b/src/qt/dash.qrc @@ -56,7 +56,6 @@ res/css/general.css - res/css/scrollbars.css res/css/dark.css res/css/light.css res/css/traditional.css diff --git a/src/qt/guiutil.cpp b/src/qt/guiutil.cpp index 2eeafab82ad6..5d9c2c0bdbab 100644 --- a/src/qt/guiutil.cpp +++ b/src/qt/guiutil.cpp @@ -98,8 +98,7 @@ static const std::map mapStyleToTheme{ {"general.css", ""}, {"dark.css", "Dark"}, {"light.css", "Light"}, - {"traditional.css", "Traditional"}, - {"scrollbars.css", ""} + {"traditional.css", "Traditional"} }; /** Font related default values. */ diff --git a/src/qt/res/css/general.css b/src/qt/res/css/general.css index 9a4f7e874216..0a8a75c57da9 100644 --- a/src/qt/res/css/general.css +++ b/src/qt/res/css/general.css @@ -11,8 +11,7 @@ loaded and combined in `GUIUtil::loadStyleSheet()` in guitil.cpp. Hierarchy: * general.css - base layout: Loaded first if selected theme is not "Traditional" (traditional.css) -* scrollbars.css - custom scrollbars: Loaded second only for windows/linux if general.css is loaded -* - theme css file: Always loaded and loaded last. +* - theme css file: Always loaded last. To replace there are currently the following themes available: From 522357b04dc0494ab8e69791663bbb2915d8c1f6 Mon Sep 17 00:00:00 2001 From: xdustinface Date: Tue, 21 Jul 2020 16:17:39 +0200 Subject: [PATCH 3/3] qt: Run update-css-files.py --- src/qt/res/css/dark.css | 2 +- src/qt/res/css/general.css | 2 +- src/qt/res/css/light.css | 3 ++- src/qt/res/css/scrollbars.css | 2 +- src/qt/res/css/traditional.css | 2 +- 5 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/qt/res/css/dark.css b/src/qt/res/css/dark.css index 772ef71c1fe7..e9273bcee8a6 100644 --- a/src/qt/res/css/dark.css +++ b/src/qt/res/css/dark.css @@ -17,7 +17,7 @@ Loaded in GUIUtil::loadStyleSheet() in guitil.cpp. /* do not modify! section updated by update-css-files.py -# Used colors in dark.css for commit a50bd2371b +# Used colors in dark.css for commit 44de8a93f2 #00000000 #333 diff --git a/src/qt/res/css/general.css b/src/qt/res/css/general.css index 0a8a75c57da9..9a587b34bd4d 100644 --- a/src/qt/res/css/general.css +++ b/src/qt/res/css/general.css @@ -30,7 +30,7 @@ in the file. /* do not modify! section updated by update-css-files.py -# Used colors in general.css for commit a50bd2371b +# Used colors in general.css for commit 44de8a93f2 #00000000 #096e03 diff --git a/src/qt/res/css/light.css b/src/qt/res/css/light.css index 2dd90e45315d..7c5452db82d8 100644 --- a/src/qt/res/css/light.css +++ b/src/qt/res/css/light.css @@ -17,7 +17,7 @@ Loaded in GUIUtil::loadStyleSheet() in guitil.cpp. /* do not modify! section updated by update-css-files.py -# Used colors in light.css for commit a50bd2371b +# Used colors in light.css for commit 44de8a93f2 #00000000 #555 @@ -27,6 +27,7 @@ Loaded in GUIUtil::loadStyleSheet() in guitil.cpp. #c7c7c7 #d2d2d2 #dcdcdc +#e0e0e0 #eaeaec #f2f2f4 #ccfafafa diff --git a/src/qt/res/css/scrollbars.css b/src/qt/res/css/scrollbars.css index ee4033bbb635..3a89fbbb85f9 100644 --- a/src/qt/res/css/scrollbars.css +++ b/src/qt/res/css/scrollbars.css @@ -19,7 +19,7 @@ Loaded in GUIUtil::loadStyleSheet() in guitil.cpp. /* do not modify! section updated by update-css-files.py -# Used colors in scrollbars.css for commit a50bd2371b +# Used colors in scrollbars.css for commit 44de8a93f2 #e0e0e0 #f2f0f0 diff --git a/src/qt/res/css/traditional.css b/src/qt/res/css/traditional.css index 0fed15c2307b..1f76a28cb9e1 100644 --- a/src/qt/res/css/traditional.css +++ b/src/qt/res/css/traditional.css @@ -17,7 +17,7 @@ Loaded in GUIUtil::loadStyleSheet() in guitil.cpp. /* do not modify! section updated by update-css-files.py -# Used colors in traditional.css for commit a50bd2371b +# Used colors in traditional.css for commit 44de8a93f2 #00000000 #333