dashboard: fix tab indicator animation
This commit is contained in:
parent
db2eaaa3d0
commit
daf92f36e1
2 changed files with 7 additions and 3 deletions
|
|
@ -10,11 +10,12 @@ Item {
|
|||
id: root
|
||||
|
||||
required property PersistentProperties visibilities
|
||||
readonly property real nonAnimWidth: view.implicitWidth + viewWrapper.anchors.margins * 2
|
||||
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
anchors.bottom: parent.bottom
|
||||
|
||||
implicitWidth: view.implicitWidth + viewWrapper.anchors.margins * 2
|
||||
implicitWidth: nonAnimWidth
|
||||
implicitHeight: tabs.implicitHeight + tabs.anchors.topMargin + view.implicitHeight + viewWrapper.anchors.margins * 2
|
||||
|
||||
Tabs {
|
||||
|
|
@ -26,6 +27,7 @@ Item {
|
|||
anchors.topMargin: Appearance.padding.normal
|
||||
anchors.margins: Appearance.padding.large
|
||||
|
||||
nonAnimWidth: root.nonAnimWidth
|
||||
currentIndex: view.currentIndex
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -8,9 +8,10 @@ import QtQuick.Controls
|
|||
Item {
|
||||
id: root
|
||||
|
||||
required property real nonAnimWidth
|
||||
property alias currentIndex: bar.currentIndex
|
||||
|
||||
implicitHeight: bar.height + indicator.height + indicator.anchors.topMargin + separator.height
|
||||
implicitHeight: bar.implicitHeight + indicator.implicitHeight + indicator.anchors.topMargin + separator.implicitHeight
|
||||
|
||||
TabBar {
|
||||
id: bar
|
||||
|
|
@ -53,7 +54,8 @@ Item {
|
|||
|
||||
x: {
|
||||
const tab = bar.currentItem;
|
||||
return tab.x + (tab.width - tab.implicitWidth) / 2;
|
||||
const width = (root.nonAnimWidth - DashboardConfig.sizes.tabIndicatorSpacing * (bar.count - 1) * 2) / bar.count
|
||||
return width * tab.TabBar.index + (width - tab.implicitWidth) / 2;
|
||||
}
|
||||
|
||||
clip: true
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue