Aligns the Plasma QML Button content in the center if it has an icon.
It makes this look better: https://phabricator.kde.org/D17323
Before:
After:
Aligns the Plasma QML Button content in the center if it has an icon.
It makes this look better: https://phabricator.kde.org/D17323
Before:
After:
Run this test QML file with qmlscene:
Lint Skipped |
Unit Tests Skipped |
Cool!
Does this still work properly when the text is so long that the button expands to accommodate it?
Now that I think about this a bit, it seems like maybe the problem here is that there's a minimum button width in the first place. If we changed that so that buttons could be narrower when the icon + label is small, than we probably wouldn't need to horizontally center anything.
It works properly, no matter how big the button is or if it has an icon or not.
In my opinion we should leave it how it is now.
src/declarativeimports/plasmastyle/ButtonStyle.qml | ||
---|---|---|
41 ↗ | (On Diff #46862) | This looks wrong, a RowLayout inside another one? |
Code wise:
If we changed that so that buttons could be narrower when the icon + label is small, than we probably wouldn't need to horizontally center anything.
That's do-able from application space.
Button {
implicitWidth: minimumWidth
}
If you want that, there's no need to change this
Improved code.
How qmlscene tests/components/button.qml looks like:
I can't figure out how to make "elide" work without using Layout.fillWidth.
You won't be able to. You need that.
(or setting a max width, which effectively is the same thing)
Any changes to PlasmaStyle need to happen in the QQC2 (PlasmaComponents3) version too before shipping
src/declarativeimports/plasmastyle/ButtonStyle.qml | ||
---|---|---|
41 ↗ | (On Diff #46862) | why this Item wrapper |
in general, buttons with icons may be stacked vertically, which for me makes a general -1
But it's not consistent with Qt Widgets and looks kind of weird.
No, I still didn't figure that out.
I will do that when this is done.
This needs revision, but it's not really my priority.