Commit 4735729f authored by ivan tkachenko's avatar ivan tkachenko Committed by Nate Graham
Browse files

[applets/kickoff] Fix compact representation centering on specific sizes

Fixes drift toward bottom that may occur at specific applet sizes, such as with 64px tall panel and 150% global scaling on X11 for me.

Firstly, make the text label completely invisible when it has no text, thus avoiding extra spacing added by RowLayout.

Secondly, setting fontSizeMode to Text.VerticalFit makes sense only and
only if the component itself is constrained vertically, which is the
job for Layout.fillHeight property.

Lastly, set icon's Layout.alignment too, just in case.
parent 0871e243
......@@ -216,13 +216,14 @@ Item {
PlasmaCore.IconItem {
id: buttonIcon
readonly property double aspectRatio: (kickoff.vertical ? implicitHeight / implicitWidth
: implicitWidth / implicitHeight)
readonly property int iconSize: Tools.returnValueIfExists(plasmoid.icon, compactRoot.height)
Layout.preferredWidth: iconSize
Layout.preferredHeight: iconSize
Layout.alignment: Qt.AlignVCenter
source: !kickoff.vertical ? plasmoid.icon : plasmoid.icon ? plasmoid.icon : kickoff.defaultIcon
active: parent.containsMouse || compactDragArea.containsDrag
smooth: true
......@@ -231,6 +232,9 @@ Item {
PC3.Label {
id: labelTextField
Layout.fillHeight: true
text: !kickoff.vertical ? kickoff.menuLabel : ''
horizontalAlignment: Text.AlignLeft
verticalAlignment: Text.AlignVCenter
......@@ -238,7 +242,7 @@ Item {
fontSizeMode: Text.VerticalFit
font.pixelSize: compactRoot.tooSmall ? PlasmaCore.Theme.defaultFont.pixelSize : PlasmaCore.Units.roundToIconSize(PlasmaCore.Units.gridUnit * 2)
minimumPointSize: PlasmaCore.Theme.smallestFont.pointSize
visible: !kickoff.vertical
visible: text && !kickoff.vertical
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment