[keyboard] Restore the notion of PC105 default index
This commit is contained in:
parent
6aedf4401f
commit
193efe1710
@ -19,11 +19,17 @@ KeyboardModelsModel::KeyboardModelsModel( QObject* parent )
|
|||||||
{
|
{
|
||||||
// The models map is from human-readable names (!) to xkb identifier
|
// The models map is from human-readable names (!) to xkb identifier
|
||||||
const auto models = KeyboardGlobal::getKeyboardModels();
|
const auto models = KeyboardGlobal::getKeyboardModels();
|
||||||
|
int index = 0;
|
||||||
for ( const auto& key : models.keys() )
|
for ( const auto& key : models.keys() )
|
||||||
{
|
{
|
||||||
// So here *key* is the key in the map, which is the human-readable thing,
|
// So here *key* is the key in the map, which is the human-readable thing,
|
||||||
// while the struct fields are xkb-id, and human-readable
|
// while the struct fields are xkb-id, and human-readable
|
||||||
m_list << ModelInfo { models[ key ], key };
|
m_list << ModelInfo { models[ key ], key };
|
||||||
|
if ( models[ key ] == "pc105" )
|
||||||
|
{
|
||||||
|
m_defaultPC105 = index;
|
||||||
|
}
|
||||||
|
index++;
|
||||||
}
|
}
|
||||||
|
|
||||||
cDebug() << "Loaded" << m_list.count() << "keyboard models";
|
cDebug() << "Loaded" << m_list.count() << "keyboard models";
|
||||||
|
@ -54,6 +54,8 @@ public:
|
|||||||
QHash< int, QByteArray > roleNames() const override;
|
QHash< int, QByteArray > roleNames() const override;
|
||||||
|
|
||||||
void setCurrentIndex( int index );
|
void setCurrentIndex( int index );
|
||||||
|
/// @brief Set the index back to PC105 (the default physical model)
|
||||||
|
void setCurrentIndex() { setCurrentIndex( m_defaultPC105 ); }
|
||||||
int currentIndex() const { return m_currentIndex; }
|
int currentIndex() const { return m_currentIndex; }
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
@ -68,7 +70,8 @@ private:
|
|||||||
QString label;
|
QString label;
|
||||||
};
|
};
|
||||||
QVector< ModelInfo > m_list;
|
QVector< ModelInfo > m_list;
|
||||||
int m_currentIndex;
|
int m_currentIndex = -1;
|
||||||
|
int m_defaultPC105 = -1; ///< The index of pc105, if there is one
|
||||||
};
|
};
|
||||||
|
|
||||||
class KeyboardLayoutModel : public QAbstractListModel
|
class KeyboardLayoutModel : public QAbstractListModel
|
||||||
|
Loading…
Reference in New Issue
Block a user