Warning, /maui/mauikit/src/controls.5/CollageItem.qml is written in an unsupported language. File is not indexed.
0001 import QtQuick 2.14 0002 import QtQuick.Controls 2.14 0003 import QtQuick.Layouts 1.3 0004 0005 import QtGraphicalEffects 1.0 0006 0007 import org.mauikit.controls 1.3 as Maui 0008 0009 /*! 0010 * \since org.mauikit.controls.labs 1.0 0011 * \inqmlmodule org.mauikit.controls.labs 0012 */ 0013 Maui.GridBrowserDelegate 0014 { 0015 id: control 0016 0017 /** 0018 * images : function 0019 */ 0020 property var images : [] 0021 maskRadius: radius 0022 0023 fillMode: Image.PreserveAspectCrop 0024 /** 0025 * randomHexColor : function 0026 */ 0027 function randomHexColor() 0028 { 0029 var color = '#', i = 5; 0030 do{ color += "0123456789abcdef".substr(Math.random() * 16,1); }while(i--); 0031 return color; 0032 } 0033 0034 /** 0035 * cb : function 0036 */ 0037 property var cb 0038 0039 //label1.font.bold: true 0040 label1.font.weight: Font.DemiBold 0041 label1.font.pointSize: Maui.Style.fontSizes.big 0042 0043 template.labelSizeHint: 32 0044 template.alignment: Qt.AlignLeft 0045 0046 template.iconComponent: Item 0047 { 0048 id: _collageLayout 0049 0050 function spanColumn(index, count) 0051 { 0052 if(index === 0) 0053 { 0054 return 3; 0055 } 0056 0057 if(count === 2 || count === 3) 0058 { 0059 return 3; 0060 } 0061 0062 return 1; 0063 } 0064 0065 Loader 0066 { 0067 asynchronous: true 0068 anchors.fill: parent 0069 0070 sourceComponent: GridLayout 0071 { 0072 columns: 3 0073 rows: 2 0074 columnSpacing: 2 0075 rowSpacing: 2 0076 0077 Repeater 0078 { 0079 id: _repeater 0080 model: control.images 0081 0082 delegate: Rectangle 0083 { 0084 Layout.fillHeight: true 0085 Layout.fillWidth: true 0086 Layout.maximumHeight: index === 0 ? control.height : control.height * 0.3 0087 Layout.columnSpan: spanColumn(index, _repeater.count) 0088 Layout.rowSpan: 1 0089 color: Qt.rgba(0,0,0,0.3) 0090 0091 Image 0092 { 0093 anchors.fill: parent 0094 sourceSize.width: control.imageWidth >= 0 ? control.imageWidth : width 0095 sourceSize.height: control.imageHeight >= 0 ? control.imageHeight : height 0096 cache: true 0097 asynchronous: true 0098 source: control.cb ? control.cb(modelData) : modelData 0099 fillMode: control.fillMode 0100 } 0101 } 0102 } 0103 0104 layer.enabled: control.maskRadius 0105 layer.effect: OpacityMask 0106 { 0107 maskSource: Rectangle 0108 { 0109 width: _collageLayout.width 0110 height: _collageLayout.height 0111 radius: control.maskRadius 0112 } 0113 } 0114 } 0115 } 0116 } 0117 }