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"