feat!: theme config system refactor - #4
Merged
Merged
Conversation
Add QtShadcnSettings, ConfigItem, ThemeMode enum, and atomic per-file persistence under QStandardPaths.AppDataLocation/config/.
Add setThemeMode, setTheme, setStyleSheet, getTheme, getStyleSheet, and global QSS rendering pipeline. Mode resolution moves here from the deleted theme_mode.py.
Manual QThread listener with darkdetect on Windows and polling fallback on macOS/Linux. Emits themeChanged signal on OS theme change.
BREAKING CHANGE: apply_theme() and get_theme() are removed entirely. Migrate to qsettings.load(), setThemeMode(), setTheme(), setStyleSheet(), and getTheme(). Remove obsolete theme_mode.py and cache.py.
Replace __getattr__ with direct imports for DX. Update gallery, basic example, generator example, docs, CI, and issue templates to the new three-concept API.
toggleThemeMode now cycles auto -> light -> dark -> auto regardless of OS detection. Apply ruff format to generator example and watcher tests.
test_set_xml_theme now sets ThemeMode.LIGHT before asserting light tokens, making it independent of OS theme detection or leftover state.
BugCodeX
enabled auto-merge
August 13, 2026 01:25
PySide2 is not stable on Python 3.12 and crashes with exit code 139 (SIGSEGV). Run it on 3.11 instead.
Remove pyside2 from the binding matrix because pytest-qt does not support it and it crashes on CI. Expand pyside6 and pyqt6 to run on ubuntu-latest and windows-latest with Python 3.11, 3.12, and 3.13.
BugCodeX
disabled auto-merge
August 13, 2026 02:25
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Replace the stateless
apply_theme()API with a persistent three-concept configuration system inspired by PyQt-Fluent-Widgets:setThemeMode,toggleThemeMode,themeMode,isDarkThemesetTheme,getThemesetStyleSheet,getStyleSheetAdd a manual
SystemThemeListenerfor OS theme reactivity and aqsettingssingleton (QtShadcnSettings) withConfigItemdescriptors and atomic per-file persistence underQStandardPaths.AppDataLocation/config/.Breaking Changes
apply_theme()andget_theme()are removed entirely. The old cache system (qtshadcn/common/cache.py) andtheme_mode.pyare deleted.Migration
What's New
qtshadcn/common/config.py—QtShadcnSettings,ConfigItem,ThemeMode,qsettingsqtshadcn/common/stylesheet.py— global stylesheet rendering + 3-concept APIqtshadcn/common/theme_watcher.py— manualSystemThemeListener(QThread)qtshadcn/__init__.py(no__getattr__) for better DXVerification
make test: 145 passedmake lint: cleanmake type-check: cleanCommits
feat: add persistent config system with qsettings singletonfeat: add 3-concept stylesheet API with rendering pipelinefeat: add SystemThemeListener for OS theme reactivityfeat!: remove apply_theme/get_theme and cache.pyfeat: export new public API and migrate examples/docs