updated changes, and add conditionals for supporting older qt versions

This commit is contained in:
Rick Blommers 2024-04-23 11:56:08 +02:00
parent 1381b93aed
commit f8e9194672
3 changed files with 11 additions and 4 deletions

View File

@ -1,5 +1,6 @@
# Changes # 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-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-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 - (2023-03-28) Update to 6.4.0, Sharp Light Pro font

View File

@ -3,7 +3,7 @@
* *
* MIT Licensed * 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 * Author Rick Blommers
*/ */
@ -17,9 +17,13 @@
#include <QFontDatabase> #include <QFontDatabase>
#include <QFontMetrics> #include <QFontMetrics>
#include <QString> #include <QString>
#include <QStyleHints>
#if (QT_VERSION >= QT_VERSION_CHECK(6, 5, 0))
#define USE_COLOR_SCHEME
#include <QStyleHints>
#endif
// Initializing namespaces need to happen outside a namespace // Initializing namespaces need to happen outside a namespace
static void qtawesome_init_resources() 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)); _fontDetails.insert(fa::fa_sharp_thin, QtAwesomeFontData(FA_SHARP_THIN_FONT_FILENAME, FA_SHARP_THIN_FONT_WEIGHT));
#endif #endif
// support dark/light mode #ifdef USE_COLOR_SCHEME
// support dark/light mode
QObject::connect(QApplication::styleHints(), &QStyleHints::colorSchemeChanged, this, [this](Qt::ColorScheme colorScheme){ QObject::connect(QApplication::styleHints(), &QStyleHints::colorSchemeChanged, this, [this](Qt::ColorScheme colorScheme){
resetDefaultOptions(); resetDefaultOptions();
}); });
#endif
} }
void QtAwesome::resetDefaultOptions(){ void QtAwesome::resetDefaultOptions(){

View File

@ -3,7 +3,7 @@
* *
* MIT Licensed * 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 * Author Rick Blommers
*/ */