Fix the current index when removing a configured host
This commit is contained in:
parent
0abd282821
commit
aad5cc26d8
@ -120,6 +120,11 @@ void ConfiguredHostsModel::removeHost(int index)
|
||||
if (m_list.isEmpty()) {
|
||||
createHost();
|
||||
}
|
||||
|
||||
if (m_currentIndex >= m_list.count()) {
|
||||
m_currentIndex = m_list.count() - 1;
|
||||
emit currentIndexChanged();
|
||||
}
|
||||
}
|
||||
|
||||
int ConfiguredHostsModel::indexOf(ConfiguredHost *host) const
|
||||
|
||||
@ -8,7 +8,7 @@ Drawer {
|
||||
id: root
|
||||
|
||||
property ConfiguredHostsModel configuredHosts: null
|
||||
readonly property Engine currentEngine: configuredHosts.get(configuredHosts.currentIndex).engine
|
||||
readonly property Engine currentEngine: configuredHosts.count > 0 ? configuredHosts.get(configuredHosts.currentIndex).engine : null
|
||||
|
||||
signal openThingSettings();
|
||||
signal openMagicSettings();
|
||||
|
||||
Reference in New Issue
Block a user