mirror of
https://github.com/JakubMelka/PDF4QT.git
synced 2025-06-05 21:59:17 +02:00
Issue #200: Icons under dark theme on Arch/KDE is broken
This commit is contained in:
@@ -46,8 +46,6 @@ int qt_default_dpi_y() { return 96; }
|
||||
namespace pdf
|
||||
{
|
||||
|
||||
std::optional<bool> s_isDarkThemeOverride;
|
||||
|
||||
static constexpr bool isScalingNeeded()
|
||||
{
|
||||
return QT_VERSION_MAJOR < 6;
|
||||
@@ -176,18 +174,13 @@ void PDFWidgetUtils::style(QWidget* widget)
|
||||
}
|
||||
}
|
||||
|
||||
void PDFWidgetUtils::overrideDarkTheme(bool isDarkTheme)
|
||||
void PDFWidgetUtils::setDarkTheme(bool isDarkTheme)
|
||||
{
|
||||
s_isDarkThemeOverride = isDarkTheme;
|
||||
QApplication::styleHints()->setColorScheme(isDarkTheme ? Qt::ColorScheme::Dark : Qt::ColorScheme::Light);
|
||||
}
|
||||
|
||||
bool PDFWidgetUtils::isDarkTheme()
|
||||
{
|
||||
if (s_isDarkThemeOverride.has_value())
|
||||
{
|
||||
return s_isDarkThemeOverride.value();
|
||||
}
|
||||
|
||||
Qt::ColorScheme colorScheme = QApplication::styleHints()->colorScheme();
|
||||
return colorScheme == Qt::ColorScheme::Dark;
|
||||
}
|
||||
|
@@ -61,7 +61,7 @@ public:
|
||||
static void style(QWidget* widget);
|
||||
|
||||
/// Overrides automatically detected dark theme / light theme settings
|
||||
static void overrideDarkTheme(bool isDarkTheme);
|
||||
static void setDarkTheme(bool isDarkTheme);
|
||||
|
||||
/// Returns true if the dark theme is currently set for the application.
|
||||
static bool isDarkTheme();
|
||||
|
Reference in New Issue
Block a user