Warning, /maui/mauikit/src/controls.5/ListBrowserDelegate.qml is written in an unsupported language. File is not indexed.
0001 /*
0002 * Copyright 2018 Camilo Higuita <milo.h@aol.com>
0003 *
0004 * This program is free software; you can redistribute it and/or modify
0005 * it under the terms of the GNU Library General Public License as
0006 * published by the Free Software Foundation; either version 2, or
0007 * (at your option) any later version.
0008 *
0009 * This program is distributed in the hope that it will be useful,
0010 * but WITHOUT ANY WARRANTY; without even the implied warranty of
0011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
0012 * GNU General Public License for more details
0013 *
0014 * You should have received a copy of the GNU Library General Public
0015 * License along with this program; if not, write to the
0016 * Free Software Foundation, Inc.,
0017 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
0018 */
0019
0020 import QtQuick 2.14
0021 import QtQml 2.14
0022
0023 import QtQuick.Controls 2.14
0024 import QtQuick.Layouts 1.3
0025
0026 import org.mauikit.controls 1.3 as Maui
0027
0028 import "private" as Private
0029
0030 /**
0031 * ListBrowserDelegate
0032 * A global sidebar for the application window that can be collapsed.
0033 *
0034 *
0035 *
0036 *
0037 *
0038 *
0039 */
0040 Maui.ItemDelegate
0041 {
0042 id: control
0043
0044 focus: true
0045
0046 radius: Maui.Style.radiusV
0047
0048 flat : !Maui.Handy.isMobile
0049
0050 implicitHeight: _layout.implicitHeight + topPadding + bottomPadding
0051
0052 isCurrentItem : ListView.isCurrentItem || checked
0053
0054 padding: Maui.Style.defaultPadding
0055 spacing: Maui.Style.space.small
0056
0057 /**
0058 * content : ListItemTemplate.data
0059 */
0060 default property alias content : _template.content
0061
0062 /**
0063 * label1 : Label
0064 */
0065 property alias label1 : _template.label1
0066
0067 /**
0068 * label2 : Label
0069 */
0070 property alias label2 : _template.label2
0071
0072 /**
0073 * label3 : Label
0074 */
0075 property alias label3 : _template.label3
0076
0077 /**
0078 * label4 : Label
0079 */
0080 property alias label4 : _template.label4
0081
0082 /**
0083 * iconItem : Item
0084 */
0085 property alias iconItem : _template.iconItem
0086
0087 /**
0088 * iconVisible : bool
0089 */
0090 property alias iconVisible : _template.iconVisible
0091
0092 /**
0093 * iconSizeHint : int
0094 */
0095 property alias iconSizeHint : _template.iconSizeHint
0096
0097 /**
0098 * imageSource : string
0099 */
0100 property alias imageSource : _template.imageSource
0101
0102 /**
0103 * iconSource : string
0104 */
0105 property alias iconSource : _template.iconSource
0106
0107 /**
0108 * showLabel : bool
0109 */
0110 property alias showLabel : _template.labelsVisible
0111
0112 /**
0113 * checked : bool
0114 */
0115 property bool checked : false
0116
0117 /**
0118 * checkable : bool
0119 */
0120 property bool checkable: false
0121
0122 property bool autoExclusive: false
0123
0124 /**
0125 * leftLabels : ColumnLayout
0126 */
0127 property alias leftLabels: _template.leftLabels
0128
0129 /**
0130 * rightLabels : ColumnLayout
0131 */
0132 property alias rightLabels: _template.rightLabels
0133
0134 /**
0135 * template : ListItemTemplate
0136 */
0137 property alias template : _template
0138
0139 property alias maskRadius : _template.maskRadius
0140
0141 property alias containsDrag : _dropArea.containsDrag
0142
0143 property alias dropArea : _dropArea
0144
0145 property alias layout : _layout
0146
0147 /**
0148 * contentDropped :
0149 */
0150 signal contentDropped(var drop)
0151
0152 signal contentEntered(var drag)
0153 /**
0154 * toggled :
0155 */
0156 signal toggled(bool state)
0157
0158
0159 background: Rectangle
0160 {
0161 color: (control.isCurrentItem || control.containsPress ? Maui.Theme.highlightColor : ( control.hovered ? Maui.Theme.hoverColor : (control.flat ? "transparent" : Maui.Theme.alternateBackgroundColor)))
0162
0163 radius: control.radius
0164
0165 Rectangle
0166 {
0167 width: parent.width
0168 height: parent.height
0169 radius: control.radius
0170 visible: control.containsDrag
0171 color: control.Maui.Theme.backgroundColor
0172 border.color: control.Maui.Theme.highlightColor
0173 Behavior on color
0174 {
0175 Maui.ColorTransition{}
0176 }
0177 }
0178
0179 Behavior on color
0180 {
0181 enabled: !control.flat
0182 Maui.ColorTransition{}
0183 }
0184 }
0185
0186 DropArea
0187 {
0188 id: _dropArea
0189 width: parent.width
0190 height: parent.height
0191 enabled: control.draggable
0192
0193 onDropped:
0194 {
0195 control.contentDropped(drop)
0196 }
0197
0198 onEntered:
0199 {
0200 control.contentEntered(drag)
0201 }
0202 }
0203
0204 RowLayout
0205 {
0206 id: _layout
0207 anchors.fill: parent
0208 spacing: _template.spacing
0209
0210 Loader
0211 {
0212 asynchronous: true
0213 active: control.checkable || control.checked
0214 visible: active
0215
0216 Layout.alignment: Qt.AlignCenter
0217
0218 scale: active? 1 : 0
0219
0220 Behavior on scale
0221 {
0222 NumberAnimation
0223 {
0224 duration: Maui.Style.units.longDuration
0225 easing.type: Easing.InOutQuad
0226 }
0227 }
0228
0229 sourceComponent: CheckBox
0230 {
0231 checkable: control.checkable
0232 autoExclusive: control.autoExclusive
0233
0234 Binding on checked
0235 {
0236 value: control.checked
0237 restoreMode: Binding.RestoreBinding
0238 }
0239
0240 onToggled: control.toggled(state)
0241 }
0242 }
0243
0244 Maui.ListItemTemplate
0245 {
0246 id: _template
0247 Layout.fillHeight: true
0248 Layout.fillWidth: true
0249
0250 spacing: control.spacing
0251
0252 hovered: control.hovered
0253 isCurrentItem : control.isCurrentItem
0254 highlighted: control.containsPress
0255 }
0256 }
0257 }