Libplasma

Button.qml
1/*
2 SPDX-FileCopyrightText: 2016 Marco Martin <mart@kde.org>
3
4 SPDX-License-Identifier: LGPL-2.0-or-later
5*/
6
7import QtQuick
8import QtQuick.Layouts
9import QtQuick.Templates as T
10import org.kde.kirigami as Kirigami
11import "private" as Private
12//NOTE: importing PlasmaCore is necessary in order to make KSvg load the current Plasma Theme
13import org.kde.plasma.core as PlasmaCore
14
15T.Button {
16 id: control
17
18 implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
19 implicitContentWidth + leftPadding + rightPadding)
20 implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
21 implicitContentHeight + topPadding + bottomPadding)
22
23 topPadding: (background as Private.ButtonBackground)?.topMargin ?? undefined
24 leftPadding: (background as Private.ButtonBackground)?.leftMargin ?? undefined
25 rightPadding: (background as Private.ButtonBackground)?.rightMargin ?? undefined
26 bottomPadding: (background as Private.ButtonBackground)?.bottomMargin ?? undefined
27
28 spacing: Kirigami.Units.smallSpacing
29
30 hoverEnabled: !Kirigami.Settings.tabletMode
31
32 Kirigami.MnemonicData.enabled: control.enabled && control.visible
33 Kirigami.MnemonicData.controlType: Kirigami.MnemonicData.SecondaryControl
34 Kirigami.MnemonicData.label: control.text
35
36 Shortcut {
37 //in case of explicit & the button manages it by itself
38 enabled: !(RegExp(/\&[^\&]/).test(control.text))
39 sequence: control.Kirigami.MnemonicData.sequence
40 onActivated: control.clicked()
41 }
42
43 Kirigami.Theme.inherit: flat
44 Kirigami.Theme.colorSet: Kirigami.Theme.Button
45
46 contentItem: Private.ButtonContent {
47 labelText: control.Kirigami.MnemonicData.richTextLabel
48 button: control
49 }
50
51 background: Private.ButtonBackground {
52 button: control
53 }
54}
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Nov 22 2024 12:06:24 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.