Changeset View
Changeset View
Standalone View
Standalone View
src/declarativeimports/plasmacomponents3/TabButton.qml
Show All 12 Lines | |||||
13 | * | 13 | * | ||
14 | * You should have received a copy of the GNU Library General Public | 14 | * You should have received a copy of the GNU Library General Public | ||
15 | * License along with this program; if not, write to the | 15 | * License along with this program; if not, write to the | ||
16 | * Free Software Foundation, Inc., | 16 | * Free Software Foundation, Inc., | ||
17 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | 17 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
18 | */ | 18 | */ | ||
19 | 19 | | |||
20 | import QtQuick 2.6 | 20 | import QtQuick 2.6 | ||
21 | import QtQuick.Layouts 1.2 | ||||
21 | import QtQuick.Controls @QQC2_VERSION@ | 22 | import QtQuick.Controls @QQC2_VERSION@ | ||
22 | import QtQml.Models 2.1 | 23 | import QtQml.Models 2.1 | ||
23 | import QtQuick.Templates @QQC2_VERSION@ as T | 24 | import QtQuick.Templates @QQC2_VERSION@ as T | ||
24 | import org.kde.plasma.core 2.0 as PlasmaCore | 25 | import org.kde.plasma.core 2.0 as PlasmaCore | ||
26 | import org.kde.kirigami 2.5 as Kirigami | ||||
25 | 27 | | |||
26 | T.TabButton { | 28 | T.TabButton { | ||
27 | id: control | 29 | id: control | ||
28 | 30 | | |||
29 | implicitWidth: contentItem.implicitWidth + leftPadding + rightPadding | 31 | implicitWidth: contentItem.implicitWidth + leftPadding + rightPadding | ||
30 | implicitHeight: contentItem.implicitHeight + topPadding + bottomPadding | 32 | implicitHeight: contentItem.implicitHeight + topPadding + bottomPadding | ||
31 | baselineOffset: contentItem.y + contentItem.baselineOffset | 33 | baselineOffset: contentItem.y + contentItem.baselineOffset | ||
32 | 34 | | |||
33 | padding: units.smallSpacing | 35 | padding: units.smallSpacing | ||
34 | 36 | | |||
35 | hoverEnabled: true | 37 | hoverEnabled: true | ||
36 | 38 | | |||
37 | contentItem: Label { | 39 | Kirigami.MnemonicData.enabled: control.enabled && control.visible | ||
38 | text: control.text | 40 | Kirigami.MnemonicData.controlType: Kirigami.MnemonicData.SecondaryControl | ||
41 | Kirigami.MnemonicData.label: control.text | ||||
42 | | ||||
43 | contentItem: GridLayout { | ||||
44 | columns: control.display == T.AbstractButton.TextBesideIcon ? 2 : 1 | ||||
45 | PlasmaCore.IconItem { | ||||
46 | id: icon | ||||
47 | Layout.fillWidth: true | ||||
48 | Layout.fillHeight: true | ||||
49 | colorGroup: PlasmaCore.Theme.ButtonColorGroup | ||||
50 | visible: source.length > 0 | ||||
51 | source: control.icon ? (control.icon.name || control.icon.source) : "" | ||||
52 | status: control.activeFocus && !control.pressed && !control.checked ? PlasmaCore.Svg.Selected : PlasmaCore.Svg.Normal | ||||
53 | } | ||||
54 | Label { | ||||
55 | Layout.fillWidth: true | ||||
56 | Layout.fillHeight: true | ||||
57 | visible: text.length > 0 | ||||
58 | text: control.Kirigami.MnemonicData.richTextLabel | ||||
39 | font: control.font | 59 | font: control.font | ||
40 | elide: Text.ElideRight | 60 | opacity: enabled || control.highlighted || control.checked ? 1 : 0.4 | ||
41 | opacity: enabled ? 1 : 0.3 | 61 | color: control.activeFocus && !control.down ? theme.highlightedTextColor : theme.buttonTextColor | ||
42 | color: PlasmaCore.ColorScope.textColor | | |||
43 | horizontalAlignment: Text.AlignHCenter | 62 | horizontalAlignment: Text.AlignHCenter | ||
44 | verticalAlignment: Text.AlignVCenter | 63 | verticalAlignment: Text.AlignVCenter | ||
64 | elide: Text.ElideRight | ||||
65 | } | ||||
45 | } | 66 | } | ||
46 | 67 | | |||
47 | background: Item {} | 68 | background: Item {} | ||
48 | } | 69 | } |