Ref T404, style

This commit is contained in:
Klaus Basan
2018-11-07 02:57:09 +01:00
parent 554ab4aa01
commit c862136126
2 changed files with 15 additions and 18 deletions

View File

@@ -31,12 +31,12 @@ namespace BlackMisc
QString CKeyboardKey::convertToQString(bool /* i18n */) const QString CKeyboardKey::convertToQString(bool /* i18n */) const
{ {
return getKeyAsString(); return this->getKeyAsString();
} }
void CKeyboardKey::setKeyObject(CKeyboardKey key) void CKeyboardKey::setKeyObject(CKeyboardKey key)
{ {
this->m_keyCode = key.m_keyCode; m_keyCode = key.m_keyCode;
} }
QString CKeyboardKey::getKeyAsString() const QString CKeyboardKey::getKeyAsString() const
@@ -90,15 +90,12 @@ namespace BlackMisc
CVariant CKeyboardKey::propertyByIndex(const BlackMisc::CPropertyIndex &index) const CVariant CKeyboardKey::propertyByIndex(const BlackMisc::CPropertyIndex &index) const
{ {
if (index.isMyself()) { return CVariant::from(*this); } if (index.isMyself()) { return CVariant::from(*this); }
ColumnIndex i = index.frontCasted<ColumnIndex>(); const ColumnIndex i = index.frontCasted<ColumnIndex>();
switch (i) switch (i)
{ {
case IndexKey: case IndexKey: return CVariant::from(m_keyCode);
return CVariant::from(this->m_keyCode); case IndexKeyAsString: return CVariant::from(getKeyAsString());
case IndexKeyAsString: default: break;
return CVariant::from(getKeyAsString());
default:
break;
} }
Q_ASSERT_X(false, "CKeyboardKey", "index unknown"); Q_ASSERT_X(false, "CKeyboardKey", "index unknown");
@@ -124,5 +121,5 @@ namespace BlackMisc
break; break;
} }
} }
} // namespace Hardware } // ns
} // BlackMisc } // ns

View File

@@ -46,19 +46,19 @@ namespace BlackMisc
CKeyboardKey(BlackMisc::Input::KeyCode keyCode); CKeyboardKey(BlackMisc::Input::KeyCode keyCode);
//! Get key code //! Get key code
KeyCode getKey() const { return this->m_keyCode; } KeyCode getKey() const { return m_keyCode; }
//! Get key code //! Get key code
QString getKeyAsString() const; QString getKeyAsString() const;
//! Set key code //! Set key code
void setKey(KeyCode key) { this->m_keyCode = key; } void setKey(KeyCode key) { m_keyCode = key; }
//! Set key code //! Set key code
void setKey(int key) { this->m_keyCode = static_cast<KeyCode>(key); } void setKey(int key) { m_keyCode = static_cast<KeyCode>(key); }
//! Set key code //! Set key code
void setKey(char key) { this->m_keyCode = static_cast<KeyCode>(key); } void setKey(char key) { m_keyCode = static_cast<KeyCode>(key); }
//! Is unknown? //! Is unknown?
bool isUnknown() const { return !this->hasKey(); } bool isUnknown() const { return !this->hasKey(); }
@@ -72,7 +72,7 @@ namespace BlackMisc
//! with key? //! with key?
bool hasKey() const bool hasKey() const
{ {
return !(this->m_keyCode == KeyCode::Key_Unknown); return !(m_keyCode == KeyCode::Key_Unknown);
} }
//! Set key object //! Set key object
@@ -97,8 +97,8 @@ namespace BlackMisc
BLACK_METAMEMBER(keyCode) BLACK_METAMEMBER(keyCode)
); );
}; };
} } // ns
} } // ns
Q_DECLARE_METATYPE(BlackMisc::Input::CKeyboardKey) Q_DECLARE_METATYPE(BlackMisc::Input::CKeyboardKey)