From 7d46cd91eddb66a596703f0ae3ed91c86fac1649 Mon Sep 17 00:00:00 2001 From: Kacper Donat Date: Sat, 12 Jul 2025 14:39:13 +0200 Subject: [PATCH 01/11] Gui: Rename FreeCAD_stylesheet.qss into FreeCAD.qss This removes redundant suffix from the file name. --- src/Gui/PreferencePacks/FreeCAD Dark/FreeCAD Dark.cfg | 2 +- src/Gui/PreferencePacks/FreeCAD Light/FreeCAD Light.cfg | 2 +- src/Gui/Stylesheets/CMakeLists.txt | 2 +- src/Gui/Stylesheets/{FreeCAD_stylesheet.qss => FreeCAD.qss} | 0 4 files changed, 3 insertions(+), 3 deletions(-) rename src/Gui/Stylesheets/{FreeCAD_stylesheet.qss => FreeCAD.qss} (100%) diff --git a/src/Gui/PreferencePacks/FreeCAD Dark/FreeCAD Dark.cfg b/src/Gui/PreferencePacks/FreeCAD Dark/FreeCAD Dark.cfg index 98e84bd4dc..f92cba7bdb 100644 --- a/src/Gui/PreferencePacks/FreeCAD Dark/FreeCAD Dark.cfg +++ b/src/Gui/PreferencePacks/FreeCAD Dark/FreeCAD Dark.cfg @@ -26,7 +26,7 @@ Freecad Overlay.qss Fusion - FreeCAD_Stylesheet.qss + FreeCAD.qss FreeCAD Dark diff --git a/src/Gui/PreferencePacks/FreeCAD Light/FreeCAD Light.cfg b/src/Gui/PreferencePacks/FreeCAD Light/FreeCAD Light.cfg index 555dba0571..9a293939f8 100644 --- a/src/Gui/PreferencePacks/FreeCAD Light/FreeCAD Light.cfg +++ b/src/Gui/PreferencePacks/FreeCAD Light/FreeCAD Light.cfg @@ -23,7 +23,7 @@ Freecad Overlay.qss Fusion - FreeCAD_Stylesheet.qss + FreeCAD.qss FreeCAD Light diff --git a/src/Gui/Stylesheets/CMakeLists.txt b/src/Gui/Stylesheets/CMakeLists.txt index be101899ec..7cfec3716f 100644 --- a/src/Gui/Stylesheets/CMakeLists.txt +++ b/src/Gui/Stylesheets/CMakeLists.txt @@ -1,6 +1,6 @@ SET(Stylesheets_Files - "FreeCAD_stylesheet.qss" + "FreeCAD.qss" #remove below after testing new stylesheet system 8/6/2025 "FreeCAD Dark.qss" "FreeCAD Light.qss" diff --git a/src/Gui/Stylesheets/FreeCAD_stylesheet.qss b/src/Gui/Stylesheets/FreeCAD.qss similarity index 100% rename from src/Gui/Stylesheets/FreeCAD_stylesheet.qss rename to src/Gui/Stylesheets/FreeCAD.qss From 00b9b0e61e0c40e591bc67f793f75655de1f9aa4 Mon Sep 17 00:00:00 2001 From: Kacper Donat Date: Sat, 12 Jul 2025 14:41:37 +0200 Subject: [PATCH 02/11] Stylesheets: Remove padding and marign resets. Setting margins and padding to 0 on * disables margins supplied by the QStyle. That was required when QStyle was not enforced but now it can cause trouble. --- src/Gui/Stylesheets/FreeCAD.qss | 69 +-------------------------------- 1 file changed, 2 insertions(+), 67 deletions(-) diff --git a/src/Gui/Stylesheets/FreeCAD.qss b/src/Gui/Stylesheets/FreeCAD.qss index 904f1f3327..e58f6dbf7a 100644 --- a/src/Gui/Stylesheets/FreeCAD.qss +++ b/src/Gui/Stylesheets/FreeCAD.qss @@ -71,19 +71,16 @@ Resetting everything helps to unify styles across different operating systems --------------------------------------------------------------------------- */ * { - padding: 0px; - margin: 0px; border-style: none; border-image: none; border-radius: 0px; border-color: @GeneralBorderColor; border-style: none; outline: none; - color:@TextForegroundColor; + color: @TextForegroundColor; selection-background-color: @TextSelectBackgroundColor; - selection-color:@TextForegroundColor; + selection-color: @TextForegroundColor; gridline-color: @GeneralGridLinesColor; - spacing: 0px; } /* specific reset for elements inside QToolBar */ @@ -2083,39 +2080,6 @@ https://doc.qt.io/qt-5/stylesheet-examples.html#customizing-qtableview --------------------------------------------------------------------------- */ -QTreeView { - qproperty-indentation: 10; - selection-background-color: transparent; -} - -QTreeView::branch { - background-color: transparent; -} - -QTreeView::branch:has-siblings:!adjoins-item {} - -QTreeView::branch:has-siblings:adjoins-item {} -QTreeView::branch:!has-children:!has-siblings:adjoins-item {} -QTreeView::branch:closed:has-children:has-siblings { - border-image: none; - image: url(qss:@IconsLocationFolderName/arrow-right-@StylesheetIconsColor.svg); -} - -QTreeView::branch:has-children:!has-siblings:closed { - border-image: none; - image: url(qss:@IconsLocationFolderName/arrow-right-@StylesheetIconsColor.svg); -} - -QTreeView::branch:open:has-children:has-siblings { - border-image: none; - image: url(qss:@IconsLocationFolderName/arrow-down-@StylesheetIconsColor.svg); -} - -QTreeView::branch:open:has-children:!has-siblings { - border-image: none; - image: url(qss:@IconsLocationFolderName/arrow-down-@StylesheetIconsColor.svg); -} - QTreeView::indicator, QListView::indicator, QTableView::indicator, @@ -2608,35 +2572,6 @@ QMdiSubWindow:active { border:2px solid @UserHighlight1Color; } -/*================================================================================================== -Settings menu #groupsTreeView: -==================================================================================================*/ - -QTreeView::branch#groupsTreeView:closed:has-children:has-siblings { - border-image: none; - image: url(qss:@IconsLocationFolderName/arrow-right-@StylesheetIconsColor.svg); -} - -QTreeView::branch#groupsTreeView:open:has-children:has-siblings { - border-image: none; - image: url(qss:@IconsLocationFolderName/arrow-down-@StylesheetIconsColor.svg); -} - -QTreeView::branch#groupsTreeView:open:has-children:!has-siblings { - - border-image: none; - image: url(qss:@IconsLocationFolderName/arrow-down-@StylesheetIconsColor.svg); -} - -QTreeView::branch#groupsTreeView:has-children:!has-siblings:closed { - border-image: none; - image: url(qss:@IconsLocationFolderName/arrow-right-@StylesheetIconsColor.svg); -} - -QTreeView::branch#groupsTreeView:has-siblings:!adjoins-item { - border-image: none; -} - /*================================================================================================== Start page ==================================================================================================*/ From d4d3afb7dfacbe2e400b8f10464fcca9f4bb861a Mon Sep 17 00:00:00 2001 From: Kacper Donat Date: Sat, 12 Jul 2025 15:15:35 +0200 Subject: [PATCH 03/11] Stylesheets: Remove QTabBar color inconsistencies --- src/Gui/Stylesheets/FreeCAD.qss | 38 +++++++++++++-------------------- 1 file changed, 15 insertions(+), 23 deletions(-) diff --git a/src/Gui/Stylesheets/FreeCAD.qss b/src/Gui/Stylesheets/FreeCAD.qss index e58f6dbf7a..32319a9403 100644 --- a/src/Gui/Stylesheets/FreeCAD.qss +++ b/src/Gui/Stylesheets/FreeCAD.qss @@ -115,12 +115,6 @@ Gui--NavigationIndicatorGui--BlenderNavigationStyle { qproperty-icon: url(:/icons/icons/NavigationBlender_light.svg); } -Gui--MDIView QFrame{ - border-top: 3px solid qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 @GeneralBorderColor, stop:1 transparent); - border-left: 3px solid qlineargradient(x1:0, y1:0, x2:1, y2:0, stop:0 @GeneralBorderColor stop:1 transparent); - border-right: 3px solid qlineargradient(x1:0, y1:0, x2:1, y2:0, stop:0 transparent, stop:1 @GeneralBorderColor); -} - Gui--MDIView QLabel{ border-style: none; background-color: transparent; @@ -1164,8 +1158,8 @@ QPushButton { background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 @ButtonTopBackgroundColor,stop:1 @ButtonBottomBackgroundColor); border: 1px solid @ButtonBorderColor; border-radius: @InputFieldBorderRadius; - padding: 3px 12px; - min-width: 40px;} + padding: 3px 12px; +} #CreateNewRow > QPushButton { /* Reset min width to default */ @@ -1216,11 +1210,6 @@ QPushButton::menu-indicator { bottom: 4px; } -QDialogButtonBox QPushButton { - min-width: 80px; - padding: 3px 0px; -} - /* QToolButton ------------------------------------------------------------ https://doc.qt.io/qt-5/stylesheet-examples.html#customizing-qtoolbutton @@ -1516,7 +1505,6 @@ QSint--ActionGroup QFrame[class="header"] QLabel[fold="true"]:hover { QSint--ActionGroup QFrame[class="content"] { background-color: @DialogBackgroundColor;/* Task Panel background color */ - border-bottom: 1px solid @GeneralBorderColor; border-left: 1px solid @GeneralBorderColor; border-right: 1px solid @GeneralBorderColor; @@ -1787,9 +1775,13 @@ QDockWidget QTabBar { /*tabbar in dockwidget */ qproperty-drawBase: 0; } +QTabBar#mdiAreaTabBar::tab:bottom:selected { + background-color: @3DViewBackgroundRefColor; + border-top: @3DViewBackgroundRefColor; +} + QTabBar { qproperty-drawBase: 1;/*tabbar for files. */ - background-color: @TabbarBackgroundColor; } QTabWidget::tab-bar { @@ -1874,9 +1866,9 @@ QTabBar::tab:top, QDockWidget QTabBar::tab:top { } QTabBar::tab:top:selected, QDockWidget QTabBar::tab:top:selected { - background-color: @3DViewBackgroundRefColor; + background-color: @GeneralBackgroundColor; border-top: 1px solid @GeneralBorderColor; - border-bottom: 1px solid @3DViewBackgroundRefColor; + border-bottom: 1px solid @GeneralBackgroundColor; border-left: 1px solid @GeneralBorderColor; border-right: 1px solid @GeneralBorderColor; margin-top: 0px; @@ -1905,9 +1897,9 @@ QTabBar::tab:bottom, QDockWidget QTabBar::tab:bottom { } QTabBar::tab:bottom:selected, QDockWidget QTabBar::tab:bottom:selected { - background-color: @3DViewBackgroundRefColor; + background-color: @GeneralBackgroundColor; border-bottom: 1px solid @GeneralBorderColor; - border-top: 1px solid @3DViewBackgroundRefColor; + border-top: 1px solid @GeneralBackgroundColor; border-left: 1px solid @GeneralBorderColor; border-right: 1px solid @GeneralBorderColor; margin-bottom: 0px; @@ -1936,9 +1928,9 @@ QTabBar::tab:left, QDockWidget QTabBar::tab:left { } QTabBar::tab:left:selected, QDockWidget QTabBar::tab:left:selected { - background-color: @3DViewBackgroundRefColor; + background-color: @GeneralBackgroundColor; border-bottom: 1px solid @GeneralBorderColor; - border-right: 1px solid @3DViewBackgroundRefColor; + border-right: 1px solid @GeneralBackgroundColor; border-left: 1px solid @GeneralBorderColor; border-top: 1px solid @GeneralBorderColor; margin-left: 0px; @@ -1966,9 +1958,9 @@ QTabBar::tab:right, QDockWidget QTabBar::tab:right { } QTabBar::tab:right:selected, QDockWidget QTabBar::tab:right:selected { - background-color: @3DViewBackgroundRefColor; + background-color: @GeneralBackgroundColor; border-bottom: 1px solid @GeneralBorderColor; - border-left: 1px solid @3DViewBackgroundRefColor; + border-left: 1px solid @GeneralBackgroundColor; border-left: 1px solid @GeneralBorderColor; border-top: 1px solid @GeneralBorderColor; margin-right: 0px; From 58634f3ef4014e89671ac032615f7fdfd5d4c8b4 Mon Sep 17 00:00:00 2001 From: Kacper Donat Date: Sat, 12 Jul 2025 19:19:52 +0200 Subject: [PATCH 04/11] Stylesheets: Unify border on ScrollBars --- src/Gui/Stylesheets/FreeCAD.qss | 148 +++++++++++++++----------------- 1 file changed, 67 insertions(+), 81 deletions(-) diff --git a/src/Gui/Stylesheets/FreeCAD.qss b/src/Gui/Stylesheets/FreeCAD.qss index 32319a9403..a815f60978 100644 --- a/src/Gui/Stylesheets/FreeCAD.qss +++ b/src/Gui/Stylesheets/FreeCAD.qss @@ -127,10 +127,6 @@ Gui--MDIView QScrollArea{ This causes much load time. DONT USE "QWidget { " This causes a lot of lag. */ -/* QWidget::item:selected { - background-color: @UserHighlight1Color; -} - */ @@ -662,19 +658,23 @@ https://doc.qt.io/qt-5/stylesheet-examples.html#customizing-qscrollbar --------------------------------------------------------------------------- */ QScrollBar:horizontal { - border-right: 14px solid qlineargradient(x1:0, y1:0, x2:1, y2:0, stop:0 @ScrollbarBackgroundColor, stop:0.1 @ButtonTopBackgroundColor , stop:0.9 @ButtonTopBackgroundColor , stop:1 @ScrollbarBackgroundColor); - border-left: 14px solid qlineargradient(x1:1, y1:0, x2:0, y2:0, stop:0 @ScrollbarBackgroundColor, stop:0.1 @ButtonTopBackgroundColor , stop:0.9 @ButtonTopBackgroundColor , stop:1 @ScrollbarBackgroundColor); + border-right: 14px solid @GeneralBorderColor; + border-left: 14px solid @GeneralBorderColor; border-top: 1px solid @GeneralBorderColor; border-bottom: 1px solid @GeneralBorderColor; background-color: @ScrollbarBackgroundColor; + padding: 0; + margin: 0; } QScrollBar:vertical { - border-top: 14px solid qlineargradient(x1:0, y1:1, x2:0, y2:0, stop:0 @ScrollbarBackgroundColor, stop:0.1 @ButtonTopBackgroundColor , stop:0.9 @ButtonTopBackgroundColor , stop:1 @ScrollbarBackgroundColor); - border-bottom: 14px solid qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 @ScrollbarBackgroundColor, stop:0.1 @ButtonTopBackgroundColor , stop:0.9 @ButtonTopBackgroundColor , stop:1 @ScrollbarBackgroundColor); + border-top: 14px solid @GeneralBorderColor; + border-bottom: 14px solid @GeneralBorderColor; border-left: 1px solid @GeneralBorderColor; border-right: 1px solid @GeneralBorderColor; background-color: @ScrollbarBackgroundColor; + padding: 0; + margin: 0; } QScrollBar::handle:horizontal { @@ -701,79 +701,80 @@ QScrollBar::handle:vertical { background-color: qlineargradient(x1:0, y1:0, x2:1, y2:0, stop:0 @ButtonTopBackgroundColor, stop:1 @ButtonBottomBackgroundColor); } -QScrollBar::handle:vertical:hover { - background-color: @GeneralBackgroundHoverColor; - border: 1px @ButtonTopBackgroundColor; -} - QScrollBar::handle:vertical:focus { border: 1px solid @UserHighlight1Color; } -QScrollBar::add-line:horizontal { - margin: 0px 2px 0px 2px; - border-image: url(qss:@IconsLocationFolderName/arrow-right-lightgray.svg); - height: 10px; - width: 10px; - subcontrol-position: right; +QScrollBar::add-line, QScrollBar::sub-line { + height: 12px; + width: 12px; subcontrol-origin: margin; + border: 1px solid @GeneralBorderColor; } -QScrollBar::add-line:horizontal:hover, QScrollBar::add-line:horizontal:on { - border-image: url(qss:@IconsLocationFolderName/arrow-right-@StylesheetIconsColor.svg); +QScrollBar::handle:hover, +QScrollBar::add-line:vertical:hover, QScrollBar::sub-line:vertical:hover , +QScrollBar::add-line:horizontal:hover, QScrollBar::sub-line:horizontal:hover { + background-color: @GeneralBackgroundHoverColor; } -QScrollBar::add-line:vertical { - margin: 2px 0px 2px 0px; - border-image: url(qss:@IconsLocationFolderName/arrow-down-lightgray.svg); - height: 10px; - width: 10px; - subcontrol-position: bottom; - subcontrol-origin: margin; +QScrollBar::right-arrow, QScrollbar::left-arrow, QScrollBar::up-arrow, QScrollBar::down-arrow { + margin: 2px; } -QScrollBar::add-line:vertical:hover, QScrollBar::add-line:vertical:on { - image: url(qss:@IconsLocationFolderName/arrow-down-@StylesheetIconsColor.svg); -} - -QScrollBar::sub-line:horizontal { - margin: 0px 2px 0px 2px; +QScrollBar::left-arrow { border-image: url(qss:@IconsLocationFolderName/arrow-left-lightgray.svg); - height: 10px; - width: 10px; - subcontrol-position: left; - subcontrol-origin: margin; } -QScrollBar::sub-line:horizontal:hover, QScrollBar::sub-line:horizontal:on { +QScrollBar::right-arrow { + border-image: url(qss:@IconsLocationFolderName/arrow-right-lightgray.svg); +} + +QScrollBar::up-arrow { + border-image: url(qss:@IconsLocationFolderName/arrow-up-lightgray.svg); +} + +QScrollBar::down-arrow { + border-image: url(qss:@IconsLocationFolderName/arrow-down-lightgray.svg); +} + +QScrollBar::left-arrow:hover { border-image: url(qss:@IconsLocationFolderName/arrow-left-@StylesheetIconsColor.svg); } -QScrollBar::sub-line:vertical { - margin: 2px 0px 2px 0px; - border-image: url(qss:@IconsLocationFolderName/arrow-up-lightgray.svg); - height: 10px; - width: 10px; - subcontrol-position: top; - subcontrol-origin: margin; +QScrollBar::right-arrow:hover { + border-image: url(qss:@IconsLocationFolderName/arrow-right-@StylesheetIconsColor.svg); } -QScrollBar::sub-line:vertical:hover, QScrollBar::sub-line:vertical:on { +QScrollBar::up-arrow:hover { border-image: url(qss:@IconsLocationFolderName/arrow-up-@StylesheetIconsColor.svg); } -QScrollBar::up-arrow:horizontal, QScrollBar::down-arrow:horizontal { - background-color: none; +QScrollBar::down-arrow:hover { + border-image: url(qss:@IconsLocationFolderName/arrow-down-@StylesheetIconsColor.svg); } -QScrollBar::up-arrow:vertical, QScrollBar::down-arrow:vertical { - background-color: none; +QScrollBar::add-line:horizontal { + background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 @ButtonTopBackgroundColor, stop:1 @ButtonBottomBackgroundColor); + subcontrol-position: right; } -QScrollBar::add-page:horizontal, QScrollBar::sub-page:horizontal { - background-color: none; +QScrollBar::add-line:vertical { + background-color: qlineargradient(x1:0, y1:0, x2:1, y2:0, stop:0 @ButtonTopBackgroundColor, stop:1 @ButtonBottomBackgroundColor); + subcontrol-position: bottom; } +QScrollBar::sub-line:horizontal { + background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 @ButtonTopBackgroundColor, stop:1 @ButtonBottomBackgroundColor); + subcontrol-position: left; +} + +QScrollBar::sub-line:vertical { + background-color: qlineargradient(x1:0, y1:0, x2:1, y2:0, stop:0 @ButtonTopBackgroundColor, stop:1 @ButtonBottomBackgroundColor); + subcontrol-position: top; +} + +QScrollBar::add-page:horizontal, QScrollBar::sub-page:horizontal, QScrollBar::add-page:vertical, QScrollBar::sub-page:vertical { background-color: none; } @@ -1435,7 +1436,7 @@ QComboBox::down-arrow:on, QComboBox::down-arrow:hover, QComboBox::down-arrow:foc Tasks panel (custom FreeCAD class) ==================================================================================================*/ Gui--PropertyEditor--PropertyEditor { - qproperty-groupTextColor:@TextForegroundColor; + qproperty-groupTextColor: @TextForegroundColor; qproperty-groupBackground: @GeneralAlternateBackgroundColor; } @@ -1685,7 +1686,7 @@ QSlider::handle:vertical:focus { https://doc.qt.io/qt-5/stylesheet-examples.html#customizing-qlineedit --------------------------------------------------------------------------- */ -QLineEdit { +QLineEdit, QTextEdit { background-color: @TextEditFieldBackgroundColor; padding-top: 2px; padding-bottom: 2px; @@ -1696,20 +1697,16 @@ QLineEdit { border-radius: @InputFieldBorderRadius; } -QLineEdit:disabled { +QLineEdit:disabled, QTextEdit:disabled { background-color: @GeneralDisabledBackgroundColor; color @TextDisabledColor; } -QLineEdit:hover { - +QLineEdit:focus, QTextEdit:focus { + border: 1px solid @UserHighlight1Color; } -QLineEdit:focus { - border: 2px solid @UserHighlight1Color; -} - -QLineEdit:selected { +QLineEdit:selected, QTextEdit:selected { background-color: @GeneralBackgroundHoverColor; } @@ -1724,6 +1721,7 @@ QTabWidget { } QTabWidget:tab-bar { + background-color: transparent; } QTabWidget QWidget {} @@ -2159,16 +2157,14 @@ QColumnView { background-color: @PrimaryColor;/* background of a lot of stuff including spreadsheets.*/ /* gridline-color: @GeneralBorderColor; */ alternate-background-color: @GeneralAlternateBackgroundColor; - selection-background-color: @UserHighlight1Color; - + selection-background-color: @UserHighlight1Color; } QListView { background-color: @PrimaryColor; border: 1px solid @GeneralBorderColor; alternate-background-color: @GeneralAlternateBackgroundColor; - selection-background-color: @UserHighlight1Color; - + selection-background-color: @UserHighlight1Color; } QTreeView:disabled, @@ -2197,16 +2193,10 @@ QColumnView::item:pressed { background-color: @GeneralBackgroundHoverColor; } -QListView::item:selected:active, -QTableView::item:selected:active, -QColumnView::item:selected:active { - background-color: @UserHighlight1Color; -} - -QListView::item:selected:!active, -QTableView::item:selected:!active, -QColumnView::item:selected:!active { - background-color: @GeneralBackgroundHoverColor; +QListView::item:selected +QTableView::item:selected +QColumnView::item:selected { + background-color: @PrimaryColor; } /* QTreeView::item:!selected:hover, */ @@ -2216,10 +2206,6 @@ QColumnView::item:!selected:hover { background-color: @GeneralBackgroundHoverColor; } -QTreeView::item:selected:!active{ - background-color: @GeneralBackgroundHoverColor; -} - QTreeView::item:!selected:hover{ outline: 0; color:@TextForegroundColor; From e05258ad7e1d01e42d7a4d5eaa4778df2710c872 Mon Sep 17 00:00:00 2001 From: Kacper Donat Date: Sat, 12 Jul 2025 20:23:03 +0200 Subject: [PATCH 05/11] Build: Fix built-in copying PreferencePacks --- src/Gui/PreferencePacks/CMakeLists.txt | 33 ++++++++++++++------------ 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/src/Gui/PreferencePacks/CMakeLists.txt b/src/Gui/PreferencePacks/CMakeLists.txt index e4685e9251..1d704c8f70 100644 --- a/src/Gui/PreferencePacks/CMakeLists.txt +++ b/src/Gui/PreferencePacks/CMakeLists.txt @@ -1,31 +1,34 @@ - SET(PreferencePacks_Files -"package.xml" + "package.xml" ) SET(PreferencePacks_Directories -"FreeCAD Classic" -"Dark behave" -"FreeCAD Light" -"FreeCAD Dark" + "FreeCAD Classic" + "Dark behave" + "FreeCAD Light" + "FreeCAD Dark" ) ADD_CUSTOM_TARGET(PreferencePacks_data ALL -SOURCES ${PreferencePacks_Files} ${PreferencePacks_Directories} + SOURCES ${PreferencePacks_Files} ${PreferencePacks_Directories} ) FILE(COPY ${PreferencePacks_Files} ${PreferencePacks_Directories} DESTINATION "${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_DATADIR}/Gui/PreferencePacks") +fc_copy_sources(PreferencePacks_data "${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_DATADIR}/Gui/PreferencePacks" + ${PreferencePacks_Files} + ${PreferencePacks_Directories}) + INSTALL( -FILES - ${PreferencePacks_Files} -DESTINATION - ${CMAKE_INSTALL_DATADIR}/Gui/PreferencePacks + FILES + ${PreferencePacks_Files} + DESTINATION + ${CMAKE_INSTALL_DATADIR}/Gui/PreferencePacks ) INSTALL( -DIRECTORY - ${PreferencePacks_Directories} -DESTINATION - ${CMAKE_INSTALL_DATADIR}/Gui/PreferencePacks + DIRECTORY + ${PreferencePacks_Directories} + DESTINATION + ${CMAKE_INSTALL_DATADIR}/Gui/PreferencePacks ) \ No newline at end of file From 58349460e74df581532b52a507c388a0d6960388 Mon Sep 17 00:00:00 2001 From: Kacper Donat Date: Sat, 12 Jul 2025 20:23:43 +0200 Subject: [PATCH 06/11] Gui: Add blend function to style parameters --- src/Gui/StyleParameters/Parser.cpp | 99 ++++++++++++++++++++++-------- 1 file changed, 75 insertions(+), 24 deletions(-) diff --git a/src/Gui/StyleParameters/Parser.cpp b/src/Gui/StyleParameters/Parser.cpp index dbcb52f27a..5f4855a82f 100644 --- a/src/Gui/StyleParameters/Parser.cpp +++ b/src/Gui/StyleParameters/Parser.cpp @@ -26,6 +26,8 @@ #include "Parser.h" #include "ParameterManager.h" +#include + #ifndef _PreComp_ #include #include @@ -54,36 +56,85 @@ Value Color::evaluate([[maybe_unused]] const EvaluationContext& context) const Value FunctionCall::evaluate(const EvaluationContext& context) const { - if (arguments.size() != 2) { - THROWM(Base::ExpressionError, - fmt::format("Function '{}' expects 2 arguments, got {}", - functionName, - arguments.size())); - } + const auto lightenOrDarken = [this](const EvaluationContext& context) -> Value { + if (arguments.size() != 2) { + THROWM(Base::ExpressionError, + fmt::format("Function '{}' expects 2 arguments, got {}", + functionName, + arguments.size())); + } - auto colorArg = arguments[0]->evaluate(context); - auto amountArg = arguments[1]->evaluate(context); + auto colorArg = arguments[0]->evaluate(context); + auto amountArg = arguments[1]->evaluate(context); - if (!std::holds_alternative(colorArg)) { - THROWM(Base::ExpressionError, - fmt::format("'{}' is not supported for colors", functionName)); - } + if (!std::holds_alternative(colorArg)) { + THROWM(Base::ExpressionError, + fmt::format("'{}' is not supported for colors", functionName)); + } - auto color = std::get(colorArg); + auto color = std::get(colorArg); - // In Qt if you want to make color 20% darker or lighter, you need to pass 120 as the value - // we, however, want users to pass only the relative difference, hence we need to add the - // 100 required by Qt. - // - // NOLINTNEXTLINE(*-magic-numbers) - auto amount = 100 + static_cast(std::get(amountArg).value); + // In Qt if you want to make color 20% darker or lighter, you need to pass 120 as the value + // we, however, want users to pass only the relative difference, hence we need to add the + // 100 required by Qt. + // + // NOLINTNEXTLINE(*-magic-numbers) + auto amount = 100 + static_cast(std::get(amountArg).value); - if (functionName == "lighten") { - return color.lighter(amount); - } + if (functionName == "lighten") { + return color.lighter(amount); + } - if (functionName == "darken") { - return color.darker(amount); + if (functionName == "darken") { + return color.darker(amount); + } + + return {}; + }; + + const auto blend = [this](const EvaluationContext& context) -> Value { + if (arguments.size() != 3) { + THROWM(Base::ExpressionError, + fmt::format("Function '{}' expects 3 arguments, got {}", + functionName, + arguments.size())); + } + + auto firstColorArg = arguments[0]->evaluate(context); + auto secondColorArg = arguments[1]->evaluate(context); + auto amountArg = arguments[2]->evaluate(context); + + if (!std::holds_alternative(firstColorArg)) { + THROWM(Base::ExpressionError, + fmt::format("first argument of '{}' must be color", functionName)); + } + + if (!std::holds_alternative(secondColorArg)) { + THROWM(Base::ExpressionError, + fmt::format("second argument of '{}' must be color", functionName)); + } + + auto firstColor = std::get(firstColorArg); + auto secondColor = std::get(secondColorArg); + + auto amount = Base::fromPercent(std::get(amountArg).value); + + return QColor::fromRgbF( + (1 - amount) * firstColor.redF() + amount * secondColor.redF(), + (1 - amount) * firstColor.greenF() + amount * secondColor.greenF(), + (1 - amount) * firstColor.blueF() + amount * secondColor.blueF() + ); + }; + + std::map> functions = { + {"lighten", lightenOrDarken}, + {"darken", lightenOrDarken}, + {"blend", blend}, + }; + + if (functions.contains(functionName)) { + auto function = functions.at(functionName); + return function(context); } THROWM(Base::ExpressionError, fmt::format("Unknown function '{}'", functionName)); From d935dc3aa52ec3108591415eddc8c9387c81052d Mon Sep 17 00:00:00 2001 From: Kacper Donat Date: Sat, 12 Jul 2025 20:40:42 +0200 Subject: [PATCH 07/11] Stylesheets: Properly utilize AccentColor --- .../FreeCAD Dark/FreeCAD Dark.cfg | 7 +- .../FreeCAD Light/FreeCAD Light.cfg | 8 +- src/Gui/PreferencePacks/package.xml | 6 +- src/Gui/Stylesheets/FreeCAD.qss | 119 +++++++++--------- 4 files changed, 72 insertions(+), 68 deletions(-) diff --git a/src/Gui/PreferencePacks/FreeCAD Dark/FreeCAD Dark.cfg b/src/Gui/PreferencePacks/FreeCAD Dark/FreeCAD Dark.cfg index f92cba7bdb..3e1ca8d193 100644 --- a/src/Gui/PreferencePacks/FreeCAD Dark/FreeCAD Dark.cfg +++ b/src/Gui/PreferencePacks/FreeCAD Dark/FreeCAD Dark.cfg @@ -155,11 +155,12 @@ darken(@TextForegroundColor,40) @PrimaryColor #ffffff - darken(@UserHighlight1Color,100) + darken(@AccentColor,100) #0095ff 2px - @ThemeAccentColor1 - @ThemeAccentColor2 + @ThemeAccentColor1 + blend(@GeneralBackgroundColor,@AccentColor,60) + blend(@GeneralBackgroundHoverColor,@AccentColor,30) diff --git a/src/Gui/PreferencePacks/FreeCAD Light/FreeCAD Light.cfg b/src/Gui/PreferencePacks/FreeCAD Light/FreeCAD Light.cfg index 9a293939f8..32e73153db 100644 --- a/src/Gui/PreferencePacks/FreeCAD Light/FreeCAD Light.cfg +++ b/src/Gui/PreferencePacks/FreeCAD Light/FreeCAD Light.cfg @@ -170,11 +170,11 @@ lighten(@TextForegroundColor,40) @PrimaryColorLighten3 #000000 - lighten(@UserHighlight1Color,50) + @AccentHoverColor #0061a7 - 2px - @ThemeAccentColor1 - @ThemeAccentColor2 + @ThemeAccentColor1 + blend(@GeneralBackgroundColor,@AccentColor,60) + blend(@GeneralBackgroundHoverColor,@AccentColor,30) diff --git a/src/Gui/PreferencePacks/package.xml b/src/Gui/PreferencePacks/package.xml index 2746d44981..3ecbc6b807 100644 --- a/src/Gui/PreferencePacks/package.xml +++ b/src/Gui/PreferencePacks/package.xml @@ -6,7 +6,6 @@ MisterMaker LGPL2 https://github.com/FreeCAD/FreeCAD - FreeCAD Classic @@ -25,7 +24,7 @@ 1.0.0 built-in background - light + light FreeCAD Dark @@ -34,8 +33,7 @@ 1.0.0 built-in background - dark + dark - diff --git a/src/Gui/Stylesheets/FreeCAD.qss b/src/Gui/Stylesheets/FreeCAD.qss index a815f60978..6bf961fed1 100644 --- a/src/Gui/Stylesheets/FreeCAD.qss +++ b/src/Gui/Stylesheets/FreeCAD.qss @@ -25,7 +25,7 @@ INSTALLATION WHEN NECESSARY FOLLOWING CODES ARE CHANGED IN THE SETTINGS: @PrimaryColor -@UserHighlight1Color +@AccentColor @GeneralAlternateBackgroundColor @GeneralBackgroundColor @GeneralBorderColor @@ -88,7 +88,7 @@ QToolBar * {}/*hacks */ /* fix for column items background when a link is present */ Gui--PropertyEditor--PropertyEditor > QWidget > QFrame:focus { - background-color: @UserHighlight1Color;/* same as focused background color */} + background-color: @AccentColor;/* same as focused background color */} /* hack to hide weird redundant information inside cells with links and no editable data (but editable via "..." button) */ Gui--PropertyEditor--PropertyEditor > QWidget > QWidget > QLabel { background-color: @TextUrlColor;/* same as focused background color */ @@ -145,7 +145,7 @@ QColorDialog QLabel { /* Causes issue with colorselector. QWidget::item:hover:!selected { - background-color: @UserHighlight1Color; + background-color: @AccentColor; } */ @@ -243,7 +243,7 @@ QCheckBox { } QCheckBox:focus { - border: 1px solid @UserHighlight1Color; + border: 1px solid @AccentColor; } QCheckBox QWidget:disabled { @@ -343,7 +343,7 @@ QGroupBox::indicator:unchecked:hover { } QGroupBox::indicator:unchecked:focus { - border: 1px solid @UserHighlight1Color; + border: 1px solid @AccentColor; } QGroupBox::indicator:unchecked:disabled { @@ -363,7 +363,7 @@ QGroupBox::indicator:checked:hover { } QGroupBox::indicator:checked:focus { - border: 1px solid @UserHighlight1Color; + border: 1px solid @AccentColor; } QGroupBox::indicator:checked:disabled { @@ -387,7 +387,7 @@ QRadioButton { } QRadioButton:focus { - border: 1px solid @UserHighlight1Color; + border: 1px solid @AccentColor; } QRadioButton:disabled { @@ -459,7 +459,7 @@ QMenuBar::item:disabled{ } QMenuBar:focus { - border: 1px solid @UserHighlight1Color; + border: 1px solid @AccentColor; } QMenuBar::item { @@ -470,12 +470,12 @@ QMenuBar::item { QMenuBar::item:selected { background-color: transparent; border-style: none; - background-color: @GeneralBackgroundHoverColor; + background-color: @AccentBackgroundColor; } QMenuBar::item:pressed { border-style: none; - background-color: @GeneralBackgroundHoverColor; + background-color: @AccentBackgroundColor; } /* QMenu ------------------------------------------------------------------ @@ -508,11 +508,11 @@ QMenu::item { /* Reserve space for selection border */} QMenu::item:selected { - background-color: @GeneralBackgroundHoverColor; + background-color: @AccentBackgroundColor; } QMenu::item:pressed { - background-color: @GeneralBackgroundHoverColor; + background-color: @AccentBackgroundColor; } QMenu::icon { @@ -529,9 +529,9 @@ QMenu::indicator { /* non-exclusive indicator = check box style indicator (see QActionGroup::setExclusive) */ /* exclusive indicator = radio button style indicator (see QActionGroup::setExclusive) */} QMenu::icon:checked { /* appearance of a 'checked' icon */ - background-color: @UserHighlight1Color; + background-color: @AccentColor; margin-left: -5px; - border: 5px solid @UserHighlight1Color; + border: 5px solid @AccentColor; position: absolute; } @@ -690,7 +690,7 @@ QScrollBar::handle:horizontal:hover { } QScrollBar::handle:horizontal:focus { - border: 1px solid @UserHighlight1Color; + border: 1px solid @AccentColor; } QScrollBar::handle:vertical { @@ -702,7 +702,7 @@ QScrollBar::handle:vertical { } QScrollBar::handle:vertical:focus { - border: 1px solid @UserHighlight1Color; + border: 1px solid @AccentColor; } QScrollBar::add-line, QScrollBar::sub-line { @@ -791,11 +791,11 @@ QTextEdit { } QTextEdit:focus { - border-top: 2px solid @UserHighlight1Color; + border-top: 2px solid @AccentColor; } QTextEdit:selected { - background-color: @UserHighlight1Color; + background-color: @AccentColor; } /* QPlainTextEdit --------------------------------------------------------- @@ -809,7 +809,7 @@ QPlainTextEdit { } QPlainTextEdit:focus { - border: 1px solid @UserHighlight1Color; + border: 1px solid @AccentColor; } QPlainTextEdit:selected { @@ -1029,7 +1029,7 @@ QAbstractSpinBox:disabled { QAbstractSpinBox:hover {} QAbstractSpinBox:focus { - border: 1px solid @UserHighlight1Color; + border: 1px solid @AccentColor; } QAbstractSpinBox:selected { @@ -1137,7 +1137,7 @@ QProgressBar:disabled { } QProgressBar::chunk { - background-color: @UserHighlight1Color; + background-color: @AccentColor; color: @PrimaryColor; border-radius: @InputFieldBorderRadius; } @@ -1179,18 +1179,18 @@ QPushButton:checked { } QPushButton:focus { - border: 1px solid @UserHighlight1Color; + border: 1px solid @AccentColor; } QPushButton:checked:disabled { - border: 1px solid @UserHighlight1Color; + border: 1px solid @AccentColor; color: @TextDisabledColor; outline: none; } QPushButton:checked:selected { background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 @ButtonTopBackgroundColor, stop:1 @ButtonBottomBackgroundColor); - border: 1px solid @UserHighlight1Color; + border: 1px solid @AccentColor; } QPushButton:hover { @@ -1233,7 +1233,7 @@ QToolBar QToolButton { QDialog QToolButton:hover { background-color: @GeneralBackgroundHoverColor; - /* border: 1px solid @UserHighlight1Color;*/} + /* border: 1px solid @AccentColor;*/} QToolButton:disabled { /* padding: 2px; */ /* background-color: @GeneralDisabledBackgroundColor; */ @@ -1243,17 +1243,17 @@ QToolButton:disabled { QToolButton:checked { background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 @ButtonBottomBackgroundColor, stop:0.7 @ButtonTopBackgroundColor, stop:1 @ButtonTopBackgroundColor); border-radius: @InputFieldBorderRadius; - border: 1px solid @UserHighlight1Color; + border: 1px solid @AccentColor; } QToolButton:checked:disabled { background-color: @GeneralDisabledBackgroundColor; - color: @UserHighlight1Color; + color: @AccentColor; } QToolButton:checked:hover { background-color: @GeneralBackgroundHoverColor; - border: 1px solid @UserHighlight1Color; + border: 1px solid @AccentColor; } QToolButton:checked:pressed { @@ -1262,7 +1262,7 @@ QToolButton:checked:pressed { QToolButton:checked:selected { background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 @ButtonBottomBackgroundColor, stop:0.7 @ButtonTopBackgroundColor,stop:1 @ButtonBottomBackgroundColor ); - border: 1px solid @UserHighlight1Color; + border: 1px solid @AccentColor; } QToolButton:hover { @@ -1383,7 +1383,7 @@ QComboBox:hover { } QComboBox:focus { - border: 1px solid @UserHighlight1Color; + border: 1px solid @AccentColor; } QComboBox:on { @@ -1572,7 +1572,7 @@ QSint--ActionGroup QFrame[class="content"] QToolButton:hover{ } QSint--ActionGroup QFrame[class="content"] QToolButton:focus { - border: 1px solid @UserHighlight1Color; + border: 1px solid @AccentColor; } QSint--ActionGroup QFrame[class="content"] QToolButton:disabled { @@ -1613,7 +1613,7 @@ QSlider::groove:horizontal { } QSlider::groove:vertical { - background-color: @UserHighlight1Color; + background-color: @AccentColor; border: 1px solid @GeneralBorderColor; width: 4px; @@ -1621,7 +1621,7 @@ QSlider::groove:vertical { } QSlider::add-page:vertical { - background-color: @UserHighlight1Color; + background-color: @AccentColor; border: 1px solid @GeneralBorderColor; width: 4px; @@ -1633,7 +1633,7 @@ QSlider::add-page:vertical :disabled { } QSlider::sub-page:horizontal { - background-color: @UserHighlight1Color; + background-color: @AccentColor; border: 1px solid @GeneralBorderColor; height: 4px; @@ -1645,7 +1645,7 @@ QSlider::sub-page:horizontal:disabled { } QSlider::handle:horizontal { - background-color: @UserHighlight1Color; + background-color: @AccentColor; border: 1px solid @GeneralBorderColor; width: 10px; height: 8px; @@ -1659,12 +1659,12 @@ QSlider::handle:horizontal:hover { } QSlider::handle:horizontal:focus { - background-color: @UserHighlight1Color; - border: 1px solid @UserHighlight1Color; + background-color: @AccentColor; + border: 1px solid @AccentColor; } QSlider::handle:vertical { - background-color: @UserHighlight1Color; + background-color: @AccentColor; border: 1px solid @GeneralBorderColor; width: 10px; height: 8px; @@ -1678,7 +1678,7 @@ QSlider::handle:vertical:hover { } QSlider::handle:vertical:focus { - border: 1px solid @UserHighlight1Color; + border: 1px solid @AccentColor; } /* QLineEdit -------------------------------------------------------------- @@ -1703,7 +1703,7 @@ QLineEdit:disabled, QTextEdit:disabled { } QLineEdit:focus, QTextEdit:focus { - border: 1px solid @UserHighlight1Color; + border: 1px solid @AccentColor; } QLineEdit:selected, QTextEdit:selected { @@ -2054,7 +2054,7 @@ QDockWidget::float-button { } QDockWidget::float-button:hover { - /*background-color: @UserHighlight1Color;*/ + /*background-color: @AccentColor;*/ image: url(qss:@IconsLocationFolderName/undock-blue.svg); } @@ -2156,15 +2156,21 @@ QTableView, QColumnView { background-color: @PrimaryColor;/* background of a lot of stuff including spreadsheets.*/ /* gridline-color: @GeneralBorderColor; */ + show-decoration-selected: 1; alternate-background-color: @GeneralAlternateBackgroundColor; - selection-background-color: @UserHighlight1Color; + selection-background-color: @AccentBackgroundColor; } QListView { background-color: @PrimaryColor; border: 1px solid @GeneralBorderColor; + show-decoration-selected: 1; alternate-background-color: @GeneralAlternateBackgroundColor; - selection-background-color: @UserHighlight1Color; + selection-background-color: @AccentBackgroundColor; +} + +QTreeView { + show-decoration-selected: 0; } QTreeView:disabled, @@ -2193,23 +2199,24 @@ QColumnView::item:pressed { background-color: @GeneralBackgroundHoverColor; } -QListView::item:selected -QTableView::item:selected +QListView::item:selected, +QTableView::item:selected, +QTreeView::item:selected, QColumnView::item:selected { - background-color: @PrimaryColor; + background-color: @AccentBackgroundColor; } /* QTreeView::item:!selected:hover, */ QListView::item:!selected:hover, QTableView::item:!selected:hover, QColumnView::item:!selected:hover { - background-color: @GeneralBackgroundHoverColor; + background-color: @AccentHoverColor; } QTreeView::item:!selected:hover{ outline: 0; color:@TextForegroundColor; - background-color: @GeneralBackgroundHoverColor; + background-color: @AccentHoverColor; } /* QTreeView::item, */ @@ -2312,8 +2319,7 @@ QToolBox { } QToolBox:selected { - - border: 1px solid @UserHighlight1Color; + border: 1px solid @AccentColor; } QToolBox::tab { @@ -2442,11 +2448,11 @@ QDateEdit QAbstractItemView, QDateTimeEdit QAbstractItemView { --------------------------------------------------------------------------- */ QAbstractView:hover { - border: 1px solid @UserHighlight1Color; + border: 1px solid @AccentColor; } QAbstractView:selected { - background-color: @UserHighlight1Color; + background-color: @AccentColor; } /* PlotWidget ------------------------------------------------------------- @@ -2547,7 +2553,7 @@ QMdiSubWindow:hover { } QMdiSubWindow:active { - border:2px solid @UserHighlight1Color; + border:2px solid @AccentColor; } /*================================================================================================== @@ -2560,11 +2566,11 @@ QWidget#thumbnailWidget { } QWidget#thumbnailWidget[state="hovered"] { - border: 1px solid @UserHighlight1Color; + border: 1px solid @AccentColor; } QWidget#thumbnailWidget[state="pressed"] { - border: 1px solid @UserHighlight1Color; + border: 1px solid @AccentColor; } /** @@ -2591,8 +2597,7 @@ QToolBar > Gui--WorkbenchComboBox QAbstractItemView { QTreeView::item#groupsTreeView { - margin-left:-8px; - /* background-color: @UserHighlight1Color; */ + /* background-color: @AccentColor; */ } QMainWindow QTableView { From 6d69c10403daab4afc3c70d9ae0e0edb5a1e5d53 Mon Sep 17 00:00:00 2001 From: Kacper Donat Date: Sat, 12 Jul 2025 21:01:27 +0200 Subject: [PATCH 08/11] Stylesheets: Fix empty line between header and content in QSInt --- src/Gui/QSint/actionpanel/actiongroup.cpp | 1 + src/Gui/Stylesheets/FreeCAD.qss | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/src/Gui/QSint/actionpanel/actiongroup.cpp b/src/Gui/QSint/actionpanel/actiongroup.cpp index f24e684a50..534129e150 100644 --- a/src/Gui/QSint/actionpanel/actiongroup.cpp +++ b/src/Gui/QSint/actionpanel/actiongroup.cpp @@ -57,6 +57,7 @@ void ActionGroup::init(bool hasHeader) separator->setFrameShadow(QFrame::Raised); separator->setFixedHeight(separatorHeight); separator->setContentsMargins(8, 0, 8, 0); + separator->setProperty("class", "separator"); layout->addWidget(separator); myGroup = new TaskGroup(this, hasHeader); diff --git a/src/Gui/Stylesheets/FreeCAD.qss b/src/Gui/Stylesheets/FreeCAD.qss index 6bf961fed1..d166784a29 100644 --- a/src/Gui/Stylesheets/FreeCAD.qss +++ b/src/Gui/Stylesheets/FreeCAD.qss @@ -1546,6 +1546,12 @@ QSint--ActionGroup QFrame[class="content"] QToolButton:checked { background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 @ButtonTopBackgroundColor, stop:1 @ButtonBottomBackgroundColor ); } +/* hide the empty line between header and content */ +QSint--ActionGroup QFrame[class="separator"] { + min-height: 0; + max-height: 0; +} + /* QToolButtons with a menu found in Sketcher task panel*/ QSint--ActionGroup QToolButton::menu-button { border-left: 1px solid @GeneralBorderColor; From f5c9277f8f79abc4bc4cf63666794a16a9af2ee6 Mon Sep 17 00:00:00 2001 From: Kacper Donat Date: Sat, 12 Jul 2025 23:49:49 +0200 Subject: [PATCH 09/11] Stylesheets: Fix property editor headers --- src/Gui/PreferencePacks/FreeCAD Dark/FreeCAD Dark.cfg | 1 + src/Gui/PreferencePacks/FreeCAD Light/FreeCAD Light.cfg | 1 + src/Gui/Stylesheets/FreeCAD.qss | 4 ++-- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Gui/PreferencePacks/FreeCAD Dark/FreeCAD Dark.cfg b/src/Gui/PreferencePacks/FreeCAD Dark/FreeCAD Dark.cfg index 3e1ca8d193..d6d05925ee 100644 --- a/src/Gui/PreferencePacks/FreeCAD Dark/FreeCAD Dark.cfg +++ b/src/Gui/PreferencePacks/FreeCAD Dark/FreeCAD Dark.cfg @@ -121,6 +121,7 @@ @PrimaryColorLighten6 @PrimaryColorDarken3 @PrimaryColorLighten3 + @PrimaryColor @PrimaryColorLighten4 lighten(@GroupboxBackgroundColor,20) images_classic diff --git a/src/Gui/PreferencePacks/FreeCAD Light/FreeCAD Light.cfg b/src/Gui/PreferencePacks/FreeCAD Light/FreeCAD Light.cfg index 32e73153db..5cbfd007a6 100644 --- a/src/Gui/PreferencePacks/FreeCAD Light/FreeCAD Light.cfg +++ b/src/Gui/PreferencePacks/FreeCAD Light/FreeCAD Light.cfg @@ -136,6 +136,7 @@ @PrimaryColorDarken5 @PrimaryColorDarken3 @PrimaryColorDarken4 + @PrimaryColorDarken2 @PrimaryColorLighten2 darken(@GroupboxBackgroundColor,20) images_classic diff --git a/src/Gui/Stylesheets/FreeCAD.qss b/src/Gui/Stylesheets/FreeCAD.qss index d166784a29..3aae692091 100644 --- a/src/Gui/Stylesheets/FreeCAD.qss +++ b/src/Gui/Stylesheets/FreeCAD.qss @@ -91,7 +91,7 @@ Gui--PropertyEditor--PropertyEditor > QWidget > QFrame:focus { background-color: @AccentColor;/* same as focused background color */} /* hack to hide weird redundant information inside cells with links and no editable data (but editable via "..." button) */ Gui--PropertyEditor--PropertyEditor > QWidget > QWidget > QLabel { - background-color: @TextUrlColor;/* same as focused background color */ + background-color: @TextUrlColor;/* same as focused background color */ border-radius: @InputFieldBorderRadius; } @@ -1437,7 +1437,7 @@ Tasks panel (custom FreeCAD class) ==================================================================================================*/ Gui--PropertyEditor--PropertyEditor { qproperty-groupTextColor: @TextForegroundColor; - qproperty-groupBackground: @GeneralAlternateBackgroundColor; + qproperty-groupBackground: @GeneralHeaderBackgroundColor; } /* Action group */ From 4db029776bcda5299ff1a1728848aa79e0ec0ca1 Mon Sep 17 00:00:00 2001 From: Kacper Donat Date: Mon, 14 Jul 2025 20:46:03 +0200 Subject: [PATCH 10/11] Stylesheets: Fix jumping entries on Windows Co-authored-by: MisterMakerNL --- src/Gui/Dialogs/DlgPreferences.ui | 2 +- src/Gui/Stylesheets/FreeCAD.qss | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Gui/Dialogs/DlgPreferences.ui b/src/Gui/Dialogs/DlgPreferences.ui index 14bbef221a..3659723381 100644 --- a/src/Gui/Dialogs/DlgPreferences.ui +++ b/src/Gui/Dialogs/DlgPreferences.ui @@ -5,7 +5,7 @@ #sidebar { background-color: rgba(0, 0, 0, 25); } #groupsTreeView { background-color: transparent; } - #groupsTreeView::item { padding: 6px 8px; } + #groupsTreeView::item { padding: 6px 0px; } diff --git a/src/Gui/Stylesheets/FreeCAD.qss b/src/Gui/Stylesheets/FreeCAD.qss index 3aae692091..f0b4692957 100644 --- a/src/Gui/Stylesheets/FreeCAD.qss +++ b/src/Gui/Stylesheets/FreeCAD.qss @@ -2176,7 +2176,9 @@ QListView { } QTreeView { - show-decoration-selected: 0; + show-decoration-selected: 1; + selection-background-color: @AccentBackgroundColor; + qproperty-indentation: 10; } QTreeView:disabled, From cd87823ca7a0287ad53531ba86d240c19d11096f Mon Sep 17 00:00:00 2001 From: Kacper Donat Date: Mon, 14 Jul 2025 20:46:32 +0200 Subject: [PATCH 11/11] Stylesheets: Fix file chooser buttons not displaying dots --- src/Gui/FileDialog.cpp | 11 +++++------ src/Gui/Stylesheets/FreeCAD.qss | 15 +++++++-------- 2 files changed, 12 insertions(+), 14 deletions(-) diff --git a/src/Gui/FileDialog.cpp b/src/Gui/FileDialog.cpp index aeca1932c1..b45f505f3d 100644 --- a/src/Gui/FileDialog.cpp +++ b/src/Gui/FileDialog.cpp @@ -668,7 +668,6 @@ FileChooser::FileChooser ( QWidget * parent ) completer->setModel( fs_model ); lineEdit->setCompleter( completer ); - layout->addWidget( lineEdit ); connect(lineEdit, &QLineEdit::textChanged, this, &FileChooser::fileNameChanged); connect(lineEdit, &QLineEdit::editingFinished, this, &FileChooser::editingFinished); @@ -679,7 +678,8 @@ FileChooser::FileChooser ( QWidget * parent ) button->setAttribute(Qt::WA_LayoutUsesWidgetRect); // layout size from QMacStyle was not correct #endif - layout->addWidget(button); + layout->addWidget(lineEdit, 1); + layout->addWidget(button, -1); connect(button, &QPushButton::clicked, this, &FileChooser::chooseFile); @@ -690,7 +690,6 @@ FileChooser::~FileChooser() = default; void FileChooser::resizeEvent(QResizeEvent* e) { - button->setFixedWidth(e->size().height()); button->setFixedHeight(e->size().height()); } @@ -815,12 +814,12 @@ void FileChooser::setFilter ( const QString& filter ) /** * Sets the browse button's text to \a txt. */ -void FileChooser::setButtonText( const QString& txt ) +void FileChooser::setButtonText(const QString& txt) { - button->setText( txt ); + button->setText(txt); int w1 = 2 * QtTools::horizontalAdvance(button->fontMetrics(), txt); int w2 = 2 * QtTools::horizontalAdvance(button->fontMetrics(), QLatin1String(" ... ")); - button->setFixedWidth( (w1 > w2 ? w1 : w2) ); + button->setMinimumWidth(std::max(w1, w2)); Q_EMIT buttonTextChanged(txt); } diff --git a/src/Gui/Stylesheets/FreeCAD.qss b/src/Gui/Stylesheets/FreeCAD.qss index f0b4692957..2b665fd32e 100644 --- a/src/Gui/Stylesheets/FreeCAD.qss +++ b/src/Gui/Stylesheets/FreeCAD.qss @@ -223,7 +223,6 @@ QStatusBar QLabel { } QStatusBar QPushButton { - min-width: 0; padding-left: 8px; padding-right: 8px; } @@ -1160,14 +1159,17 @@ QPushButton { border: 1px solid @ButtonBorderColor; border-radius: @InputFieldBorderRadius; padding: 3px 12px; + min-width: 64px; } #CreateNewRow > QPushButton { - /* Reset min width to default */ - min-width: -1; border-radius: @InputFieldBorderRadius; } +Gui--FileChooser QPushButton { + min-width: 0; +} + QPushButton:disabled { background-color: @GeneralDisabledBackgroundColor; color: @TextDisabledColor; @@ -1598,8 +1600,7 @@ QSint--ActionGroup QFrame[class="content"] QToolButton:pressed { } QFrame[class="panel"] QPushButton { -padding: 3px; -min-width: 0px; + padding: 3px; } /* QSlider ---------------------------------------------------------------- @@ -2599,7 +2600,7 @@ QGroupBox[objectName="matOpsGrpBox"] QPushButton { QToolBar > Gui--WorkbenchComboBox QAbstractItemView { min-width: 180px; margin-left: 30px; - } +} /* Below is a fix for indentation in properties*/ @@ -2619,11 +2620,9 @@ QMainWindow QListView { /* border-radius: 3px; */} QTableView QPushButton { - min-width: 0px; padding: 2px; } QTableView QPushButton:hover { - min-width: 0px; background-color: @GeneralBackgroundHoverColor; border: 1px solid @GeneralBorderColor; }