X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/blobdiff_plain/38c34eeca315c7be58e65d4d3fb72aaf7b866719..80156ef3f57bab877574ad2932fbeca42eee05a0:/src/selectionmode/backgroundcolorhelper.cpp diff --git a/src/selectionmode/backgroundcolorhelper.cpp b/src/selectionmode/backgroundcolorhelper.cpp index 1615c36bb..42ccb64bd 100644 --- a/src/selectionmode/backgroundcolorhelper.cpp +++ b/src/selectionmode/backgroundcolorhelper.cpp @@ -1,6 +1,6 @@ /* This file is part of the KDE project - SPDX-FileCopyrightText: 2022 Felix Ernst + SPDX-FileCopyrightText: 2022 Felix Ernst SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL */ @@ -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, [=]() { - slotPaletteChanged(); - }); + qApp->installEventFilter(this); } void BackgroundColorHelper::slotPaletteChanged() @@ -92,3 +99,5 @@ void BackgroundColorHelper::updateBackgroundColor() } BackgroundColorHelper *BackgroundColorHelper::s_instance = nullptr; + +#include "moc_backgroundcolorhelper.cpp"