X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/blobdiff_plain/079f903bc8691866b4aa3c3e41204a47e735c062..e018ecafca79a73f1e9d76c577b9529fc3a7ae03:/src/selectionmode/backgroundcolorhelper.cpp diff --git a/src/selectionmode/backgroundcolorhelper.cpp b/src/selectionmode/backgroundcolorhelper.cpp index fa3e55ac4..42ccb64bd 100644 --- a/src/selectionmode/backgroundcolorhelper.cpp +++ b/src/selectionmode/backgroundcolorhelper.cpp @@ -43,12 +43,19 @@ void BackgroundColorHelper::controlBackgroundColor(QWidget *widget) 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, qApp, [=]() { - slotPaletteChanged(); - }); + qApp->installEventFilter(this); } void BackgroundColorHelper::slotPaletteChanged() @@ -92,3 +99,5 @@ void BackgroundColorHelper::updateBackgroundColor() } BackgroundColorHelper *BackgroundColorHelper::s_instance = nullptr; + +#include "moc_backgroundcolorhelper.cpp"