mirror of
https://invent.kde.org/system/dolphin
synced 2024-10-02 14:45:04 +00:00
Handle deprecation of QGuiApplication::paletteChanged
NO_CHANGELOG
This commit is contained in:
parent
06d81881b0
commit
a6313a5c98
|
@ -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);
|
||||
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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();
|
||||
|
||||
|
|
Loading…
Reference in a new issue