v0.44.1: Preferences headings stay bold under the app's style sheet

The headings were set with setFont, which the app's own style sheet
(theme.apply_theme) overrides on re-polish — bold in a bare dialog, plain
in the running app. A style sheet on the heading itself wins. The test now
applies the theme first, as the app does.
This commit is contained in:
2026-10-10 01:54:59 -07:00
parent 8339e0404f
commit 491e31b4d6
3 changed files with 11 additions and 7 deletions
+1 -1
View File
@@ -1,3 +1,3 @@
"""LinTunes — iTunes-style music library manager and player for Linux."""
__version__ = "0.44.0"
__version__ = "0.44.1"
+3 -4
View File
@@ -191,10 +191,9 @@ class PreferencesDialog(QDialog):
the UI size changes, since the app font moves with it."""
size = QFontInfo(QApplication.font()).pixelSize() + HEADING_EXTRA_PX
for header in self._headings:
font = QFont(QApplication.font())
font.setPixelSize(size)
font.setBold(True)
header.setFont(font)
# A style sheet, not setFont: the app's own style sheet (theme)
# re-polishes widgets and would quietly put the plain font back.
header.setStyleSheet(f"font-weight: bold; font-size: {size}px;")
def _show_page(self, row: int):
self.pages.setCurrentIndex(row)
+7 -2
View File
@@ -161,14 +161,19 @@ def _prefs_dialog(prefs):
class TestHeadings:
def test_bold_and_two_px_larger(self, qapp, tmp_path):
dialog = _prefs_dialog(Preferences(tmp_path))
from lintunes import theme
prefs = Preferences(tmp_path)
theme.apply_theme(QApplication.instance(), prefs) # as the app runs
dialog = _prefs_dialog(prefs)
dialog.show()
text_px = QFontInfo(QApplication.font()).pixelSize()
headings = dialog.findChildren(QLabel, "prefs-heading")
assert {h.text() for h in headings} >= {"Interface", "Visualizer",
"Colors", "Last.fm"}
for heading in headings:
assert heading.font().bold()
assert heading.font().pixelSize() == text_px + 2
assert QFontInfo(heading.font()).pixelSize() == text_px + 2
dialog.close()
def test_the_boxes_contents_stay_plain(self, qapp, tmp_path):
dialog = _prefs_dialog(Preferences(tmp_path))