1
0
mirror of https://invent.kde.org/system/dolphin synced 2024-07-02 16:31:23 +00:00

Handle deprecation of QGuiApplication::paletteChanged

NO_CHANGELOG
This commit is contained in:
Méven Car 2024-03-09 12:54:15 +01:00
parent 06d81881b0
commit a6313a5c98
3 changed files with 17 additions and 5 deletions

View File

@ -23,9 +23,9 @@
DolphinTabWidget::DolphinTabWidget(DolphinNavigatorsWidgetAction *navigatorsWidget, QWidget *parent)
: QTabWidget(parent)
, m_dragAndDropHelper{this}
, m_lastViewedTab(nullptr)
, m_navigatorsWidget{navigatorsWidget}
, m_dragAndDropHelper{this}
{
KAcceleratorManager::setNoAccel(this);

View File

@ -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()

View File

@ -9,6 +9,7 @@
#define BACKGROUNDCOLORHELPER_H
#include <QColor>
#include <QObject>
#include <QPointer>
#include <memory>
@ -21,8 +22,9 @@ namespace SelectionMode
/**
* @brief A Singleton class for managing the colors of selection mode widgets.
*/
class BackgroundColorHelper
class BackgroundColorHelper : public QObject
{
Q_OBJECT
public:
static BackgroundColorHelper *instance();
@ -32,6 +34,9 @@ public:
*/
void controlBackgroundColor(QWidget *widget);
protected:
bool eventFilter(QObject *obj, QEvent *event) override;
private:
BackgroundColorHelper();