update tab indices properly when manipulating tab count

This commit is contained in:
Michael Zanetti 2018-09-26 12:29:53 +02:00
parent d9f9f30257
commit 798967b48f

View File

@ -27,12 +27,21 @@ Item {
function addTab() {
tabModel.append({})
settings.tabCount++;
swipeView.currentIndex = settings.tabCount - 1
tabbar.currentIndex = swipeView.currentIndex
}
function removeTab(index) {
remove(index);
settings.tabCount--;
tabbar.currentIndex = swipeView.currentIndex
orphanedSettings.lastConnectedHost = ""
}
}
Settings {
id: orphanedSettings
category: "tabSettings" + tabModel.count
property string lastConnectedHost
}
ColumnLayout {
anchors.fill: parent
@ -55,8 +64,7 @@ Item {
objectName: "pageStack"
initialItem: Page {}
Settings {
id: tabSettings
property var tabSettings: Settings {
category: "tabSettings" + index
property string lastConnectedHost
}