DolphinTabWidget::DolphinTabWidget(DolphinNavigatorsWidgetAction *navigatorsWidget, QWidget *parent)
: QTabWidget(parent)
+ , m_dragAndDropHelper{this}
, m_lastViewedTab(nullptr)
, m_navigatorsWidget{navigatorsWidget}
- , m_dragAndDropHelper{this}
{
KAcceleratorManager::setNoAccel(this);
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()
#define BACKGROUNDCOLORHELPER_H
#include <QColor>
+#include <QObject>
#include <QPointer>
#include <memory>
/**
* @brief A Singleton class for managing the colors of selection mode widgets.
*/
-class BackgroundColorHelper
+class BackgroundColorHelper : public QObject
{
+ Q_OBJECT
public:
static BackgroundColorHelper *instance();
*/
void controlBackgroundColor(QWidget *widget);
+protected:
+ bool eventFilter(QObject *obj, QEvent *event) override;
+
private:
BackgroundColorHelper();