Warning, /maui/mauikit/src/controls.5/ColorsRow.qml is written in an unsupported language. File is not indexed.
0001 import QtQuick 2.14
0002 import QtQuick.Controls 2.14
0003
0004 import org.mauikit.controls 1.3 as Maui
0005
0006 Flow
0007 {
0008 id: control
0009
0010 default property var colors : []
0011 property string defaultColor
0012 property string currentColor
0013
0014 spacing: Maui.Style.defaultSpacing
0015
0016 property int size : Maui.Handy.isMobile ? 26 : Maui.Style.iconSizes.medium
0017 signal colorPicked (string color)
0018
0019 Repeater
0020 {
0021 model: control.colors
0022
0023 AbstractButton
0024 {
0025 id: _button
0026 checked : control.currentColor === modelData
0027 implicitHeight: control.size + topPadding + bottomPadding
0028 implicitWidth: implicitHeight + leftPadding + rightPadding
0029 hoverEnabled: true
0030 onClicked: control.colorPicked(modelData)
0031
0032 property color color : modelData
0033
0034 contentItem: Item
0035 {
0036 Maui.Icon
0037 {
0038 visible: opacity > 0
0039 color: Maui.ColorUtils.brightnessForColor(_button.color) === Maui.ColorUtils.Light ? "#333" : "#fff"
0040 anchors.centerIn: parent
0041 height: Math.round(parent.height * 0.9)
0042 width: height
0043 opacity: checked || hovered ? 1 : 0
0044 isMask: true
0045
0046 source: "qrc:/assets/checkmark.svg"
0047
0048 Behavior on opacity
0049 {
0050 NumberAnimation
0051 {
0052 duration: Maui.Style.units.shortDuration
0053 easing.type: Easing.InOutQuad
0054 }
0055 }
0056 }
0057 }
0058
0059 background: Rectangle
0060 {
0061 radius: Maui.Style.radiusV
0062 color: enabled ? modelData : "transparent"
0063
0064 }
0065 }
0066 }
0067
0068 Loader
0069 {
0070 asynchronous: true
0071 active: control.defaultColor.length
0072 sourceComponent: Item
0073 {
0074 implicitHeight: control.size
0075 implicitWidth: implicitHeight
0076
0077 ToolButton
0078 {
0079 flat: true
0080 anchors.centerIn: parent
0081 icon.name: "edit-clear"
0082 onClicked:
0083 {
0084 control.colorPicked(control.defaultColor)
0085 }
0086 }
0087 }
0088 }
0089
0090 }