Skip to content

Commit

Permalink
Also apply fallback icon theme changes when the color scheme changes on
Browse files Browse the repository at this point in the history
non-Windows platforms
  • Loading branch information
zrax committed Mar 12, 2024
1 parent 5c0d042 commit 1c344de
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@ int main(int argc, char *argv[])
QCoreApplication::setApplicationName(QStringLiteral("qtextpad"));
QCoreApplication::setApplicationVersion(QTextPadVersion::versionString());

#if defined(Q_OS_WIN) && (QT_VERSION >= QT_VERSION_CHECK(6, 5, 0))
#if QT_VERSION >= QT_VERSION_CHECK(6, 5, 0)
# ifdef Q_OS_WIN
QString defaultStyle = QApplication::style()->name();
if (QGuiApplication::styleHints()->colorScheme() == Qt::ColorScheme::Dark)
QApplication::setStyle(QStringLiteral("fusion"));
Expand All @@ -83,6 +84,10 @@ int main(int argc, char *argv[])
QApplication::setStyle(defaultStyle);
setDefaultIconTheme();
});
# else
QObject::connect(QGuiApplication::styleHints(), &QStyleHints::colorSchemeChanged,
[](Qt::ColorScheme) { setDefaultIconTheme(); });
# endif
#endif

QTranslator qtTranslator;
Expand Down

0 comments on commit 1c344de

Please sign in to comment.