mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-11-22 11:00:48 +03:00
Merge pull request #1640 from q234rty/fix-slow-new-window-plasma-6
Trigger less QEvent::ApplicationPaletteChange
This commit is contained in:
commit
c31c440fb7
2 changed files with 8 additions and 0 deletions
|
@ -201,9 +201,14 @@ 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 (m_postedWindows.contains(window))
|
||||||
|
continue;
|
||||||
QGuiApplication::postEvent(window, new QEvent(QEvent::ApplicationPaletteChange));
|
QGuiApplication::postEvent(window, new QEvent(QEvent::ApplicationPaletteChange));
|
||||||
}
|
}
|
||||||
|
m_postedWindows.swap(newWindows);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,6 +45,9 @@ 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
|
||||||
|
|
Loading…
Reference in a new issue