forked from chili-epfl/Carpenter-App-RoofDesigner
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdisplaykeyboard.cpp
More file actions
46 lines (36 loc) · 1.17 KB
/
displaykeyboard.cpp
File metadata and controls
46 lines (36 loc) · 1.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#include "displaykeyboard.h"
#ifdef Q_OS_WIN32
#include <windows.h>
#include <objbase.h>
#include <Tchar.h>
#endif
DisplayKeyboard::DisplayKeyboard(QObject *parent) : QObject(parent)
{
keyboard = new QProcess(this);
}
DisplayKeyboard::~DisplayKeyboard() {
delete keyboard;
}
void DisplayKeyboard::textFieldFocus(QVariant field) {
qDebug() << "focus" << field;
#ifdef Q_OS_WIN
HWND wKB = FindWindow(TEXT("IPTip_Main_Window"), NULL);
if (wKB != NULL) {
ShellExecuteA(NULL, "open", "\"C:\\Program Files\\Common Files\\microsoft shared\\ink\\TabTip.exe\"", "", 0, SW_NORMAL);
}
#endif
}
void DisplayKeyboard::textFieldBlur(QVariant field) {
qDebug() << "blur" << field << processId;
#ifdef Q_OS_WIN
HWND wKB = FindWindow(TEXT("IPTip_Main_Window"), NULL);
if (wKB != NULL && IsWindowVisible(wKB)) {
PostMessage(wKB, WM_SYSCOMMAND, SC_CLOSE, 0);
}
#endif
}
void DisplayKeyboard::registerTextField(QObject *field) {
qDebug() << "register" << field;
field->connect(field, SIGNAL(gotFocus(QVariant)), this, SLOT(textFieldFocus(QVariant)));
field->connect(field, SIGNAL(lostFocus(QVariant)), this, SLOT(textFieldBlur(QVariant)));
}