@@ -10,35 +10,44 @@ import QtQuick.Layouts
1010
1111Item {
1212 id: root
13-
13+
1414 required property PersistentProperties visibilities
1515 required property PersistentProperties state
1616 required property FileDialog facePicker
1717 readonly property real nonAnimWidth: view .implicitWidth + viewWrapper .anchors .margins * 2
18+ readonly property bool showTabs: Config .dashboard .enableMedia || Config .dashboard .enablePerformance
1819
1920 implicitWidth: nonAnimWidth
20- implicitHeight: tabs .implicitHeight + tabs .anchors .topMargin + view .implicitHeight + viewWrapper .anchors .margins * 2
21+ implicitHeight: (showTabs ? tabs .implicitHeight + tabs .anchors .topMargin : 0 ) + view .implicitHeight + viewWrapper .anchors .margins * 2
2122
22- Tabs {
23+ Loader {
2324 id: tabs
24-
25+ asynchronous : true
2526 anchors .top : parent .top
2627 anchors .left : parent .left
2728 anchors .right : parent .right
2829 anchors .topMargin : Appearance .padding .normal
2930 anchors .margins : Appearance .padding .large
3031
31- nonAnimWidth: root .nonAnimWidth - anchors .margins * 2
32- state: root .state
32+ sourceComponent: root .showTabs ? tabsComponent : null
33+ }
34+
35+ Component {
36+ id: tabsComponent
37+ Tabs {
38+ nonAnimWidth: root .nonAnimWidth - parent .anchors .margins * 2
39+ state: root .state
40+ }
3341 }
3442
3543 ClippingRectangle {
3644 id: viewWrapper
3745
38- anchors .top : tabs .bottom
46+ anchors .top : root . showTabs ? tabs .bottom : parent . top
3947 anchors .left : parent .left
4048 anchors .right : parent .right
4149 anchors .bottom : parent .bottom
50+ anchors .topMargin : ! root .showTabs ? Appearance .padding .normal : Appearance .padding .large
4251 anchors .margins : Appearance .padding .large
4352
4453 radius: Appearance .rounding .normal
@@ -48,19 +57,43 @@ Item {
4857 id: view
4958
5059 readonly property int currentIndex: root .state .currentTab
51- readonly property Item currentItem: row .children [currentIndex]
52-
60+ readonly property Item currentItem: panelGenerator .count > 0 ? panelGenerator .itemAt (currentIndex) : null
61+ property list< Component> panelModel: [
62+ dash,
63+ Config .dashboard .enableMedia ? media : null ,
64+ Config .dashboard .enablePerformance ? performance : null
65+ ].filter (panel => panel != null )
66+
5367 anchors .fill : parent
5468
5569 flickableDirection: Flickable .HorizontalFlick
5670
57- implicitWidth: currentItem .implicitWidth
58- implicitHeight: currentItem .implicitHeight
71+ implicitWidth: currentItem? .implicitWidth ?? 0
72+ implicitHeight: currentItem? .implicitHeight ?? 0
5973
60- contentX: currentItem . x
74+ contentX: currentItem? . x ?? 0
6175 contentWidth: row .implicitWidth
6276 contentHeight: row .implicitHeight
6377
78+ Component {
79+ id: dash
80+ Dash {
81+ visibilities: root .visibilities
82+ state: root .state
83+ facePicker: root .facePicker
84+ }
85+ }
86+
87+ Component {
88+ id: media
89+ Media { visibilities: root .visibilities }
90+ }
91+
92+ Component {
93+ id: performance
94+ Performance {}
95+ }
96+
6497 onContentXChanged: {
6598 if (! moving)
6699 return ;
@@ -82,26 +115,20 @@ Item {
82115 contentX = Qt .binding (() => currentItem .x );
83116 }
84117
118+ onPanelModelChanged: {
119+ panelGenerator .model = panelModel
120+ }
121+
85122 RowLayout {
86123 id: row
87-
88- Pane {
89- sourceComponent : Dash {
90- visibilities : root . visibilities
91- state : root . state
92- facePicker : root . facePicker
124+
125+ Repeater {
126+ id : panelGenerator
127+ delegate : Pane {
128+ required property Component modelData
129+ sourceComponent : modelData
93130 }
94- }
95-
96- Pane {
97- sourceComponent: Media {
98- visibilities: root .visibilities
99- }
100- }
101-
102- Pane {
103- sourceComponent: Performance {}
104- }
131+ }
105132 }
106133
107134 Behavior on contentX {
0 commit comments