2019-12-19 22:46:16 +11:00
|
|
|
// SPDX-License-Identifier: LGPL-3.0-or-later
|
|
|
|
|
2019-12-14 08:54:32 +11:00
|
|
|
import QtQuick 2.12
|
2019-12-14 08:19:47 +11:00
|
|
|
import QtQuick.Controls 2.12
|
|
|
|
|
|
|
|
SwipeView {
|
2019-12-14 08:54:32 +11:00
|
|
|
Component.onCompleted: if (! changed) {
|
2019-12-14 08:59:58 +11:00
|
|
|
if (becomeKeyboardTabsTarget) shortcuts.tabsTarget = this
|
2019-12-14 08:54:32 +11:00
|
|
|
setCurrentIndex(window.getState(this, "currentIndex", defaultIndex))
|
|
|
|
saveEnabled = true
|
|
|
|
}
|
|
|
|
|
|
|
|
onCurrentIndexChanged: if (saveEnabled) window.saveState(this)
|
2019-12-14 08:19:47 +11:00
|
|
|
|
|
|
|
|
|
|
|
property string saveName: ""
|
|
|
|
property var saveId: "ALL"
|
|
|
|
property var saveProperties: ["currentIndex"]
|
|
|
|
|
2019-12-14 08:54:32 +11:00
|
|
|
// Prevent onCurrentIndexChanged from running before Component.onCompleted
|
|
|
|
property bool saveEnabled: false
|
|
|
|
|
2019-12-14 08:59:58 +11:00
|
|
|
property bool becomeKeyboardTabsTarget: true
|
2019-12-14 08:19:47 +11:00
|
|
|
property int defaultIndex: 0
|
|
|
|
property bool changed: currentIndex !== defaultIndex
|
|
|
|
|
|
|
|
|
|
|
|
function reset() { setCurrentIndex(defaultIndex) }
|
|
|
|
}
|