diff --git a/src/modules/keyboard/KeyboardLayoutModel.cpp b/src/modules/keyboard/KeyboardLayoutModel.cpp index 5ecc4ccb1..b8cb892f4 100644 --- a/src/modules/keyboard/KeyboardLayoutModel.cpp +++ b/src/modules/keyboard/KeyboardLayoutModel.cpp @@ -183,15 +183,18 @@ KeyboardLayoutModel::roleNames() const } void -KeyboardLayoutModel::setCurrentIndex( const int& index ) +KeyboardLayoutModel::setCurrentIndex( int index ) { if ( index >= m_layouts.count() || index < 0 ) { return; } - m_currentIndex = index; - emit currentIndexChanged( m_currentIndex ); + if ( m_currentIndex != index ) + { + m_currentIndex = index; + emit currentIndexChanged( m_currentIndex ); + } } int diff --git a/src/modules/keyboard/KeyboardLayoutModel.h b/src/modules/keyboard/KeyboardLayoutModel.h index 3eef595c3..60747da55 100644 --- a/src/modules/keyboard/KeyboardLayoutModel.h +++ b/src/modules/keyboard/KeyboardLayoutModel.h @@ -114,7 +114,7 @@ public: QVariant data( const QModelIndex& index, int role ) const override; - void setCurrentIndex( const int& index ); + void setCurrentIndex( int index ); int currentIndex() const; const QPair< QString, KeyboardGlobal::KeyboardInfo > item( const int& index ) const;