mirror of
https://github.com/overte-org/overte.git
synced 2025-04-20 04:44:11 +02:00
Initial prototype for VR keyboard shortcuts
This commit is contained in:
parent
1e07398dc4
commit
ea1c6567cf
6 changed files with 139 additions and 1 deletions
|
@ -811,6 +811,81 @@
|
|||
"z": 0.707
|
||||
}
|
||||
},
|
||||
{
|
||||
"key": "Copy",
|
||||
"type": "copy",
|
||||
"dimensions": {
|
||||
"x": 0.04787999764084816,
|
||||
"z": 0.020519999787211418,
|
||||
"y": 0.04787999764084816
|
||||
},
|
||||
"position": {
|
||||
"x": -0.65333323516845703,
|
||||
"y": 0.019300000742077827,
|
||||
"z": -0.07
|
||||
},
|
||||
"modelURL": "meshes/keyboard/SM_key.fbx",
|
||||
"texture": {
|
||||
"file9": "meshes/keyboard/key_copy.png",
|
||||
"file10": "meshes/keyboard/key_copy.png"
|
||||
},
|
||||
"localOrientation": {
|
||||
"w": 0.000,
|
||||
"x": 0.000,
|
||||
"y": 0.707,
|
||||
"z": 0.707
|
||||
}
|
||||
},
|
||||
{
|
||||
"key": "Paste",
|
||||
"type": "paste",
|
||||
"dimensions": {
|
||||
"x": 0.04787999764084816,
|
||||
"z": 0.020519999787211418,
|
||||
"y": 0.04787999764084816
|
||||
},
|
||||
"position": {
|
||||
"x": -0.65333323516845703,
|
||||
"y": 0.019300000742077827,
|
||||
"z": -0.12
|
||||
},
|
||||
"modelURL": "meshes/keyboard/SM_key.fbx",
|
||||
"texture": {
|
||||
"file9": "meshes/keyboard/key_paste.png",
|
||||
"file10": "meshes/keyboard/key_paste.png"
|
||||
},
|
||||
"localOrientation": {
|
||||
"w": 0.000,
|
||||
"x": 0.000,
|
||||
"y": 0.707,
|
||||
"z": 0.707
|
||||
}
|
||||
},
|
||||
{
|
||||
"key": "Select All",
|
||||
"type": "select_all",
|
||||
"dimensions": {
|
||||
"x": 0.04787999764084816,
|
||||
"z": 0.020519999787211418,
|
||||
"y": 0.04787999764084816
|
||||
},
|
||||
"position": {
|
||||
"x": -0.65333323516845703,
|
||||
"y": 0.019300000742077827,
|
||||
"z": -0.02
|
||||
},
|
||||
"modelURL": "meshes/keyboard/SM_key.fbx",
|
||||
"texture": {
|
||||
"file9": "meshes/keyboard/key_select_all.png",
|
||||
"file10": "meshes/keyboard/key_select_all.png"
|
||||
},
|
||||
"localOrientation": {
|
||||
"w": 0.000,
|
||||
"x": 0.000,
|
||||
"y": 0.707,
|
||||
"z": 0.707
|
||||
}
|
||||
},
|
||||
{
|
||||
"key": "numbers",
|
||||
"type": "layer",
|
||||
|
|
BIN
interface/resources/meshes/keyboard/key_copy.png
Normal file
BIN
interface/resources/meshes/keyboard/key_copy.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.3 KiB |
BIN
interface/resources/meshes/keyboard/key_paste.png
Normal file
BIN
interface/resources/meshes/keyboard/key_paste.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.3 KiB |
BIN
interface/resources/meshes/keyboard/key_select_all.png
Normal file
BIN
interface/resources/meshes/keyboard/key_select_all.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.4 KiB |
|
@ -84,6 +84,9 @@ static const QString LAYER_STRING = "layer";
|
|||
static const QString BACKSPACE_STRING = "backspace";
|
||||
static const QString SPACE_STRING = "space";
|
||||
static const QString ENTER_STRING = "enter";
|
||||
static const QString COPY_STRING = "copy";
|
||||
static const QString PASTE_STRING = "paste";
|
||||
static const QString SELECT_ALL_STRING = "select_all";
|
||||
|
||||
static const QString KEY_HOVER_HIGHLIGHT = "keyHoverHiglight";
|
||||
static const QString KEY_PRESSED_HIGHLIGHT = "keyPressesHighlight";
|
||||
|
@ -204,6 +207,12 @@ Key::Type Key::getKeyTypeFromString(const QString& keyTypeString) {
|
|||
return Type::CLOSE;
|
||||
} else if (keyTypeString == ENTER_STRING) {
|
||||
return Type::ENTER;
|
||||
} else if (keyTypeString == COPY_STRING) {
|
||||
return Type::COPY;
|
||||
} else if (keyTypeString == PASTE_STRING) {
|
||||
return Type::PASTE;
|
||||
} else if (keyTypeString == SELECT_ALL_STRING) {
|
||||
return Type::SELECT_ALL;
|
||||
}
|
||||
|
||||
return Type::CHARACTER;
|
||||
|
@ -573,6 +582,57 @@ void Keyboard::handleTriggerBegin(const QUuid& id, const PointerEvent& event) {
|
|||
_typedCharacters.clear();
|
||||
updateTextDisplay();
|
||||
break;
|
||||
// TODO, macOS: If macOS support comes back, these should be revisited
|
||||
case Key::Type::COPY: {
|
||||
QKeyEvent* pressEvent = new QKeyEvent(QEvent::KeyPress, Qt::Key_C, Qt::ControlModifier);
|
||||
QKeyEvent* releaseEvent = new QKeyEvent(QEvent::KeyRelease, Qt::Key_C, Qt::ControlModifier);
|
||||
|
||||
if (_inputToHudUI) {
|
||||
QCoreApplication::postEvent(qApp->getPrimaryWidget(), pressEvent);
|
||||
QCoreApplication::postEvent(qApp->getPrimaryWidget(), releaseEvent);
|
||||
} else {
|
||||
QCoreApplication::postEvent(QCoreApplication::instance(), pressEvent);
|
||||
QCoreApplication::postEvent(QCoreApplication::instance(), releaseEvent);
|
||||
}
|
||||
|
||||
_typedCharacters.clear();
|
||||
updateTextDisplay();
|
||||
return;
|
||||
}
|
||||
// TODO, macOS: If macOS support comes back, these should be revisited
|
||||
case Key::Type::PASTE: {
|
||||
QKeyEvent* pressEvent = new QKeyEvent(QEvent::KeyPress, Qt::Key_V, Qt::ControlModifier);
|
||||
QKeyEvent* releaseEvent = new QKeyEvent(QEvent::KeyRelease, Qt::Key_V, Qt::ControlModifier);
|
||||
|
||||
if (_inputToHudUI) {
|
||||
QCoreApplication::postEvent(qApp->getPrimaryWidget(), pressEvent);
|
||||
QCoreApplication::postEvent(qApp->getPrimaryWidget(), releaseEvent);
|
||||
} else {
|
||||
QCoreApplication::postEvent(QCoreApplication::instance(), pressEvent);
|
||||
QCoreApplication::postEvent(QCoreApplication::instance(), releaseEvent);
|
||||
}
|
||||
|
||||
_typedCharacters.clear();
|
||||
updateTextDisplay();
|
||||
return;
|
||||
}
|
||||
// TODO, macOS: If macOS support comes back, these should be revisited
|
||||
case Key::Type::SELECT_ALL: {
|
||||
QKeyEvent* pressEvent = new QKeyEvent(QEvent::KeyPress, Qt::Key_A, Qt::ControlModifier);
|
||||
QKeyEvent* releaseEvent = new QKeyEvent(QEvent::KeyRelease, Qt::Key_A, Qt::ControlModifier);
|
||||
|
||||
if (_inputToHudUI) {
|
||||
QCoreApplication::postEvent(qApp->getPrimaryWidget(), pressEvent);
|
||||
QCoreApplication::postEvent(qApp->getPrimaryWidget(), releaseEvent);
|
||||
} else {
|
||||
QCoreApplication::postEvent(QCoreApplication::instance(), pressEvent);
|
||||
QCoreApplication::postEvent(QCoreApplication::instance(), releaseEvent);
|
||||
}
|
||||
|
||||
_typedCharacters.clear();
|
||||
updateTextDisplay();
|
||||
return;
|
||||
}
|
||||
case Key::Type::CHARACTER:
|
||||
if (keyString != " ") {
|
||||
_typedCharacters.push_back((_password ? "*" : keyString));
|
||||
|
|
|
@ -40,7 +40,10 @@ public:
|
|||
LAYER,
|
||||
BACKSPACE,
|
||||
SPACE,
|
||||
ENTER
|
||||
ENTER,
|
||||
COPY,
|
||||
PASTE,
|
||||
SELECT_ALL,
|
||||
};
|
||||
|
||||
static Key::Type getKeyTypeFromString(const QString& keyTypeString);
|
||||
|
|
Loading…
Reference in a new issue