@@ -9,34 +9,43 @@ import QtQuick.Layouts
99
1010Item {
1111 id: root
12-
12+
1313 required property PersistentProperties visibilities
1414 required property PersistentProperties state
1515 readonly property real nonAnimWidth: view .implicitWidth + viewWrapper .anchors .margins * 2
16+ readonly property bool showTabs: Config .dashboard .enableMedia || Config .dashboard .enablePerformance
1617
1718 implicitWidth: nonAnimWidth
18- implicitHeight: tabs .implicitHeight + tabs .anchors .topMargin + view .implicitHeight + viewWrapper .anchors .margins * 2
19+ implicitHeight: (showTabs ? tabs .implicitHeight + tabs .anchors .topMargin : 0 ) + view .implicitHeight + viewWrapper .anchors .margins * 2
1920
20- Tabs {
21+ Loader {
2122 id: tabs
22-
23+ asynchronous : true
2324 anchors .top : parent .top
2425 anchors .left : parent .left
2526 anchors .right : parent .right
2627 anchors .topMargin : Appearance .padding .normal
2728 anchors .margins : Appearance .padding .large
2829
29- nonAnimWidth: root .nonAnimWidth - anchors .margins * 2
30- state: root .state
30+ sourceComponent: showTabs ? tabsComponent : null
31+ }
32+
33+ Component {
34+ id: tabsComponent
35+ Tabs {
36+ nonAnimWidth: root .nonAnimWidth - parent .anchors .margins * 2
37+ state: root .state
38+ }
3139 }
3240
3341 ClippingRectangle {
3442 id: viewWrapper
3543
36- anchors .top : tabs .bottom
44+ anchors .top : showTabs ? tabs .bottom : parent . top
3745 anchors .left : parent .left
3846 anchors .right : parent .right
3947 anchors .bottom : parent .bottom
48+ anchors .topMargin : ! showTabs ? Appearance .padding .normal : Appearance .padding .large
4049 anchors .margins : Appearance .padding .large
4150
4251 radius: Appearance .rounding .normal
@@ -46,19 +55,42 @@ Item {
4655 id: view
4756
4857 readonly property int currentIndex: root .state .currentTab
49- readonly property Item currentItem: row .children [currentIndex]
50-
58+ readonly property Item currentItem: panelGenerator .count > 0 ? panelGenerator .itemAt (currentIndex) : null
59+ property list< Component> panelModel: [
60+ dash,
61+ Config .dashboard .enableMedia ? media : null ,
62+ Config .dashboard .enablePerformance ? performance : null
63+ ].filter (panel => panel != null )
64+
5165 anchors .fill : parent
5266
5367 flickableDirection: Flickable .HorizontalFlick
5468
55- implicitWidth: currentItem .implicitWidth
56- implicitHeight: currentItem .implicitHeight
69+ implicitWidth: currentItem? .implicitWidth ?? 0
70+ implicitHeight: currentItem? .implicitHeight ?? 0
5771
58- contentX: currentItem . x
72+ contentX: currentItem? . x ?? 0
5973 contentWidth: row .implicitWidth
6074 contentHeight: row .implicitHeight
6175
76+ Component {
77+ id: dash
78+ Dash {
79+ visibilities: root .visibilities
80+ state: root .state
81+ }
82+ }
83+
84+ Component {
85+ id: media
86+ Media { visibilities: root .visibilities }
87+ }
88+
89+ Component {
90+ id: performance
91+ Performance {}
92+ }
93+
6294 onContentXChanged: {
6395 if (! moving)
6496 return ;
@@ -80,25 +112,20 @@ Item {
80112 contentX = Qt .binding (() => currentItem .x );
81113 }
82114
115+ onPanelModelChanged: {
116+ panelGenerator .model = panelModel
117+ }
118+
83119 RowLayout {
84120 id: row
85-
86- Pane {
87- sourceComponent: Dash {
88- visibilities: root .visibilities
89- state: root .state
121+
122+ Repeater {
123+ id: panelGenerator
124+ delegate: Pane {
125+ required property Component modelData
126+ sourceComponent: modelData
90127 }
91- }
92-
93- Pane {
94- sourceComponent: Media {
95- visibilities: root .visibilities
96- }
97- }
98-
99- Pane {
100- sourceComponent: Performance {}
101- }
128+ }
102129 }
103130
104131 Behavior on contentX {
0 commit comments