Warning, /office/klevernotes/src/contents/ui/painting/ColorButton.qml is written in an unsupported language. File is not indexed.
0001 // SPDX-License-Identifier: GPL-2.0-or-later
0002 // SPDX-FileCopyrightText: 2023 Louis Schul <schul9louis@gmail.com>
0003
0004 import QtQuick 2.15
0005
0006 import org.kde.kirigami 2.19 as Kirigami
0007
0008 Rectangle {
0009 id: button
0010
0011 property bool multicolor: false
0012
0013 signal primaryColorChanged
0014 signal secondaryColorChanged
0015 signal openColorPicker
0016
0017 width: Kirigami.Units.gridUnit * 1.5
0018 height: Kirigami.Units.gridUnit * 1.5
0019
0020 MouseArea {
0021 anchors.fill: parent
0022
0023 enabled: true
0024 acceptedButtons: Qt.LeftButton | Qt.RightButton
0025
0026 onClicked: {
0027 if (!button.multicolor) {
0028 mouse.button === Qt.LeftButton ? button.primaryColorChanged() : button.secondaryColorChanged()
0029 return
0030 }
0031 button.openColorPicker()
0032 }
0033 }
0034 }