Skip to content

Commit 773c7f7

Browse files
committed
[REFACT] Check for a dark theme in Qt6.5+ in the same way as in lower Qt versions
1 parent 4b22fbc commit 773c7f7

1 file changed

Lines changed: 0 additions & 8 deletions

File tree

pe-bear/base/MainSettings.cpp

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,15 @@
11
#include "MainSettings.h"
22
#include <QPalette>
3-
#if QT_VERSION >= QT_VERSION_CHECK(6, 5, 0)
4-
#include <QStyleHints>
5-
#endif
63
#include "../gui/DarkStyle.h"
74
#define DARK_STYLE_NAME "Dark"
85

96
//--------------------
107
inline bool isDarkMode()
118
{
12-
#if QT_VERSION >= QT_VERSION_CHECK(6, 5, 0)
13-
const auto scheme = QGuiApplication::styleHints()->colorScheme();
14-
return scheme == Qt::ColorScheme::Dark;
15-
#else
169
const QPalette defaultPalette;
1710
const auto text = defaultPalette.color(QPalette::WindowText);
1811
const auto window = defaultPalette.color(QPalette::Window);
1912
return text.lightness() > window.lightness();
20-
#endif // QT_VERSION
2113
}
2214
//---
2315

0 commit comments

Comments
 (0)