1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157
|
/*
* SPDX-FileCopyrightText: 2019 David Edmundson <kde@davidedmundson.co.uk>
* SPDX-FileCopyrightText: 2020 Marco Martin <notmart@gmail.com>
* SPDX-FileCopyrightText: 2020 Noah Davis <noahadvs@gmail.com>
* SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
*/
import QtQuick
import QtQuick.Layouts
import org.kde.plasma.components as PlasmaComponents
import org.kde.kirigami as Kirigami
ComponentBase {
id: root
title: "Plasma Components 3 ToolButton"
contentItem: ColumnLayout {
Flow {
Layout.fillWidth: true
Layout.fillHeight: true
spacing: Kirigami.Units.gridUnit
PlasmaComponents.ToolButton {
icon.name: "start-here-kde-plasma"
text: "test"
flat: true
}
PlasmaComponents.ToolButton {
icon.name: "start-here-kde-plasma"
flat: true
}
PlasmaComponents.ToolButton {
text: "test"
flat: true
}
PlasmaComponents.ToolButton {
icon.name: "start-here-kde-plasma"
text: "test"
flat: false
}
PlasmaComponents.ToolButton {
icon.name: "start-here-kde-plasma"
flat: false
}
PlasmaComponents.ToolButton {
text: "test"
flat: false
}
PlasmaComponents.ToolButton {
icon.name: "application-menu"
text: "Icon Only"
display: PlasmaComponents.ToolButton.IconOnly
}
PlasmaComponents.ToolButton {
icon.name: "application-menu"
text: "Text Beside Icon"
display: PlasmaComponents.ToolButton.TextBesideIcon
}
PlasmaComponents.ToolButton {
icon.name: "application-menu"
text: "Text Under Icon"
display: PlasmaComponents.ToolButton.TextUnderIcon
}
PlasmaComponents.ToolButton {
icon.name: "application-menu"
text: "Text Only"
display: PlasmaComponents.ToolButton.TextOnly
}
}
RowLayout {
Layout.fillWidth: true
PlasmaComponents.Label {
Layout.fillWidth: true
text: "They should always be square:"
}
PlasmaComponents.ToolButton {
icon.name: "start-here-kde-plasma"
}
PlasmaComponents.ToolButton {
icon.name: "start-here-kde-plasma"
}
PlasmaComponents.ToolButton {
icon.name: "start-here-kde-plasma"
}
PlasmaComponents.ToolButton {
icon.name: "start-here-kde-plasma"
}
}
PlasmaComponents.Label {
text: "Fixed size and stretching size buttons"
}
GridLayout {
id: layout
rows: 2
columns:2
Layout.fillWidth: true
Layout.fillHeight: true
PlasmaComponents.ToolButton {
id: closeButton
icon.name: "window-close"
text: "Text"
}
PlasmaComponents.ToolButton {
id: closeButton2
icon.name: "window-close"
Layout.fillWidth: true
Layout.fillHeight: true
icon.width: Kirigami.Units.iconSizes.small
icon.height: Kirigami.Units.iconSizes.small
text: "Text"
}
PlasmaComponents.ToolButton {
id: closeButton3
icon.name: "window-close"
Layout.fillHeight: true
text: "Text"
}
PlasmaComponents.ToolButton {
id: closeButton4
icon.name: "window-close"
Layout.fillWidth: true
Layout.fillHeight: true
text: "Text"
}
}
RowLayout {
Layout.fillWidth: true
PlasmaComponents.Label {
Layout.fillWidth: true
text: "Fixed icon size\nicon should be 48px and centered within the button"
}
PlasmaComponents.ToolButton {
icon.name: "window-close"
icon.width: 48
icon.height: 48
flat: false
}
PlasmaComponents.ToolButton {
icon.name: "window-close"
Layout.minimumWidth: 100
icon.width: 48
icon.height: 48
flat: false
}
PlasmaComponents.ToolButton {
icon.name: "window-close"
Layout.minimumWidth: 100
icon.width: 48
icon.height: 48
flat: false
text: "Test"
display: PlasmaComponents.ToolButton.IconOnly
}
}
}
}
|