dashboard: fix flickering on switch panes
This commit is contained in:
parent
33c1c694de
commit
fae21cd73a
1 changed files with 10 additions and 0 deletions
|
|
@ -87,6 +87,7 @@ Item {
|
|||
id: row
|
||||
|
||||
Pane {
|
||||
index: 0
|
||||
sourceComponent: Dash {
|
||||
visibilities: root.visibilities
|
||||
state: root.state
|
||||
|
|
@ -95,16 +96,19 @@ Item {
|
|||
}
|
||||
|
||||
Pane {
|
||||
index: 1
|
||||
sourceComponent: Media {
|
||||
visibilities: root.visibilities
|
||||
}
|
||||
}
|
||||
|
||||
Pane {
|
||||
index: 2
|
||||
sourceComponent: Performance {}
|
||||
}
|
||||
|
||||
Pane {
|
||||
index: 3
|
||||
sourceComponent: Weather {}
|
||||
}
|
||||
}
|
||||
|
|
@ -130,9 +134,15 @@ Item {
|
|||
}
|
||||
|
||||
component Pane: Loader {
|
||||
id: pane
|
||||
|
||||
required property int index
|
||||
|
||||
Layout.alignment: Qt.AlignTop
|
||||
|
||||
Component.onCompleted: active = Qt.binding(() => {
|
||||
// Always keep current tab loaded
|
||||
if (pane.index === view.currentIndex) return true;
|
||||
const vx = Math.floor(view.visibleArea.xPosition * view.contentWidth);
|
||||
const vex = Math.floor(vx + view.visibleArea.widthRatio * view.contentWidth);
|
||||
return (vx >= x && vx <= x + implicitWidth) || (vex >= x && vex <= x + implicitWidth);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue