Don't show the background if Button.flat

Summary: Otherwise the flat property is ignored

Test Plan: Tested on KDE Connect port to use PlasmaComponents

Reviewers: #plasma, mart

Reviewed By: #plasma, mart

Subscribers: mart, #frameworks

Tags: #frameworks

Differential Revision: https://phabricator.kde.org/D11652
This commit is contained in:
Aleix Pol 2018-03-24 18:28:02 +01:00
parent 2de1bda33a
commit 49ef90bcb9
2 changed files with 30 additions and 1 deletions

View File

@ -52,6 +52,7 @@ T.Button {
implicitHeight: units.gridUnit * 1.6
Private.ButtonShadow {
anchors.fill: parent
visible: (!control.flat || control.hovered) && (!control.pressed || !control.checked)
state: {
if (control.pressed) {
return "hidden"
@ -69,7 +70,7 @@ T.Button {
anchors.fill: parent
imagePath: "widgets/button"
prefix: "normal"
opacity: control.checked || control.pressed ? 0 : 1
opacity: (!control.flat || control.hovered) && (!control.pressed || !control.checked) ? 1 : 0
Behavior on opacity {
OpacityAnimator {
duration: units.longDuration

28
tests/buttons_pc3.0.qml Normal file
View File

@ -0,0 +1,28 @@
import QtQuick 2.0
import org.kde.plasma.components 3.0 as PlasmaComponents
Rectangle
{
width: 500
height: 300
color: "white"
Flow {
anchors.fill: parent
anchors.margins: 20
spacing: 20
PlasmaComponents.Button {
text: "test"
}
PlasmaComponents.Button {
text: "test"
flat: true
}
PlasmaComponents.ToolButton {
text: "test"
}
}
}