From a6313a5c98893fa7f3c107d59c4ddcd1a627b272 Mon Sep 17 00:00:00 2001 From: Méven Car Date: Sat, 9 Mar 2024 12:54:15 +0100 Subject: Handle deprecation of QGuiApplication::paletteChanged NO_CHANGELOG --- src/selectionmode/backgroundcolorhelper.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'src/selectionmode/backgroundcolorhelper.cpp') diff --git a/src/selectionmode/backgroundcolorhelper.cpp b/src/selectionmode/backgroundcolorhelper.cpp index fa3e55ac4..d1a25bace 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() -- cgit v1.3