Can not display qt virtual keyboard.
-
Could somebody give me a help? Thanks!
Recently, I am designing a QT Widgets Application for fun. But there is a problem I can't fix.
I want to use qtvirtualkeuboard. It works at the begining.
But when I change the application to full screen, it doesn't work. I think the qtvirtualkeyboard is opened but not displayed topmost.
The code is shown as bellow.
When I use w.show(), it works. It can open virtualkeyboard when click a QLineEdit.
int main(int argc, char *argv[])
{
qputenv("QT_IM_MODULE", QByteArray("qtvirtualkeyboard"));QApplication a(argc, argv); MainWindow w; w.show(); return a.exec();
}
When I use w.showFullScreen(), it doesn't work. It can't open virtualkeyboard when click a QLineEdit.
int main(int argc, char *argv[])
{
qputenv("QT_IM_MODULE", QByteArray("qtvirtualkeyboard"));QApplication a(argc, argv); MainWindow w; w.showFullScreen(); return a.exec();
}
I don't the reason. Could somebody tell me the reason and teach me how to change the code of my application or the source code of qtvirtualkeyboard, please?
Thanks!
-
Hi,
What version of Qt are you using ?
On what platform ?
With which compiler ? -
@SGaist
Hi SGaist,I use Qt5.9.1.
And it doesn't work on either Windows 7 or Ubuntu 16.04.
For Windows 7, I use MSVC2013 64bit. And for Ubuntu 16.04, I use GCC 64bit.By the way, I find out something. On Windows 7. If I use opengl in my application code, such as QOpenGLWidget and QOpenGLFunctions_2_0, it will not work. But if I don't use opengl, it will work.
But on Ubuntu 16.04, no matter I use opengl whether or not, it doen't work.Windows 7
Ubuntu 16.04
Thanks!
-
What happens if you maximize the window after the keyboard is shown ?
-
@SGaist
I don't understand you clearly.If I use w.show(), it works normally, no matter maximize or normal the window.
If I use w.showFullScreen(), it doesn't work. And I can't change the size of the window.
Maybe, you mean I use w.show() first, after the virtualkeyboard appears, I change the window to maximize by setting windows flags. Am I right? I didn't try this.
Thank you!
-
Yes, that's that. Start using show, and after that go full screen.