diff --git a/declarativeimports/components/ComboBox.qml b/declarativeimports/components/ComboBox.qml index e28d9a0df..096bc0e15 100644 --- a/declarativeimports/components/ComboBox.qml +++ b/declarativeimports/components/ComboBox.qml @@ -43,6 +43,7 @@ T.ComboBox { wheelEnabled: false property bool blankSpaceForEmptyIcons: false + property bool forcePressed: false property int minimumPopUpWidth: 150 property string iconRole @@ -206,7 +207,7 @@ T.ComboBox { imagePath: editable ? "widgets/lineedit" : "widgets/button" prefix: editable ? "base" - : (control.pressed ? "pressed" : "normal") + : (control.pressed || control.forcePressed ? "pressed" : "normal") Private.TextFieldFocus { visible: parent.editable z: -1 diff --git a/declarativeimports/components/ComboBoxButton.qml b/declarativeimports/components/ComboBoxButton.qml index a71c3a92e..5f728afb6 100644 --- a/declarativeimports/components/ComboBoxButton.qml +++ b/declarativeimports/components/ComboBoxButton.qml @@ -43,6 +43,7 @@ PlasmaComponents.Button { property bool comboBoxEnabled: true property bool comboBoxBlankSpaceForEmptyIcons: false + property bool comboBoxForcePressed: false property int comboBoxMinimumPopUpWidth: 150 property string comboBoxTextRole: "" property string comboBoxIconRole: "" @@ -56,6 +57,7 @@ PlasmaComponents.Button { textRole: comboBoxTextRole blankSpaceForEmptyIcons: comboBoxBlankSpaceForEmptyIcons + forcePressed: comboBoxForcePressed minimumPopUpWidth: comboBoxMinimumPopUpWidth } @@ -74,8 +76,31 @@ PlasmaComponents.Button { width: parent.width - units.iconSizes.medium + 2*units.smallSpacing height: mainComboBox.height - text: buttonText + text: checkable && !labelMetrics.exceeds? "" : buttonText iconSource: buttonIconSource tooltip: buttonToolTip } + + Label{ + anchors.fill: parent + visible: mainButton.checkable && !labelMetrics.exceeds + text: buttonText + font: mainButton.font + color: theme.buttonTextColor + + elide: Text.ElideRight + horizontalAlignment: Text.AlignHCenter + verticalAlignment: Text.AlignVCenter + } + + Label{ + id: labelMetrics + text: root.buttonText + opacity: 0 + elide: Text.ElideNone + horizontalAlignment: Text.AlignHCenter + verticalAlignment: Text.AlignVCenter + + readonly property bool exceeds: width>mainButton.width + } } diff --git a/shell/package/contents/controls/CustomIndicatorButton.qml b/shell/package/contents/controls/CustomIndicatorButton.qml index 21d469351..b48a8419d 100644 --- a/shell/package/contents/controls/CustomIndicatorButton.qml +++ b/shell/package/contents/controls/CustomIndicatorButton.qml @@ -31,6 +31,7 @@ LatteComponents.ComboBoxButton{ comboBoxTextRole: "name" comboBoxIconRole: "icon" comboBoxBlankSpaceForEmptyIcons: true + comboBoxForcePressed: latteView.indicator.type === type property string type: "org.kde.latte.unity"