diff --git a/application/settings.cpp b/application/settings.cpp index 2378b11..3ae4658 100644 --- a/application/settings.cpp +++ b/application/settings.cpp @@ -248,8 +248,6 @@ void Settings::readSettings(const QString &sSharePath) { m_pSettings->value(QStringLiteral("WindowState")).toByteArray(); m_aSplitterState = m_pSettings->value(QStringLiteral("SplitterState")).toByteArray(); - m_nDarkThreshold = - m_pSettings->value(QStringLiteral("DarkThreshold"), -1).toDouble(); m_pSettings->endGroup(); } @@ -362,6 +360,7 @@ void Settings::removeObsolete() { m_pSettings->remove(QStringLiteral("Inyoka/WikiUrl")); m_pSettings->remove(QStringLiteral("ConstructionArea")); m_pSettings->remove(QStringLiteral("Inyoka/ConstructionArea")); + m_pSettings->remove(QStringLiteral("Window/DarkThreshold")); m_pSettings->beginGroup(QStringLiteral("FindDialog")); m_pSettings->remove(QLatin1String("")); m_pSettings->endGroup(); @@ -508,18 +507,14 @@ auto Settings::getSplitterState() const -> QByteArray { auto Settings::isDarkScheme() const -> bool { #if QT_VERSION >= QT_VERSION_CHECK(6, 5, 0) - if (-1 == m_nDarkThreshold && - Qt::ColorScheme::Dark == QGuiApplication::styleHints()->colorScheme()) { + if (Qt::ColorScheme::Dark == QGuiApplication::styleHints()->colorScheme()) { return true; } #endif - double nThreshold = 0.5; - if (-1 != m_nDarkThreshold) { - nThreshold = m_nDarkThreshold; - } + // Fallback: If window is darker than text if (m_pParent->window()->palette().window().color().lightnessF() < - nThreshold) { + m_pParent->window()->palette().windowText().color().lightnessF()) { return true; } diff --git a/application/settings.h b/application/settings.h index f34c541..97b81dc 100644 --- a/application/settings.h +++ b/application/settings.h @@ -157,7 +157,6 @@ class Settings : public QObject { QByteArray m_aWindowState; QByteArray m_aWindowGeometry; QByteArray m_aSplitterState; - double m_nDarkThreshold; // Last opened static const quint16 m_cMAXFILES = 10;