diff --git a/src/Joystick/Joystick.cc b/src/Joystick/Joystick.cc index e3e5e8c9f8feeea29abb4bbfcd439fb8564fdb73..cd7aab9e103102809e207f170af1d336ae2f8a3f 100644 --- a/src/Joystick/Joystick.cc +++ b/src/Joystick/Joystick.cc @@ -280,7 +280,7 @@ void Joystick::_loadSettings() for (int button = 0; button < _totalButtonCount; button++) { QString a = settings.value(QString(_buttonActionNameKey).arg(button), QString()).toString(); - if(!a.isEmpty() && _findAssignableButtonAction(a) >= 0 && a != _buttonActionNone) { + if(!a.isEmpty() && a != _buttonActionNone) { if(_buttonActionArray[button]) { _buttonActionArray[button]->deleteLater(); } diff --git a/src/VehicleSetup/JoystickConfigButtons.qml b/src/VehicleSetup/JoystickConfigButtons.qml index 9dc274c232c0ba8fabe0de343107da8564fbd396..10d6ad7aa240e71622092464991de57b075c2176 100644 --- a/src/VehicleSetup/JoystickConfigButtons.qml +++ b/src/VehicleSetup/JoystickConfigButtons.qml @@ -75,16 +75,18 @@ Item { id: buttonActionCombo width: ScreenTools.defaultFontPixelWidth * 26 model: _activeJoystick ? _activeJoystick.assignableActionTitles : [] - onActivated: { - _activeJoystick.setButtonAction(modelData, textAt(index)) - } - Component.onCompleted: { + + function _findCurrentButtonAction() { if(_activeJoystick) { var i = find(_activeJoystick.buttonActions[modelData]) if(i < 0) i = 0 currentIndex = i } } + + Component.onCompleted: _findCurrentButtonAction() + onModelChanged: _findCurrentButtonAction() + onActivated: _activeJoystick.setButtonAction(modelData, textAt(index)) } QGCCheckBox { id: repeatCheck