File tree Expand file tree Collapse file tree 6 files changed +61
-29
lines changed
Expand file tree Collapse file tree 6 files changed +61
-29
lines changed Original file line number Diff line number Diff line change @@ -31,6 +31,7 @@ set(MM_QML
3131 components/MMListDelegate.qml
3232 components/MMListDrawer.qml
3333 components/MMListFooterSpacer.qml
34+ components/MMListEmptyLoaderDelegate.qml
3435 components/MMListMultiselectDrawer.qml
3536 components/MMListView.qml
3637 components/MMListSpacer.qml
Original file line number Diff line number Diff line change 1+ /***************************************************************************
2+ * *
3+ * This program is free software; you can redistribute it and/or modify *
4+ * it under the terms of the GNU General Public License as published by *
5+ * the Free Software Foundation; either version 2 of the License, or *
6+ * (at your option) any later version. *
7+ * *
8+ ***************************************************************************/
9+
10+ import QtQuick
11+
12+ Item {
13+ id: root
14+
15+ property bool isLoading: false
16+
17+ height: root .isLoading
18+ ? busyIndicator .height + 2 * __style .margin12
19+ : noItemsText .implicitHeight + 2 * __style .margin20
20+
21+ MMText {
22+ id: noItemsText
23+
24+ anchors .centerIn : parent
25+
26+ visible: ! root .isLoading
27+
28+ text: qsTr ( " No items" )
29+ font: __style .p5
30+ color: __style .mediumGreyColor
31+ }
32+
33+ MMBusyIndicator {
34+ id: busyIndicator
35+
36+ anchors .centerIn : parent
37+
38+ running: root .isLoading
39+ }
40+ }
Original file line number Diff line number Diff line change @@ -18,8 +18,6 @@ MMDrawer {
1818 property alias list: listViewComponent
1919 property alias emptyStateDelegate: emptyStateDelegateLoader .sourceComponent
2020
21- property bool isLoading: false
22-
2321 property string textRole: " text"
2422 property string secondaryTextRole: " secondaryText"
2523 property string valueRole: " value"
@@ -73,34 +71,15 @@ MMDrawer {
7371
7472 Item {
7573 width: parent .width
76- height: {
77- if ( root .isLoading ) return busyIndicator .height + 2 * __style .margin12
78- if ( listViewComponent .count === 0 ) return emptyStateDelegateLoader .height
79- return listViewComponent .height
80- }
74+ height: listViewComponent .count === 0 ? emptyStateDelegateLoader .height : listViewComponent .height
8175
82- Item {
83- id: emptyStateContainer
76+ Loader {
77+ id: emptyStateDelegateLoader
8478
8579 width: parent .width
86- height: emptyStateDelegateLoader .height
87-
88- visible: listViewComponent .count === 0 && ! root .isLoading
89-
90- Loader {
91- id: emptyStateDelegateLoader
92-
93- width: parent .width
94- sourceComponent: defaultEmptyStateComponent
95- }
96- }
97-
98- MMBusyIndicator {
99- id: busyIndicator
100-
101- anchors .centerIn : parent
10280
103- running: root .isLoading
81+ visible: listViewComponent .count === 0
82+ sourceComponent: defaultEmptyStateComponent
10483 }
10584
10685 MMListView {
Original file line number Diff line number Diff line change @@ -73,7 +73,11 @@ Column {
7373 withSearch: uniqueValuesModel .count > 5
7474 multiSelect: root .isMultiSelect
7575
76- isLoading: uniqueValuesModel .isLoading
76+ emptyStateDelegate: Component {
77+ MMComponents .MMListEmptyLoaderDelegate {
78+ isLoading: uniqueValuesModel .isLoading
79+ }
80+ }
7781
7882 list .model : MM .SearchProxyModel {
7983 id: searchProxyModel
Original file line number Diff line number Diff line change @@ -72,7 +72,11 @@ Column {
7272 withSearch: valueMapModel .count > 5
7373 multiSelect: root .isMultiSelect
7474
75- isLoading: valueMapModel .isLoading
75+ emptyStateDelegate: Component {
76+ MMComponents .MMListEmptyLoaderDelegate {
77+ isLoading: valueMapModel .isLoading
78+ }
79+ }
7680
7781 list .model : MM .SearchProxyModel {
7882 id: searchProxyModel
Original file line number Diff line number Diff line change @@ -72,7 +72,11 @@ Column {
7272 withSearch: vrDropdownModel .count > 5
7373 multiSelect: root .isMultiSelect
7474
75- isLoading: vrDropdownModel .isLoading
75+ emptyStateDelegate: Component {
76+ MMComponents .MMListEmptyLoaderDelegate {
77+ isLoading: vrDropdownModel .isLoading
78+ }
79+ }
7680
7781 list .model : MM .ValueRelationFeaturesModel {
7882 id: vrDropdownModel
You can’t perform that action at this time.
0 commit comments