Remove useStyledTemplate

This commit is contained in:
luisangelsm
2026-02-27 16:22:06 +01:00
parent 0e91176200
commit 4720705cf6
2 changed files with 8 additions and 28 deletions

View File

@ -197,13 +197,6 @@ struct TreeViewThemeTemplates {
"QTreeView::branch:has-children:selected:!has-siblings:closed,QTreeView::branch:closed:selected:has-children:has-siblings {border-image: none;image: url('%6');}" "QTreeView::branch:has-children:selected:!has-siblings:closed,QTreeView::branch:closed:selected:has-children:has-siblings {border-image: none;image: url('%6');}"
"QTreeView::branch:open:has-children:!has-siblings,QTreeView::branch:open:has-children:has-siblings {border-image: none;image: url('%7');}" "QTreeView::branch:open:has-children:!has-siblings,QTreeView::branch:open:has-children:has-siblings {border-image: none;image: url('%7');}"
"QTreeView::branch:open:has-children:selected:!has-siblings,QTreeView::branch:open:has-children:selected:has-siblings {border-image: none;image: url('%7');}"; "QTreeView::branch:open:has-children:selected:!has-siblings,QTreeView::branch:open:has-children:selected:has-siblings {border-image: none;image: url('%7');}";
// Native tree view template (uses system scroll bars) - for macOS
QString nativeTreeViewQSS = "QTreeView {background-color:transparent; border: none;}"
"QTreeView::item:selected {background-color:%1; border-top: 1px solid %1; border-left:none;border-right:none;border-bottom:1px solid %1;}"
"QTreeView::branch:selected {background-color:%1; border-top: 1px solid %1; border-left:none;border-right:none;border-bottom:1px solid %1;}"
"QTreeView::branch:open:selected:has-children {image: url(':/images/sidebar/expanded_branch_osx.png');}"
"QTreeView::branch:closed:selected:has-children {image: url(':/images/sidebar/collapsed_branch_osx.png');}";
}; };
struct TreeViewTheme { struct TreeViewTheme {

View File

@ -101,18 +101,12 @@ struct ImportWidgetParams {
struct TreeViewParams { struct TreeViewParams {
TreeViewThemeTemplates t; TreeViewThemeTemplates t;
bool useStyledTemplate; // true for non-macOS themes, false for macOS themes
// For styled template: %1=text, %2=selection bg, %3=scroll bg, %4=scroll handle, %5=selected text
QColor textColor; QColor textColor;
QColor selectionBackgroundColor; QColor selectionBackgroundColor;
QColor scrollBackgroundColor; QColor scrollBackgroundColor;
QColor scrollHandleColor; QColor scrollHandleColor;
QColor selectedTextColor; QColor selectedTextColor;
// For native (macOS) template: %1=selection color
QColor nativeSelectionColor;
QColor folderIndicatorColor; QColor folderIndicatorColor;
}; };
@ -642,18 +636,14 @@ Theme makeTheme(const ThemeParams &params)
// TreeView (must come after SidebarIcons for branch icon paths) // TreeView (must come after SidebarIcons for branch icon paths)
const auto &tv = params.treeViewParams; const auto &tv = params.treeViewParams;
if (tv.useStyledTemplate) { theme.treeView.treeViewQSS = tv.t.styledTreeViewQSS
theme.treeView.treeViewQSS = tv.t.styledTreeViewQSS .arg(tv.textColor.name(),
.arg(tv.textColor.name(), tv.selectionBackgroundColor.name(),
tv.selectionBackgroundColor.name(), tv.scrollBackgroundColor.name(),
tv.scrollBackgroundColor.name(), tv.scrollHandleColor.name(),
tv.scrollHandleColor.name(), tv.selectedTextColor.name(),
tv.selectedTextColor.name(), theme.sidebarIcons.branchClosedIconPath,
theme.sidebarIcons.branchClosedIconPath, theme.sidebarIcons.branchOpenIconPath);
theme.sidebarIcons.branchOpenIconPath);
} else {
theme.treeView.treeViewQSS = tv.t.nativeTreeViewQSS.arg(tv.nativeSelectionColor.name());
}
theme.treeView.folderIndicatorColor = tv.folderIndicatorColor; theme.treeView.folderIndicatorColor = tv.folderIndicatorColor;
// end TreeView // end TreeView
@ -953,7 +943,6 @@ ThemeParams classicThemeParams()
params.importWidgetParams = iw; params.importWidgetParams = iw;
TreeViewParams tv; TreeViewParams tv;
tv.useStyledTemplate = true;
tv.textColor = QColor(0xDDDFDF); tv.textColor = QColor(0xDDDFDF);
tv.selectionBackgroundColor = QColor(0x2E2E2E); tv.selectionBackgroundColor = QColor(0x2E2E2E);
tv.scrollBackgroundColor = QColor(0x404040); tv.scrollBackgroundColor = QColor(0x404040);
@ -1205,7 +1194,6 @@ ThemeParams lightThemeParams()
params.importWidgetParams = iw; params.importWidgetParams = iw;
TreeViewParams tv; TreeViewParams tv;
tv.useStyledTemplate = true;
tv.textColor = Qt::black; tv.textColor = Qt::black;
tv.selectionBackgroundColor = QColor(0xD0D0D0); tv.selectionBackgroundColor = QColor(0xD0D0D0);
tv.scrollBackgroundColor = QColor(0xE0E0E0); tv.scrollBackgroundColor = QColor(0xE0E0E0);
@ -1457,7 +1445,6 @@ ThemeParams darkThemeParams()
params.importWidgetParams = iw; params.importWidgetParams = iw;
TreeViewParams tv; TreeViewParams tv;
tv.useStyledTemplate = true;
tv.textColor = QColor(0xDDDFDF); tv.textColor = QColor(0xDDDFDF);
tv.selectionBackgroundColor = QColor(0x2E2E2E); tv.selectionBackgroundColor = QColor(0x2E2E2E);
tv.scrollBackgroundColor = QColor(0x404040); tv.scrollBackgroundColor = QColor(0x404040);