From db9b0d665d5ee510a1a62fa92a76745cec4faf1c Mon Sep 17 00:00:00 2001 From: NinjaCheetah <58050615+NinjaCheetah@users.noreply.github.com> Date: Thu, 8 May 2025 21:31:21 -0400 Subject: [PATCH] Stylesheet patch to make tree scrollbar padding consistent --- NUSGet.py | 8 ++++++++ resources/style.qss | 6 ------ 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/NUSGet.py b/NUSGet.py index e9ca7c9..d6a19f4 100644 --- a/NUSGet.py +++ b/NUSGet.py @@ -142,6 +142,14 @@ class MainWindow(QMainWindow, Ui_MainWindow): self.trees[tree].doubleClicked.connect(self.title_double_clicked) self.trees[tree].expanded.connect(lambda: self.resize_tree(self.ui.platform_tabs.currentIndex())) self.trees[tree].collapsed.connect(lambda: self.resize_tree(self.ui.platform_tabs.currentIndex())) + # This stylesheet patch allows me to add the correct padding above the scrollbar so that it doesn't overlap + # the QTreeView's header. + self.trees[tree].setStyleSheet(self.trees[tree].styleSheet() + f""" + QTreeView QScrollBar::sub-line:vertical {{ + border: 0; + background: #2b2b2b; + height: {self.trees[tree].header().sizeHint().height()}px; + }}""") # Prevent resizing. self.setFixedSize(self.size()) # These connections allow for clicking the checkbox labels to toggle the checkboxes, if they're enabled. This is diff --git a/resources/style.qss b/resources/style.qss index 1335f34..64e7f83 100644 --- a/resources/style.qss +++ b/resources/style.qss @@ -155,12 +155,6 @@ QTreeView QScrollBar:vertical { margin-top: 16px; } -QTreeView QScrollBar::sub-line:vertical { - border: 0; - background: #2b2b2b; - height: 16px; -} - QTextBrowser { background-color: #1a1a1a; selection-background-color: #1a73e8;