Solved How to get pointer to QQuickWindow with keyboard
-
Hi,
I'm using qt widgets on embedded device and using qml virtual keyboard. I .pro file I have
CONFIG += disable-desktop
I have problem that keyboard is shown as a fullscreen and overlap all my application
Operation system is yocto. I found some topics and bug reports about this.
For example here:
https://bugreports.qt.io/browse/QTBUG-65884At article https://stackoverflow.com/questions/61608431/virtual-keyboard-top-black-screen-in-yocto
is described a hack how to solve this problem. So now I know what I must do, but don't know exactly how to do it.My problem is how to find pointer to QQuickWindow wich contains virtual keyboard. I tried use
QApplication::allWidgets()
but the window isn't here.
Thank you for your help.
-
Finally I found a solution.
QGuiApplication::allWindows()
Is the trick. Code like this solved my problem.
for(QWindow * w: QGuiApplication::allWindows()) { if(std::strcmp(w->metaObject()->className(), "QtVirtualKeyboard::InputView") == 0){ if(QObject *keyboard = w->findChild<QObject *>("keyboard")){ QRect r = w->geometry(); r.moveTop(keyboard->property("y").toDouble()); w->setMask(r); return; } } }