Fix the alignment of the label of the toolbutton

Authored by dkardarakos on May 26 2019, 2:37 PM.



Using the Plasma theme, when only a label exists in a toolbutton, without filling the width of the rowlayout, the label is not properly aligned in the center.

Test Plan

Fill a rectangle with a label-only toolbutton. Before patching label is not aligned in the center.

In these pictures, the day numbers are labels of a (repeated) ToolButton that fills a Rectangle.


Diff Detail

R242 Plasma Framework (Library)
Automatic diff as part of commit; lint not applicable.
Automatic diff as part of commit; unit tests not applicable.
dkardarakos created this revision.May 26 2019, 2:37 PM
Restricted Application added a project: Frameworks. · View Herald TranscriptMay 26 2019, 2:37 PM
Restricted Application added a subscriber: kde-frameworks-devel. · View Herald Transcript
dkardarakos requested review of this revision.May 26 2019, 2:37 PM
ngraham added a subscriber: ngraham.

Before-and-after screenshots in the Test Plan section are very helpful for patches like this. :)

dkardarakos edited the test plan for this revision. (Show Details)May 26 2019, 4:12 PM
filipf accepted this revision.Jun 1 2019, 10:04 PM
filipf added a subscriber: filipf.

This is indeed not working as in PC2 so the change seems to be OK.

I used the following code to test in qmlscene

import QtQuick 2.12
import org.kde.plasma.components 3.0 as PlasmaComponents

Rectangle {
    width: 50
    height: childrenRect.height
    color: "black"

    PlasmaComponents.ToolButton {
        text: "1"
        width: parent.width
This revision is now accepted and ready to land.Jun 1 2019, 10:04 PM
This revision was automatically updated to reflect the committed changes.