Animate Sidebar ContentView focus switch

This commit is contained in:
2022-08-31 18:28:53 -04:00
parent 1d8d00a7f2
commit 552e18a42f
4 changed files with 63 additions and 4 deletions
+29 -1
View File
@@ -4,11 +4,13 @@ import QtQuick.Controls 1.4
import Ikinuki.Client 1.0
TabView {
id: tabView
property var providers
property bool viewSelected: false
state: viewSelected ? "selected" : "deselected"
property int xSelect: 0
property int ySelect: 0
width: parent.width * 0.8
width: viewSelected ? parent.width * 0.95 : parent.width * 0.8
height: parent.height
property var maxElements: providers.length
@@ -45,6 +47,32 @@ TabView {
}
}
}
states: [
State {
name: "deselected"
PropertyChanges {
target: tabView
width: parent.width * 0.8
}
},
State {
name: "selected"
PropertyChanges {
target: tabView
width: parent.width * 0.95
}
}
]
transitions: [
Transition {
NumberAnimation {
properties: "width"
duration: 150
easing.type: Easing.Linear
}
}
]
Keys.onPressed: (event)=> {
console.log(Qt.Key_Left);
if (event.key == Qt.Key_Left) {