GlobalShortcut: Handle window being set at creation
Qt seems to have changed the timing around an object getting its
Window. This made it possible to reach componentComplete with a window
already set, meaning that windowChanged never fired after being
connected. This caused the GlobalShortcut to never be set.
commitdf1185e2fdcaa78133740ce47026a98e02043614
authorDalton Durst <dalton@ubports.com>
dateSun 17 Jan 2021, 21:08 (6 years ago)
parent6119aaf
plugins/GlobalShortcut/globalshortcut.cpp+3
@@ -58,6 +58,9 @@ void GlobalShortcut::setActive(bool active)
5858
5959void GlobalShortcut::componentComplete()
6060{
61+ if (this->window()) {
62+ QMetaObject::invokeMethod(this, "setupFilterOnWindow", Q_ARG(QQuickWindow*, this->window()));
63+ }
6164 connect(this, &QQuickItem::windowChanged, this, &GlobalShortcut::setupFilterOnWindow);
6265}
6366