/*
This file is part of the KDE project
- SPDX-FileCopyrightText: 2022 Felix Ernst <felixernst@zohomail.eu>
+ SPDX-FileCopyrightText: 2022 Felix Ernst <felixernst@kde.org>
SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
*/
m_colorControlledWidgets.emplace_back(widget);
}
+bool BackgroundColorHelper::eventFilter(QObject *obj, QEvent *event)
+{
+ Q_UNUSED(obj);
+ if (event->type() == QEvent::ApplicationPaletteChange) {
+ slotPaletteChanged();
+ }
+ return false;
+}
+
BackgroundColorHelper::BackgroundColorHelper()
{
updateBackgroundColor();
- QObject::connect(qApp, &QGuiApplication::paletteChanged, [=]() {
- slotPaletteChanged();
- });
+ qApp->installEventFilter(this);
}
void BackgroundColorHelper::slotPaletteChanged()
}
BackgroundColorHelper *BackgroundColorHelper::s_instance = nullptr;
+
+#include "moc_backgroundcolorhelper.cpp"