From f90ad72d9e752ea53656bdee2bd92e938bda02c3 Mon Sep 17 00:00:00 2001 From: Roland Winklmeier Date: Fri, 5 Oct 2018 21:52:14 +0200 Subject: [PATCH] CJoystickButton fixes --- src/blackmisc/input/joystickbutton.cpp | 17 +++++++---------- src/blackmisc/input/joystickbutton.h | 2 +- 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/src/blackmisc/input/joystickbutton.cpp b/src/blackmisc/input/joystickbutton.cpp index 70447c4b6..4aac857a8 100644 --- a/src/blackmisc/input/joystickbutton.cpp +++ b/src/blackmisc/input/joystickbutton.cpp @@ -32,7 +32,8 @@ namespace BlackMisc void CJoystickButton::setButtonObject(CJoystickButton button) { - this->m_buttonIndex = button.m_buttonIndex; + m_deviceName = button.m_deviceName; + m_buttonIndex = button.m_buttonIndex; } void CJoystickButton::setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant) @@ -48,7 +49,7 @@ namespace BlackMisc case IndexButtonAsString: this->setButtonIndex(buttonIndexFromString(variant.value())); break; - case IndeButtonObject: + case IndexButtonObject: this->setButtonObject(variant.value()); break; default: @@ -63,14 +64,10 @@ namespace BlackMisc ColumnIndex i = index.frontCasted(); switch (i) { - case IndexDeviceName: - return CVariant::from(this->getDeviceName()); - case IndexButton: - return CVariant::from(this->getButtonIndex()); - case IndexButtonAsString: - return CVariant::from(this->getButtonAsString()); - default: - break; + case IndexDeviceName: return CVariant::from(this->getDeviceName()); + case IndexButton: return CVariant::from(this->getButtonIndex()); + case IndexButtonAsString: return CVariant::from(this->getButtonAsString()); + case IndexButtonObject: return CVariant::from(*this); } Q_ASSERT_X(false, "CJoystickButton", "index unknown"); diff --git a/src/blackmisc/input/joystickbutton.h b/src/blackmisc/input/joystickbutton.h index 5d9d877ed..381aa345d 100644 --- a/src/blackmisc/input/joystickbutton.h +++ b/src/blackmisc/input/joystickbutton.h @@ -36,7 +36,7 @@ namespace BlackMisc IndexDeviceName = CPropertyIndex::GlobalIndexCJoystickButton, IndexButton, IndexButtonAsString, - IndeButtonObject, // just for updates + IndexButtonObject, // just for updates }; //! Default constructor