From 6a15c1c66bcd97ba54bd4c0c6b50c4be6860ae93 Mon Sep 17 00:00:00 2001 From: Rick Blommers Date: Tue, 23 Apr 2024 11:56:08 +0200 Subject: [PATCH] updated changes, and add conditionals for supporting older qt versions --- CHANGES.md | 1 + QtAwesome/QtAwesome.cpp | 12 +++++++++--- QtAwesome/QtAwesome.h | 2 +- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index fb20582..86c0fae 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,5 +1,6 @@ # Changes +- (2024-04-23) Support for dark/light colorSchema mode, (contribution by @hanjianqiao(Lanchitour)) - (2023-12-07) Update to 6.5.1, Sharp Thin Pro font - (2023-08-16) Update to 6.4.2, Fix issue missing pro icons in namedCodePoints - (2023-03-28) Update to 6.4.0, Sharp Light Pro font diff --git a/QtAwesome/QtAwesome.cpp b/QtAwesome/QtAwesome.cpp index 688e7d8..7a19bd1 100644 --- a/QtAwesome/QtAwesome.cpp +++ b/QtAwesome/QtAwesome.cpp @@ -3,7 +3,7 @@ * * MIT Licensed * - * Copyright 2013-2022 - Reliable Bits Software by Blommers IT. All Rights Reserved. + * Copyright 2013-2024 - Reliable Bits Software by Blommers IT. All Rights Reserved. * Author Rick Blommers */ @@ -17,9 +17,13 @@ #include #include #include -#include +#if (QT_VERSION >= QT_VERSION_CHECK(6, 5, 0)) +#define USE_COLOR_SCHEME +#include +#endif + // Initializing namespaces need to happen outside a namespace static void qtawesome_init_resources() { @@ -247,10 +251,12 @@ QtAwesome::QtAwesome(QObject* parent) _fontDetails.insert(fa::fa_sharp_thin, QtAwesomeFontData(FA_SHARP_THIN_FONT_FILENAME, FA_SHARP_THIN_FONT_WEIGHT)); #endif - // support dark/light mode +#ifdef USE_COLOR_SCHEME + // support dark/light mode QObject::connect(QApplication::styleHints(), &QStyleHints::colorSchemeChanged, this, [this](Qt::ColorScheme colorScheme){ resetDefaultOptions(); }); +#endif } void QtAwesome::resetDefaultOptions(){ diff --git a/QtAwesome/QtAwesome.h b/QtAwesome/QtAwesome.h index ad01764..c1ec3c8 100644 --- a/QtAwesome/QtAwesome.h +++ b/QtAwesome/QtAwesome.h @@ -3,7 +3,7 @@ * * MIT Licensed * - * Copyright 2013-2022 - Reliable Bits Software by Blommers IT. All Rights Reserved. + * Copyright 2013-2024 - Reliable Bits Software by Blommers IT. All Rights Reserved. * Author Rick Blommers */