Warning, /office/klevernotes/src/contents/ui/dialogs/imagePickerDialog/ButtonDelegate.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 import QtQuick.Controls 2.15
0006 import QtQuick.Layouts 1.15
0007 
0008 import org.kde.kirigami 2.19 as Kirigami
0009 import org.kde.kirigamiaddons.formcard 1.0
0010 
0011 AbstractFormDelegate {
0012     id: root
0013 
0014     focusPolicy: Qt.StrongFocus
0015 
0016     ToolTip.text: text
0017     ToolTip.delay: Kirigami.Units.toolTipDelay
0018     ToolTip.visible: hovered
0019 
0020     contentItem: GridLayout {
0021         rows: root.display === AbstractButton.TextUnderIcon ? 2 : 1
0022         columns: root.display === AbstractButton.TextUnderIcon ? 1 : 2
0023         columnSpacing: 0
0024 
0025         Kirigami.Icon {
0026             implicitWidth: (root.icon.width) ? root.icon.width : 0
0027             implicitHeight: (root.icon.height) ? root.icon.height : 0
0028 
0029             color: root.icon.color
0030             source: root.icon.name
0031             visible: root.icon.name !== ""
0032 
0033             Layout.row: 0
0034             Layout.column: 0
0035             Layout.alignment: Qt.AlignVCenter | Qt.AlignHCenter
0036             Layout.fillHeight: true
0037             Layout.leftMargin: Kirigami.Units.largeSpacing
0038             Layout.rightMargin: Kirigami.Units.largeSpacing
0039             Layout.topMargin: root.display === AbstractButton.TextUnderIcon ? Kirigami.Units.largeSpacing : Kirigami.Units.smallSpacing
0040             Layout.bottomMargin: Kirigami.Units.smallSpacing
0041         }
0042 
0043         Label {
0044             text: root.text
0045             color: root.enabled ? Kirigami.Theme.textColor : Kirigami.Theme.disabledTextColor
0046             elide: Text.ElideRight
0047             wrapMode: Text.WordWrap
0048             maximumLineCount: 2
0049             verticalAlignment: Text.AlignTop
0050             horizontalAlignment: Text.AlignHCenter
0051 
0052             Layout.row: root.display === AbstractButton.TextUnderIcon ? 1 : 0
0053             Layout.column: root.display === AbstractButton.TextUnderIcon ? 0 : 1
0054             Layout.alignment: Qt.AlignVCenter | Qt.AlignHCenter
0055             Layout.fillWidth: true
0056             Layout.fillHeight: true
0057             Layout.leftMargin: root.display === AbstractButton.TextUnderIcon ? Kirigami.Units.largeSpacing : 0
0058             Layout.rightMargin: Kirigami.Units.largeSpacing
0059             Layout.topMargin: Kirigami.Units.smallSpacing
0060             Layout.bottomMargin: root.display === AbstractButton.TextUnderIcon ? Kirigami.Units.largeSpacing : Kirigami.Units.smallSpacing
0061 
0062             Accessible.ignored: true // base class sets this text on root already
0063         }
0064     }
0065 
0066     Accessible.onPressAction: action ? action.trigger() : root.clicked()
0067 }