Merge pull request #12390 from druiz17/add-control-mapping

add control button mapping for controller API
This commit is contained in:
Seth Alves 2018-02-14 15:02:28 -08:00 committed by GitHub
commit d1c0f0a40f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 7 deletions

View file

@ -88,8 +88,8 @@
]
},
{ "from": "Keyboard.W", "to": "Actions.LONGITUDINAL_FORWARD" },
{ "from": "Keyboard.S", "to": "Actions.LONGITUDINAL_BACKWARD" },
{ "from": "Keyboard.W", "when": "!Keyboard.Control", "to": "Actions.LONGITUDINAL_FORWARD" },
{ "from": "Keyboard.S", "when": "!Keyboard.Control", "to": "Actions.LONGITUDINAL_BACKWARD" },
{ "from": "Keyboard.C", "to": "Actions.VERTICAL_DOWN" },
{ "from": "Keyboard.E", "to": "Actions.VERTICAL_UP" },
{ "from": "Keyboard.Left", "when": "Keyboard.RightMouseButton", "to": "Actions.LATERAL_LEFT" },

View file

@ -54,11 +54,9 @@ void KeyboardMouseDevice::InputDevice::focusOutEvent() {
void KeyboardMouseDevice::keyPressEvent(QKeyEvent* event) {
auto input = _inputDevice->makeInput((Qt::Key) event->key());
if (!(event->modifiers() & Qt::KeyboardModifier::ControlModifier)) {
auto result = _inputDevice->_buttonPressedMap.insert(input.getChannel());
if (result.second) {
// key pressed again ? without catching the release event ?
}
auto result = _inputDevice->_buttonPressedMap.insert(input.getChannel());
if (result.second) {
// key pressed again ? without catching the release event ?
}
}
@ -237,6 +235,7 @@ controller::Input::NamedVector KeyboardMouseDevice::InputDevice::getAvailableInp
availableInputs.append(Input::NamedPair(makeInput(Qt::Key_PageUp), QKeySequence(Qt::Key_PageUp).toString()));
availableInputs.append(Input::NamedPair(makeInput(Qt::Key_PageDown), QKeySequence(Qt::Key_PageDown).toString()));
availableInputs.append(Input::NamedPair(makeInput(Qt::Key_Tab), QKeySequence(Qt::Key_Tab).toString()));
availableInputs.append(Input::NamedPair(makeInput(Qt::Key_Control), "Control"));
availableInputs.append(Input::NamedPair(makeInput(Qt::LeftButton), "LeftMouseButton"));
availableInputs.append(Input::NamedPair(makeInput(Qt::MiddleButton), "MiddleMouseButton"));