Merge pull request #1657 from q234rty/use-dynamic-properties

Use dynamic properties for NhekoFixupPaletteEventFilter
This commit is contained in:
DeepBlueV7.X 2024-01-08 20:24:50 +01:00 committed by GitHub
commit ee727ba422
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 7 deletions

View file

@ -201,14 +201,12 @@ NhekoFixupPaletteEventFilter::eventFilter(QObject *obj, QEvent *event)
// reason?!? // reason?!?
if (event->type() == QEvent::ChildAdded && if (event->type() == QEvent::ChildAdded &&
obj->metaObject()->className() == QStringLiteral("QQuickRootItem")) { obj->metaObject()->className() == QStringLiteral("QQuickRootItem")) {
QSet<QWindow *> newWindows;
for (const auto window : QGuiApplication::topLevelWindows()) { for (const auto window : QGuiApplication::topLevelWindows()) {
newWindows.insert(window); if (window->property("posted").isValid())
if (m_postedWindows.contains(window))
continue; continue;
QGuiApplication::postEvent(window, new QEvent(QEvent::ApplicationPaletteChange)); QGuiApplication::postEvent(window, new QEvent(QEvent::ApplicationPaletteChange));
window->setProperty("posted", true);
} }
m_postedWindows.swap(newWindows);
} }
return false; return false;
} }

View file

@ -45,9 +45,6 @@ public:
} }
bool eventFilter(QObject *obj, QEvent *event) override; bool eventFilter(QObject *obj, QEvent *event) override;
private:
QSet<QWindow *> m_postedWindows;
}; };
class MainWindow : public QQuickView class MainWindow : public QQuickView