Warning, /maui/mauikit/src/controls.5/Holder.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 QtQuick.Controls 2.15
0022
0023 import org.mauikit.controls 1.3 as Maui
0024
0025 /**
0026 * Holder
0027 * A global sidebar for the application window that can be collapsed.
0028 *
0029 *
0030 *
0031 *
0032 *
0033 *
0034 */
0035 Item
0036 {
0037 id: control
0038 implicitHeight: _layout.implicitHeight
0039
0040 default property list<Action> actions
0041
0042 property alias content : _layout.data
0043
0044 /**
0045 * emoji : string
0046 */
0047 property string emoji
0048
0049 /**
0050 * title : string
0051 */
0052 property alias title : _template.text1
0053
0054 /**
0055 * body : string
0056 */
0057 property alias body : _template.text2
0058
0059 /**
0060 * isMask : bool
0061 */
0062 property bool isMask : true
0063
0064 /**
0065 * isGif : bool
0066 */
0067 property bool isGif : false
0068
0069 /**
0070 * emojiSize : int
0071 */
0072 property int emojiSize : Maui.Style.iconSizes.big
0073
0074 /**
0075 * enabled : bool
0076 */
0077 property bool enabled: true
0078
0079 property alias label1 : _template.label1
0080 property alias label2 : _template.label2
0081
0082 readonly property alias dropArea: _dropArea
0083
0084 /**
0085 * actionTriggered :
0086 */
0087 signal actionTriggered()
0088 signal contentDropped(var drop)
0089
0090 Component
0091 {
0092 id: imgComponent
0093
0094 Maui.Icon
0095 {
0096 id: imageHolder
0097
0098 color: Maui.Theme.textColor
0099 isMask: control.isMask
0100 opacity: isMask ? _template.opacity : 1
0101 source: emoji
0102 }
0103 }
0104
0105 Component
0106 {
0107 id: animComponent
0108 AnimatedImage
0109 {
0110 id: animation;
0111 source: emoji
0112 }
0113 }
0114
0115 Rectangle
0116 {
0117 anchors.fill: parent
0118 opacity: _dropArea.containsDrag ? 0.4 : 0
0119 color: Maui.Theme.textColor
0120 DropArea
0121 {
0122 id: _dropArea
0123 anchors.fill: parent
0124 onDropped: (drop) =>
0125 {
0126 control.contentDropped(drop)
0127 }
0128 }
0129 }
0130
0131 Column
0132 {
0133 id: _layout
0134 anchors.centerIn: parent
0135 spacing: Maui.Style.defaultSpacing
0136
0137 Loader
0138 {
0139 visible: active
0140 active: control.height > (_template.implicitHeight + emojiSize) && control.emoji
0141 height: control.emoji && visible ? emojiSize : 0
0142 width: height
0143 asynchronous: true
0144 sourceComponent: isGif ? animComponent : imgComponent
0145 }
0146
0147 Maui.ListItemTemplate
0148 {
0149 id: _template
0150 width: Math.min(control.width * 0.7, layout.implicitWidth)
0151
0152 label1.font: Maui.Style.h1Font
0153 label1.wrapMode: Text.Wrap
0154 label2.wrapMode: Text.Wrap
0155 }
0156 Item{height: Maui.Style.space.medium; width: height}
0157
0158 Repeater
0159 {
0160 model: control.actions
0161
0162 Button
0163 {
0164 id: _button
0165 width: Math.max(120, implicitWidth)
0166
0167 action: modelData
0168
0169 }
0170 }
0171 }
0172 }