mirror of
https://github.com/overte-org/overte.git
synced 2025-04-07 20:14:22 +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() {
|
||||
auto offscreenUi = DependencyManager::get<OffscreenUi>();
|
||||
void updateFromOpenVrKeyboardInput() {
|
||||
auto chars = _overlay->GetKeyboardText(textArray, 8192);
|
||||
auto newText = QString(QByteArray(textArray, chars));
|
||||
_keyboardFocusObject->setProperty("text", newText);
|
||||
|
@ -181,6 +180,10 @@ void finishOpenVrKeyboardInput() {
|
|||
//QInputMethodEvent event(_existingText, QList<QInputMethodEvent::Attribute>());
|
||||
//event.setCommitString(newText, 0, _existingText.size());
|
||||
//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
|
||||
if (0 == (_currentHints & Qt::ImhMultiLine)) {
|
||||
qApp->sendEvent(offscreenUi->getWindow(), &QKeyEvent(QEvent::KeyPress, Qt::Key_Return, Qt::KeyboardModifiers(), QString("\n")));
|
||||
|
@ -261,6 +264,11 @@ void handleOpenVrEvents() {
|
|||
QMetaObject::invokeMethod(qApp, "quit");
|
||||
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:
|
||||
finishOpenVrKeyboardInput();
|
||||
|
||||
|
|
Loading…
Reference in a new issue