diff --git a/src/modules/keyboard/KeyboardLayoutModel.h b/src/modules/keyboard/KeyboardLayoutModel.h index 9cb2da851..3eef595c3 100644 --- a/src/modules/keyboard/KeyboardLayoutModel.h +++ b/src/modules/keyboard/KeyboardLayoutModel.h @@ -91,6 +91,11 @@ private: int m_defaultPC105 = -1; ///< The index of pc105, if there is one }; +/** @brief A list of keyboard layouts (arrangements of keycaps) + * + * Layouts can have a list of associated Variants, so this + * is slightly more complicated than the "regular" XKBListModel. + */ class KeyboardLayoutModel : public QAbstractListModel { Q_OBJECT @@ -125,6 +130,12 @@ signals: void currentIndexChanged( int index ); }; +/** @brief A list of variants (xkb id and human-readable) + * + * The variants that are available depend on the Layout that is used, + * so the `setVariants()` function can be used to update the variants + * when the two models are related. + */ class KeyboardVariantsModel : public XKBListModel { Q_OBJECT diff --git a/src/modules/keyboard/KeyboardPage.cpp b/src/modules/keyboard/KeyboardPage.cpp index 28ed3d25a..cb8aada5b 100644 --- a/src/modules/keyboard/KeyboardPage.cpp +++ b/src/modules/keyboard/KeyboardPage.cpp @@ -106,29 +106,25 @@ KeyboardPage::KeyboardPage( Config* config, QWidget* parent ) void KeyboardPage::layoutChangedByUser( const QModelIndex& current, const QModelIndex& previous ) { - cDebug() << "index ->" << current.row(); m_config->keyboardLayouts()->setCurrentIndex( current.row() ); - cDebug() << Logger::SubEntry << "variants now" << m_config->keyboardVariants()->rowCount(); } void KeyboardPage::layoutChangedByConfig( int index ) { - cDebug() << "index ->" << index; ui->layoutSelector->setCurrentIndex( m_config->keyboardLayouts()->index( index ) ); - cDebug() << Logger::SubEntry << "variants now" << m_config->keyboardVariants()->rowCount(); } void KeyboardPage::variantChangedByUser( const QModelIndex& current, const QModelIndex& previous ) { - cDebug() << "index ->" << current.row(); + m_config->keyboardVariants()->setCurrentIndex( current.row() ); } void KeyboardPage::variantChangedByConfig( int index ) { - cDebug() << "index ->" << index; + ui->variantSelector->setCurrentIndex( m_config->keyboardVariants()->index( index ) ); } KeyboardPage::~KeyboardPage()