Warning, /maui/mauikit/src/controls.5/GridBrowserDelegate.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.15 0021 import QtQml 2.14 0022 0023 import QtQuick.Controls 2.15 0024 0025 import org.mauikit.controls 1.3 as Maui 0026 0027 import "private" as Private 0028 0029 /** 0030 * GridBrowserDelegate 0031 * A GridItemTemplate wrapped into a ItemDelegate to make it clickable and draggable. 0032 * 0033 * For more details check the ItemDelegate and GridItemTemplate documentation. 0034 * 0035 * This mix adds a drop area, tooltip information and a custom styling. 0036 * 0037 * 0038 */ 0039 Maui.ItemDelegate 0040 { 0041 id: control 0042 0043 isCurrentItem : GridView.isCurrentItem || checked 0044 flat : !Maui.Handy.isMobile 0045 0046 implicitHeight: _template.implicitHeight + topPadding +bottomPadding 0047 0048 padding: Maui.Style.defaultPadding 0049 spacing: Maui.Style.space.medium 0050 0051 radius: Maui.Style.radiusV 0052 0053 /** 0054 * template : GridItemTemplate 0055 */ 0056 property alias template : _template 0057 0058 0059 /** 0060 * label1 : Label 0061 */ 0062 property alias label1 : _template.label1 0063 0064 /** 0065 * label2 : Label 0066 */ 0067 property alias label2 : _template.label2 0068 0069 0070 /** 0071 * iconItem : Item 0072 */ 0073 property alias iconItem : _template.iconItem 0074 0075 /** 0076 * iconVisible : bool 0077 */ 0078 property alias iconVisible : _template.iconVisible 0079 property alias imageSizeHint : _template.imageSizeHint 0080 0081 /** 0082 * iconSizeHint : int 0083 */ 0084 property alias iconSizeHint : _template.iconSizeHint 0085 0086 /** 0087 * imageSource : string 0088 */ 0089 property alias imageSource : _template.imageSource 0090 0091 /** 0092 * iconSource : string 0093 */ 0094 property alias iconSource : _template.iconSource 0095 0096 /** 0097 * showLabel : bool 0098 */ 0099 //property alias showLabel : _template.labelsVisible 0100 0101 property alias labelsVisible : _template.labelsVisible 0102 0103 /** 0104 * checked : bool 0105 */ 0106 property bool checked : false 0107 0108 property alias fillMode : _template.fillMode 0109 0110 property alias maskRadius : _template.maskRadius 0111 0112 /** 0113 * checkable : bool 0114 */ 0115 property bool checkable: false 0116 0117 property bool autoExclusive: false 0118 0119 /** 0120 * dropArea : DropArea 0121 */ 0122 property alias dropArea : _dropArea 0123 0124 property alias imageWidth : _template.imageWidth 0125 property alias imageHeight : _template.imageHeight 0126 0127 /** 0128 * contentDropped : 0129 */ 0130 signal contentDropped(var drop) 0131 0132 /** 0133 * toggled : 0134 */ 0135 signal toggled(bool state) 0136 0137 background: Rectangle 0138 { 0139 color: (control.isCurrentItem || control.containsPress ? Maui.Theme.highlightColor : ( control.hovered ? Maui.Theme.hoverColor : (control.flat ? "transparent" : Maui.Theme.alternateBackgroundColor))) 0140 0141 radius: control.radius 0142 0143 Behavior on color 0144 { 0145 enabled: !control.flat 0146 Maui.ColorTransition{} 0147 } 0148 } 0149 0150 DropArea 0151 { 0152 id: _dropArea 0153 width: parent.width 0154 height: parent.height 0155 Rectangle 0156 { 0157 anchors.fill: parent 0158 radius: control.radius 0159 color: control.Maui.Theme.backgroundColor 0160 border.color: control.Maui.Theme.highlightColor 0161 visible: parent.containsDrag 0162 } 0163 0164 onDropped: 0165 { 0166 control.contentDropped(drop) 0167 } 0168 } 0169 0170 Maui.GridItemTemplate 0171 { 0172 id: _template 0173 anchors.fill: parent 0174 iconContainer.scale: _dropArea.containsDrag || _checkboxLoader.active ? 0.8 : 1 0175 hovered: control.hovered 0176 maskRadius: control.radius 0177 spacing: control.spacing 0178 isCurrentItem: control.isCurrentItem 0179 highlighted: control.containsPress 0180 } 0181 0182 Loader 0183 { 0184 id: _checkboxLoader 0185 asynchronous: true 0186 active: control.checkable || control.checked 0187 0188 anchors.top: parent.top 0189 anchors.left: parent.left 0190 anchors.margins: Maui.Style.space.medium 0191 0192 scale: active ? 1 : 0 0193 0194 Behavior on scale 0195 { 0196 NumberAnimation 0197 { 0198 duration: Maui.Style.units.longDuration*2 0199 easing.type: Easing.OutBack 0200 } 0201 } 0202 0203 sourceComponent: CheckBox 0204 { 0205 checkable: control.checkable 0206 autoExclusive: control.autoExclusive 0207 0208 Binding on checked 0209 { 0210 value: control.checked 0211 restoreMode: Binding.RestoreBinding 0212 } 0213 0214 onToggled: control.toggled(state) 0215 } 0216 } 0217 }