Skip to content
Snippets Groups Projects
Unverified Commit d372158d authored by q234rty's avatar q234rty
Browse files

Trigger less QEvent::ApplicationPaletteChange

The event seems to be very expensive on certain platform theme plugins.

Fixes #1639
parent 021eed83
No related branches found
No related tags found
No related merge requests found
Pipeline #5395 failed
......@@ -201,9 +201,14 @@ NhekoFixupPaletteEventFilter::eventFilter(QObject *obj, QEvent *event)
// reason?!?
if (event->type() == QEvent::ChildAdded &&
obj->metaObject()->className() == QStringLiteral("QQuickRootItem")) {
QSet<QWindow *> newWindows;
for (const auto window : QGuiApplication::topLevelWindows()) {
newWindows.insert(window);
if (m_postedWindows.contains(window))
continue;
QGuiApplication::postEvent(window, new QEvent(QEvent::ApplicationPaletteChange));
}
m_postedWindows.swap(newWindows);
}
return false;
}
......
......@@ -45,6 +45,9 @@ public:
}
bool eventFilter(QObject *obj, QEvent *event) override;
private:
QSet<QWindow *> m_postedWindows;
};
class MainWindow : public QQuickView
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment