mirror of
https://github.com/YACReader/yacreader
synced 2026-04-12 15:49:53 -04:00
Minimum Qt version required is 6.7
This commit is contained in:
@ -21,8 +21,6 @@ ThemeManager &ThemeManager::instance()
|
|||||||
|
|
||||||
void ThemeManager::initialize()
|
void ThemeManager::initialize()
|
||||||
{
|
{
|
||||||
// QStyleHints::colorScheme is only 6.5+
|
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 5, 0)
|
|
||||||
auto *styleHints = qGuiApp->styleHints();
|
auto *styleHints = qGuiApp->styleHints();
|
||||||
|
|
||||||
auto colorScheme = styleHints->colorScheme();
|
auto colorScheme = styleHints->colorScheme();
|
||||||
@ -35,15 +33,6 @@ void ThemeManager::initialize()
|
|||||||
applyColorScheme(colorScheme);
|
applyColorScheme(colorScheme);
|
||||||
|
|
||||||
connect(styleHints, &QStyleHints::colorSchemeChanged, this, applyColorScheme, Qt::QueuedConnection);
|
connect(styleHints, &QStyleHints::colorSchemeChanged, this, applyColorScheme, Qt::QueuedConnection);
|
||||||
#else
|
|
||||||
auto applyPalette = [this](const QPalette &palette) {
|
|
||||||
setTheme(palette.color(QPalette::Window).lightness() < 128 ? ThemeId::Dark : ThemeId::Light);
|
|
||||||
};
|
|
||||||
|
|
||||||
applyPalette(qGuiApp->palette());
|
|
||||||
|
|
||||||
connect(qGuiApp, &QGuiApplication::paletteChanged, this, applyPalette, Qt::QueuedConnection);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ThemeManager::setTheme(ThemeId themeId)
|
void ThemeManager::setTheme(ThemeId themeId)
|
||||||
|
|||||||
Reference in New Issue
Block a user