QtMvvm  1.1.0
A mvvm oriented library for Qt, to create Projects for Widgets and Quick in parallel
SettingsView.qml
1 import QtQuick 2.10
2 import QtQuick.Controls 2.3
3 import QtQuick.Layouts 1.3
4 import de.skycoder42.QtMvvm.Core 1.1
5 import de.skycoder42.QtMvvm.Quick 1.1
6 
16 Page {
17  id: _settingsView
18 
30  property SettingsViewModel viewModel: null
44  property bool fullClose: false
45 
57  function closeAction() {
58  return !fullClose && _settingsStack.closeAction();
59  }
60 
61  header: ContrastToolBar {
62  id: _toolBar
63 
64  RowLayout {
65  id: _toolLayout
66  anchors.fill: parent
67  spacing: 0
68 
69  SearchBar {
70  id: _searchBar
71 
72  Layout.fillWidth: true
73  Layout.fillHeight: true
74 
75  title: qsTr("Settings")
76  allowSearch: _builder.allowSearch
77  searchToolTip: qsTr("Search in settings")
78  }
79 
80  ActionButton {
81  id: _restoreButton
82  visible: _builder.allowRestore
83  icon.source: "qrc:/de/skycoder42/qtmvvm/quick/icons/ic_settings_backup_restore.svg"
84  text: qsTr("Restore settings")
85  onClicked: _builder.restoreDefaults()
86  }
87  }
88  }
89 
91 
92  StackView {
93  id: _settingsStack
94  anchors.fill: parent
95 
96  function closeAction() {
97  if(_settingsStack.depth <= 1)
98  return false;
99  else {
100  _settingsStack.pop();
101  return true;
102  }
103  }
104  }
105 
106  Component {
107  id: _overviewComponent
108 
109  ScrollView {
110  id: __ovScrollView
111  property alias model: __ovListView.model
112  property alias showSections: __ovListView.showSections
113  clip: true
114 
115  OverviewListView {
116  id: __ovListView
117  builder: _builder
118  }
119 
120  Component.onCompleted: _settingsStack.push(__ovScrollView)
121  }
122  }
123 
124  Component {
125  id: _sectionViewComponent
126 
127  ScrollView {
128  id: __secScrollView
129  property alias model: __secListView.model
130  clip: true
131 
132  SectionListView {
133  id: __secListView
134  builder: _builder
135  }
136 
137  Component.onCompleted: _settingsStack.push(__secScrollView)
138  }
139  }
140 
141  SettingsUiBuilder {
142  id: _builder
143  buildView: _settingsView
144  viewModel: _settingsView.viewModel
145  filterText: _searchBar.searchText
146 
147  onPresentOverview: _overviewComponent.incubateObject(_settingsStack, {
148  model: model,
149  showSections: hasSections
150  }, Qt.Synchronous)
151  onPresentSection: _sectionViewComponent.incubateObject(_settingsStack, {
152  model: model
153  }, Qt.Synchronous)
154  onCloseSettings: {
155  _settingsView.fullClose = true;
157  }
158  }
159 }
A ProgressBar with automatic bindings to the presenters view loading progress.
An extension of the ToolBar for better appearance.
The QML import for the QtMvvmCore QML module.
Definition: qqmlcoreapp.h:9
static void popView()
Pops the current top level view.
The QML import for the QtMvvmQuick QML module.
Definition: ActionButton.qml:4
A ToolBarLabel with a search button next to it, that can turn into a searchbar.
Definition: SearchBar.qml:19
An extension of the ToolButton for better appearance.
A QML singleton to access common presenter methods globally.