From 73865f71719fe08bfe78592950df3a89ee31e232 Mon Sep 17 00:00:00 2001 From: Noah Davis Date: Wed, 26 Aug 2020 03:24:35 -0400 Subject: [PATCH] Add implicitWidth and implicitHeight to ButtonBackground Remove unnecessary keyboardFocus property since visualFocus exists Remove unnecessary parentControl property --- .../private/ButtonBackground.qml | 26 ++++++++----------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/src/declarativeimports/plasmacomponents3/private/ButtonBackground.qml b/src/declarativeimports/plasmacomponents3/private/ButtonBackground.qml index f19035479..c566aa540 100644 --- a/src/declarativeimports/plasmacomponents3/private/ButtonBackground.qml +++ b/src/declarativeimports/plasmacomponents3/private/ButtonBackground.qml @@ -4,14 +4,10 @@ */ import QtQuick 2.6 -import QtQuick.Templates @QQC2_VERSION@ as T import org.kde.plasma.core 2.0 as PlasmaCore Item { id: root - // TODO: mark this required when our minimum Qt version is new enough - property T.AbstractButton parentControl - // These should be used as the padding for the parent control property real leftMargin property real topMargin @@ -24,28 +20,28 @@ Item { */ property string usedPrefix - readonly property bool keyboardFocus: parentControl.activeFocus && - (parentControl.focusReason == Qt.TabFocusReason || parentControl.focusReason == Qt.BacktabFocusReason) + implicitWidth: PlasmaCore.Units.gridUnit + root.leftMargin + root.rightMargin + implicitHeight: PlasmaCore.Units.gridUnit + root.topMargin + root.bottomMargin FlatButtonBackground { id: flatButtonBackground anchors.fill: parent - hovered: parentControl.hovered - pressed: parentControl.pressed - checked: parentControl.checked - focused: root.keyboardFocus + hovered: root.parent.hovered + pressed: root.parent.pressed + checked: root.parent.checked + focused: root.parent.visualFocus } RaisedButtonBackground { id: raisedButtonBackground anchors.fill: parent - hovered: parentControl.hovered - pressed: parentControl.pressed - checked: parentControl.checked - focused: root.keyboardFocus + hovered: root.parent.hovered + pressed: root.parent.pressed + checked: root.parent.checked + focused: root.parent.visualFocus } - state: parentControl.flat ? "flat" : "raised" + state: root.parent.flat ? "flat" : "raised" states: [ State {