mirror of
https://github.com/overte-org/overte.git
synced 2025-04-12 18:22:13 +02:00
keep qml text fields up to date with vive virtual keyboard
This commit is contained in:
parent
f71a59276c
commit
6e7b828203
1 changed files with 10 additions and 2 deletions
|
@ -170,8 +170,7 @@ void showOpenVrKeyboard(bool show = true) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void finishOpenVrKeyboardInput() {
|
void updateFromOpenVrKeyboardInput() {
|
||||||
auto offscreenUi = DependencyManager::get<OffscreenUi>();
|
|
||||||
auto chars = _overlay->GetKeyboardText(textArray, 8192);
|
auto chars = _overlay->GetKeyboardText(textArray, 8192);
|
||||||
auto newText = QString(QByteArray(textArray, chars));
|
auto newText = QString(QByteArray(textArray, chars));
|
||||||
_keyboardFocusObject->setProperty("text", newText);
|
_keyboardFocusObject->setProperty("text", newText);
|
||||||
|
@ -181,6 +180,10 @@ void finishOpenVrKeyboardInput() {
|
||||||
//QInputMethodEvent event(_existingText, QList<QInputMethodEvent::Attribute>());
|
//QInputMethodEvent event(_existingText, QList<QInputMethodEvent::Attribute>());
|
||||||
//event.setCommitString(newText, 0, _existingText.size());
|
//event.setCommitString(newText, 0, _existingText.size());
|
||||||
//qApp->sendEvent(_keyboardFocusObject, &event);
|
//qApp->sendEvent(_keyboardFocusObject, &event);
|
||||||
|
}
|
||||||
|
void finishOpenVrKeyboardInput() {
|
||||||
|
auto offscreenUi = DependencyManager::get<OffscreenUi>();
|
||||||
|
updateFromOpenVrKeyboardInput();
|
||||||
// Simulate an enter press on the top level window to trigger the action
|
// Simulate an enter press on the top level window to trigger the action
|
||||||
if (0 == (_currentHints & Qt::ImhMultiLine)) {
|
if (0 == (_currentHints & Qt::ImhMultiLine)) {
|
||||||
qApp->sendEvent(offscreenUi->getWindow(), &QKeyEvent(QEvent::KeyPress, Qt::Key_Return, Qt::KeyboardModifiers(), QString("\n")));
|
qApp->sendEvent(offscreenUi->getWindow(), &QKeyEvent(QEvent::KeyPress, Qt::Key_Return, Qt::KeyboardModifiers(), QString("\n")));
|
||||||
|
@ -261,6 +264,11 @@ void handleOpenVrEvents() {
|
||||||
QMetaObject::invokeMethod(qApp, "quit");
|
QMetaObject::invokeMethod(qApp, "quit");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case vr::VREvent_KeyboardCharInput:
|
||||||
|
// Make the focused field match the keyboard results, inclusive of combining characters and such.
|
||||||
|
updateFromOpenVrKeyboardInput();
|
||||||
|
break;
|
||||||
|
|
||||||
case vr::VREvent_KeyboardDone:
|
case vr::VREvent_KeyboardDone:
|
||||||
finishOpenVrKeyboardInput();
|
finishOpenVrKeyboardInput();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue