plasma-framework/tests/components/toolbutton3.qml
Marco Martin ba0b637de9 fix layout size hints for button labels
Summary:
icon sizes and label placements tested correct in  several scenarios

* control.icon.width/height is used as maximum size of the icon
* if the button is smaller icons always scale down
* icons stay ccentered regardless of button size when there is no text

Test Plan:
fixes icon sizes without workarounds like D27260
{F8108705}

Reviewers: #plasma, davidedmundson

Reviewed By: #plasma, davidedmundson

Subscribers: davidedmundson, kde-frameworks-devel

Tags: #frameworks

Differential Revision: https://phabricator.kde.org/D27460
2020-02-19 12:12:41 +01:00

86 lines
2.5 KiB
QML

import QtQuick 2.0
import QtQuick.Layouts 1.4
import org.kde.plasma.core 2.0 as PlasmaCore
import org.kde.plasma.components 3.0 as PlasmaComponents
ComponentBase {
ColumnLayout {
anchors.fill: parent
anchors.margins: 20
Flow {
Layout.fillWidth: true
Layout.fillHeight: true
spacing: 20
PlasmaComponents.ToolButton {
icon.name: "list-remove"
text: "test"
flat: true
}
PlasmaComponents.ToolButton {
icon.name: "list-remove"
flat: true
}
PlasmaComponents.ToolButton {
text: "test"
flat: true
}
PlasmaComponents.ToolButton {
icon.name: "list-remove"
text: "test"
flat: false
}
PlasmaComponents.ToolButton {
icon.name: "list-remove"
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: "list-remove"
}
PlasmaComponents.ToolButton {
icon.name: "list-remove"
}
PlasmaComponents.ToolButton {
icon.name: "list-remove"
}
PlasmaComponents.ToolButton {
icon.name: "list-remove"
}
}
}
}