HSplitView with state saving and default props

This commit is contained in:
miruka 2019-12-13 17:19:47 -04:00
parent 51c68cf998
commit ff7393b7c3
2 changed files with 22 additions and 2 deletions

View File

@ -0,0 +1,17 @@
import QtQuick.Controls 2.12
SwipeView {
currentIndex: window.getState(this, "currentIndex", defaultIndex)
onCurrentIndexChanged: window.saveState(this)
property string saveName: ""
property var saveId: "ALL"
property var saveProperties: ["currentIndex"]
property int defaultIndex: 0
property bool changed: currentIndex !== defaultIndex
function reset() { setCurrentIndex(defaultIndex) }
}

View File

@ -57,10 +57,13 @@ HDrawer {
} }
} }
SwipeView { HSwipeView {
id: swipeView id: swipeView
clip: true
interactive: ! roomPane.collapsed interactive: ! roomPane.collapsed
currentIndex: 4 // XXX
saveName: "roomPaneView"
saveId: chat.roomId
Layout.fillWidth: true Layout.fillWidth: true
Layout.fillHeight: true Layout.fillHeight: true