2020-08-20 00:14:19 +02:00
|
|
|
/*
|
|
|
|
* SPDX-FileCopyrightText: 2019 David Edmundson <kde@davidedmundson.co.uk>
|
|
|
|
* SPDX-FileCopyrightText: 2020 Marco Martin <notmart@gmail.com>
|
|
|
|
* SPDX-FileCopyrightText: 2020 Nate Graham <nate@kde.org>
|
|
|
|
* 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
|
|
|
|
*/
|
2019-09-10 12:35:55 +02:00
|
|
|
import QtQuick 2.0
|
|
|
|
import QtQuick.Layouts 1.2
|
2020-08-18 11:45:23 +02:00
|
|
|
import org.kde.plasma.core 2.0 as PlasmaCore
|
|
|
|
import org.kde.plasma.components 3.0 as PlasmaComponents
|
2020-08-21 03:06:34 +02:00
|
|
|
import org.kde.plasma.extras 2.0 as PlasmaExtras
|
2019-09-10 12:35:55 +02:00
|
|
|
|
2019-12-09 17:33:23 +01:00
|
|
|
ComponentBase {
|
2020-08-18 11:45:23 +02:00
|
|
|
id: root
|
|
|
|
title: "PlasmaComponents 3 Button"
|
2020-08-21 03:06:34 +02:00
|
|
|
contentItem: ColumnLayout {
|
|
|
|
GridLayout {
|
|
|
|
rowSpacing: PlasmaCore.Units.smallSpacing
|
|
|
|
columnSpacing: PlasmaCore.Units.largeSpacing
|
|
|
|
columns: 2
|
2019-09-10 12:35:55 +02:00
|
|
|
|
2020-08-21 03:06:34 +02:00
|
|
|
PlasmaComponents.Label {
|
|
|
|
text: "icon + text"
|
|
|
|
}
|
2019-09-10 12:35:55 +02:00
|
|
|
|
2020-08-21 03:06:34 +02:00
|
|
|
PlasmaComponents.Button {
|
|
|
|
icon.name: "start-here-kde-plasma"
|
|
|
|
text: "test"
|
|
|
|
}
|
2019-09-10 12:35:55 +02:00
|
|
|
|
2020-08-21 03:06:34 +02:00
|
|
|
PlasmaComponents.Label {
|
|
|
|
text: "icon alone, should look small and square"
|
|
|
|
}
|
2019-09-10 12:35:55 +02:00
|
|
|
|
2020-08-21 03:06:34 +02:00
|
|
|
PlasmaComponents.Button {
|
|
|
|
icon.name: "start-here-kde-plasma"
|
|
|
|
}
|
2019-09-10 12:35:55 +02:00
|
|
|
|
2020-08-21 03:06:34 +02:00
|
|
|
PlasmaComponents.Label {
|
|
|
|
text: "text alone, should be about as wide as the text itself"
|
|
|
|
}
|
2019-09-10 12:35:55 +02:00
|
|
|
|
2020-08-21 03:06:34 +02:00
|
|
|
PlasmaComponents.Button {
|
|
|
|
text: "test"
|
|
|
|
}
|
2019-09-10 12:35:55 +02:00
|
|
|
|
2020-08-21 03:06:34 +02:00
|
|
|
PlasmaComponents.Label {
|
|
|
|
text: "This should look highlighted on load"
|
|
|
|
}
|
2020-01-09 17:35:26 +01:00
|
|
|
|
2020-08-21 03:06:34 +02:00
|
|
|
PlasmaComponents.Button {
|
|
|
|
text: "test"
|
|
|
|
focus: true
|
|
|
|
}
|
2019-09-10 12:35:55 +02:00
|
|
|
|
2020-08-21 03:06:34 +02:00
|
|
|
PlasmaComponents.Label {
|
|
|
|
text: "long text, should expand to fit"
|
|
|
|
}
|
2019-09-10 12:35:55 +02:00
|
|
|
|
2020-08-21 03:06:34 +02:00
|
|
|
PlasmaComponents.Button {
|
|
|
|
icon.name: "start-here-kde-plasma"
|
|
|
|
text: "This is a really really really really long button"
|
|
|
|
}
|
2019-09-10 12:35:55 +02:00
|
|
|
|
2020-08-21 03:06:34 +02:00
|
|
|
PlasmaComponents.Label {
|
|
|
|
text: "long text but constrained, should be 150px and elided"
|
|
|
|
}
|
2019-09-10 12:35:55 +02:00
|
|
|
|
2020-08-21 03:06:34 +02:00
|
|
|
PlasmaComponents.Button {
|
|
|
|
icon.name: "start-here-kde-plasma"
|
|
|
|
text: "This is a really really really really long button"
|
|
|
|
Layout.maximumWidth: 150
|
|
|
|
}
|
2019-09-10 12:35:55 +02:00
|
|
|
|
2020-08-21 03:06:34 +02:00
|
|
|
PlasmaComponents.Label {
|
2020-08-26 09:21:09 +02:00
|
|
|
text: "disabled icon + text"
|
2020-08-21 03:06:34 +02:00
|
|
|
}
|
2019-09-10 12:35:55 +02:00
|
|
|
|
2020-08-26 09:21:09 +02:00
|
|
|
PlasmaComponents.Button {
|
|
|
|
icon.name: "start-here-kde-plasma"
|
|
|
|
text: "test"
|
|
|
|
enabled: false
|
2019-09-10 12:35:55 +02:00
|
|
|
}
|
2020-08-21 03:06:34 +02:00
|
|
|
|
|
|
|
PlasmaComponents.Label {
|
2020-08-26 09:21:09 +02:00
|
|
|
text: "button (with or without icon) and textfield should have the same height"
|
2019-09-10 12:35:55 +02:00
|
|
|
}
|
2020-08-21 03:06:34 +02:00
|
|
|
|
|
|
|
RowLayout {
|
|
|
|
PlasmaComponents.Button {
|
2020-08-26 09:21:09 +02:00
|
|
|
text: "test"
|
2020-08-21 03:06:34 +02:00
|
|
|
}
|
|
|
|
PlasmaComponents.Button {
|
|
|
|
icon.name: "application-menu"
|
2020-08-26 09:21:09 +02:00
|
|
|
text: "test"
|
2020-08-21 03:06:34 +02:00
|
|
|
}
|
2020-08-26 09:21:09 +02:00
|
|
|
PlasmaComponents.TextField {
|
2020-08-21 03:06:34 +02:00
|
|
|
}
|
2019-09-10 12:35:55 +02:00
|
|
|
}
|
|
|
|
|
2020-08-21 03:06:34 +02:00
|
|
|
PlasmaComponents.Label {
|
|
|
|
text: "Display property"
|
|
|
|
}
|
|
|
|
RowLayout {
|
|
|
|
PlasmaComponents.Button {
|
|
|
|
icon.name: "application-menu"
|
|
|
|
text: "Icon Only"
|
|
|
|
display: PlasmaComponents.Button.IconOnly
|
|
|
|
}
|
|
|
|
PlasmaComponents.Button {
|
|
|
|
icon.name: "application-menu"
|
|
|
|
text: "Text Beside Icon"
|
|
|
|
display: PlasmaComponents.Button.TextBesideIcon
|
|
|
|
}
|
|
|
|
PlasmaComponents.Button {
|
|
|
|
icon.name: "application-menu"
|
|
|
|
text: "Text Under Icon"
|
|
|
|
display: PlasmaComponents.Button.TextUnderIcon
|
|
|
|
}
|
|
|
|
PlasmaComponents.Button {
|
|
|
|
icon.name: "application-menu"
|
|
|
|
text: "Text Only"
|
|
|
|
display: PlasmaComponents.Button.TextOnly
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
PlasmaExtras.Heading {
|
|
|
|
text: "Flat Buttons"
|
2019-09-10 12:35:55 +02:00
|
|
|
}
|
2020-08-21 03:06:34 +02:00
|
|
|
GridLayout {
|
|
|
|
rowSpacing: PlasmaCore.Units.smallSpacing
|
|
|
|
columnSpacing: PlasmaCore.Units.largeSpacing
|
|
|
|
columns: 2
|
2019-09-10 12:35:55 +02:00
|
|
|
|
2020-08-21 03:06:34 +02:00
|
|
|
PlasmaComponents.Label {
|
|
|
|
text: "icon + text"
|
2020-02-19 12:06:03 +01:00
|
|
|
}
|
2020-08-21 03:06:34 +02:00
|
|
|
|
2020-02-19 12:06:03 +01:00
|
|
|
PlasmaComponents.Button {
|
2020-08-21 03:06:34 +02:00
|
|
|
icon.name: "start-here-kde-plasma"
|
|
|
|
text: "test"
|
|
|
|
flat: true
|
2020-02-19 12:06:03 +01:00
|
|
|
}
|
2020-08-21 03:06:34 +02:00
|
|
|
|
|
|
|
PlasmaComponents.Label {
|
|
|
|
text: "icon alone, should look small and square"
|
2020-02-19 12:06:03 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
PlasmaComponents.Button {
|
2020-08-21 03:06:34 +02:00
|
|
|
icon.name: "start-here-kde-plasma"
|
|
|
|
flat: true
|
2020-02-19 12:06:03 +01:00
|
|
|
}
|
2020-08-21 03:06:34 +02:00
|
|
|
|
|
|
|
PlasmaComponents.Label {
|
|
|
|
text: "text alone, should be about as wide as the text itself"
|
|
|
|
}
|
|
|
|
|
2020-02-19 12:06:03 +01:00
|
|
|
PlasmaComponents.Button {
|
2020-08-21 03:06:34 +02:00
|
|
|
text: "test"
|
|
|
|
flat: true
|
2020-02-19 12:06:03 +01:00
|
|
|
}
|
2020-08-21 03:06:34 +02:00
|
|
|
|
|
|
|
PlasmaComponents.Label {
|
|
|
|
text: "long text, should expand to fit"
|
|
|
|
}
|
|
|
|
|
2020-02-19 12:06:03 +01:00
|
|
|
PlasmaComponents.Button {
|
2020-08-21 03:06:34 +02:00
|
|
|
icon.name: "start-here-kde-plasma"
|
|
|
|
text: "This is a really really really really long button"
|
|
|
|
flat: true
|
2020-02-19 12:06:03 +01:00
|
|
|
}
|
2020-08-21 03:06:34 +02:00
|
|
|
|
|
|
|
PlasmaComponents.Label {
|
|
|
|
text: "long text but constrained, should be 150px and elided"
|
|
|
|
}
|
|
|
|
|
2020-02-19 12:06:03 +01:00
|
|
|
PlasmaComponents.Button {
|
2020-08-21 03:06:34 +02:00
|
|
|
icon.name: "start-here-kde-plasma"
|
|
|
|
text: "This is a really really really really long button"
|
|
|
|
Layout.maximumWidth: 150
|
|
|
|
flat: true
|
|
|
|
}
|
|
|
|
|
|
|
|
PlasmaComponents.Label {
|
2020-08-26 09:21:09 +02:00
|
|
|
text: "disabled icon + text"
|
2019-09-10 12:35:55 +02:00
|
|
|
}
|
|
|
|
|
2020-08-26 09:21:09 +02:00
|
|
|
PlasmaComponents.Button {
|
|
|
|
icon.name: "start-here-kde-plasma"
|
|
|
|
text: "test"
|
|
|
|
flat: true
|
|
|
|
enabled: false
|
2020-08-21 03:06:34 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
PlasmaComponents.Label {
|
2020-08-26 09:21:09 +02:00
|
|
|
text: "button (with or without icon) and textfield should have the same height"
|
2020-08-21 03:06:34 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
RowLayout {
|
|
|
|
PlasmaComponents.Button {
|
2020-08-26 09:21:09 +02:00
|
|
|
text: "test"
|
2020-08-21 03:06:34 +02:00
|
|
|
flat: true
|
|
|
|
}
|
|
|
|
PlasmaComponents.Button {
|
|
|
|
icon.name: "application-menu"
|
2020-08-26 09:21:09 +02:00
|
|
|
text: "test"
|
2020-08-21 03:06:34 +02:00
|
|
|
flat: true
|
|
|
|
}
|
2020-08-26 09:21:09 +02:00
|
|
|
PlasmaComponents.TextField {
|
2020-08-21 03:06:34 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
PlasmaComponents.Label {
|
|
|
|
text: "Display property"
|
|
|
|
}
|
|
|
|
RowLayout {
|
|
|
|
PlasmaComponents.Button {
|
|
|
|
icon.name: "application-menu"
|
|
|
|
text: "Icon Only"
|
|
|
|
display: PlasmaComponents.Button.IconOnly
|
|
|
|
flat: true
|
|
|
|
}
|
|
|
|
PlasmaComponents.Button {
|
|
|
|
icon.name: "application-menu"
|
|
|
|
text: "Text Beside Icon"
|
|
|
|
display: PlasmaComponents.Button.TextBesideIcon
|
|
|
|
flat: true
|
|
|
|
}
|
|
|
|
PlasmaComponents.Button {
|
|
|
|
icon.name: "application-menu"
|
|
|
|
text: "Text Under Icon"
|
|
|
|
display: PlasmaComponents.Button.TextUnderIcon
|
|
|
|
flat: true
|
|
|
|
}
|
|
|
|
PlasmaComponents.Button {
|
|
|
|
icon.name: "application-menu"
|
|
|
|
text: "Text Only"
|
|
|
|
display: PlasmaComponents.Button.TextOnly
|
|
|
|
flat: true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2019-09-10 12:35:55 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|