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