Warning, /maui/mauikit/src/controls.5/AltBrowser.qml is written in an unsupported language. File is not indexed.
0001 import QtQuick 2.13 0002 import QtQml 2.14 0003 import QtQuick.Controls 2.13 0004 0005 import org.mauikit.controls 1.0 as Maui 0006 0007 /*! 0008 \since org.mauikit.controls 1.0 0009 \inqmlmodule org.mauikit.controls 0010 \brief A convinient way of switching from a grid to a list view. 0011 0012 The AltBrowser makes use of the GridView and ListBrowser components, 0013 there is a property to dinamically switch between the two. 0014 0015 For some navigation patterns is a good idea to provide a grid view when the application screen size is wide enough 0016 to fit much more information and a list view when the space is contrained since the list is much more compact, 0017 and makes navigation much more quicker, for this 0018 one could use the viewType property binded to a size condition. 0019 */ 0020 Maui.Page 0021 { 0022 id: control 0023 Maui.Theme.colorSet: Maui.Theme.View 0024 Maui.Theme.inherit: false 0025 0026 focus: true 0027 clip: false 0028 0029 /*! 0030 The current view being used, the GridView or the ListBrowser. 0031 To access the precise view use the aliases for the GridView or ListView. 0032 */ 0033 readonly property Item currentView : control.viewType === AltBrowser.ViewType.List ? _listView : _gridView 0034 0035 onCurrentViewChanged: control.currentView.forceActiveFocus() 0036 0037 enum ViewType 0038 { 0039 Grid, 0040 List 0041 } 0042 0043 /** 0044 \qmlproperty viewType AltBrowser::ViewType 0045 0046 Sets the view that's going to be in use. 0047 0048 The weight can be one of: 0049 \value ViewType.Grid 0050 \value ViewType.List The default 0051 0052 */ 0053 property int viewType: AltBrowser.ViewType.List 0054 0055 /*! 0056 The index of the current item selected in either view type. 0057 This value is synced to both view types. 0058 */ 0059 property int currentIndex : -1 0060 Binding on currentIndex 0061 { 0062 when: control.currentView 0063 value: control.currentView.currentIndex 0064 } 0065 0066 /*! 0067 The delegate to be used by the ListBrowser. 0068 */ 0069 property Component listDelegate : null 0070 0071 /*! 0072 The delegate to be used by the GridView. 0073 */ 0074 property Component gridDelegate : null 0075 0076 /*! 0077 The shared data model to be used by both view types. 0078 */ 0079 property var model : null 0080 0081 /*! 0082 Allow the lasso selection for multiple items with mouse or track based input methods. 0083 */ 0084 property bool enableLassoSelection: false 0085 0086 /*! 0087 Allow the selection mode, which sets the views in the mode to accept drag and hover to select multiple items. 0088 */ 0089 property bool selectionMode: false 0090 0091 /*! 0092 \qmlproperty Holder AltBrowser::holder 0093 0094 Item to set a place holder emoji and message. 0095 For more details on its properties check the Holder component. 0096 */ 0097 property alias holder : _holder 0098 0099 /*! 0100 \qmlproperty GridBrowser AltBrowser::gridView 0101 0102 The GridBrowser used as the grid view alternative. 0103 */ 0104 readonly property alias gridView : _gridView 0105 0106 /*! 0107 \qmlproperty ListBrowser AltBrowser::listView 0108 0109 The ListBrowser used as the list view alternative. 0110 */ 0111 readonly property alias listView : _listView 0112 0113 readonly property int count : currentView.count 0114 0115 flickable: currentView.flickable 0116 0117 Maui.GridBrowser 0118 { 0119 id: _gridView 0120 focus: control.focus 0121 anchors.fill: parent 0122 visible: control.viewType === AltBrowser.ViewType.Grid 0123 currentIndex: control.currentIndex 0124 model: control.model 0125 delegate: control.gridDelegate 0126 enableLassoSelection: control.enableLassoSelection 0127 selectionMode: control.selectionMode 0128 adaptContent: true 0129 clip: control.clip 0130 } 0131 0132 Maui.ListBrowser 0133 { 0134 anchors.fill: parent 0135 focus: control.focus 0136 id: _listView 0137 visible: control.viewType === AltBrowser.ViewType.List 0138 currentIndex: control.currentIndex 0139 model: control.model 0140 delegate: control.listDelegate 0141 enableLassoSelection: control.enableLassoSelection 0142 selectionMode: control.selectionMode 0143 clip: control.clip 0144 } 0145 0146 Maui.Holder 0147 { 0148 id: _holder 0149 anchors.fill: parent 0150 visible: false 0151 } 0152 }