I created a simple Qt 5.3 GUI app that has 2 widgets - a QWebView and a QLineEdit. I default the URL to be google.com. But on a Windows 8.1 tablet that doesn't have a keyboard, the touch keyboard doesn't show up when you touch either the search box in Google.com or the line edit widget. Given that Microsoft, in its infinite wisdom, doesn't give a simple API to show the touch keyboard, how can this be fixed? I've done lots of searches on this problem and results are all over the place, from it has been fixed to it can't be done. Anyone else see this? Any work arounds?
Asked
Active
Viewed 1,283 times
2 Answers
0
You can open the touch keyboard manually. Check code examples in my answer here https://stackoverflow.com/a/40921638/332528
0
In my QML application, I use this to open the Windows keyboard (I use the signal focusChanged of a Textfield to open / close the keyboard, I simplify the code below removing the conditions "if click on same Textfield and other things" which depends on how I wanted to handle the keyboard):
#include <shellapi.h>
#include <Windows.h>
void openKeyboard()
{
HANDLE hWnd = FindWindow("OSKMainClass", NULL);
if (!hWnd) //if not open yet
{
void *OldValue;
Wow64DisableWow64FsRedirection(&OldValue);
ShellExecute(NULL, "open", "C:\\Program Files\\Common Files\\microsoft shared\\ink\\tabtip.exe", NULL, NULL, SW_SHOWNORMAL); //or "C:pathTo\\osk.exe"
Wow64RevertWow64FsRedirection(OldValue);
}
}
void closeKeyboard()
{
if (mKeyboardOpenRequestsNumber == 0)
{
HANDLE hWnd = FindWindow("IPTip_Main_Window", NULL); //or "OSKMainClass" if osk.exe is used.
if (hWnd) //if keyboard window is found
PostMessage((HWND)hWnd, WM_SYSCOMMAND, SC_CLOSE, 0);
}
}

SteveTJS
- 635
- 17
- 32