[Default Tooltip] Fix sizing

Unset the Label's default height which completely confuses the renderer either shifting the item vertically (e.g. when toggling
system tray popup), or letting it get too wide (e.g. when moving from a two-line tooltip to a one-line tooltip).
Also let the Layouts figure out sizing rather than trying to overrule it with flaky values.

BUG: 386260
BUG: 389371

Differential Revision: https://phabricator.kde.org/D10077
This commit is contained in:
Kai Uwe Broulik 2018-01-26 15:49:06 +01:00
parent 595fd88054
commit f31e7860d9

View File

@ -66,13 +66,12 @@ Item {
}
ColumnLayout {
Layout.maximumWidth: preferredTextWidth
PlasmaExtras.Heading {
id: tooltipMaintext
level: 3
property int _width: Math.min(implicitWidth, preferredTextWidth)
Layout.minimumWidth: _width
Layout.maximumWidth: preferredTextWidth
Layout.fillWidth: true
elide: Text.ElideRight
wrapMode: Text.Wrap
text: toolTip ? toolTip.mainText : ""
@ -80,9 +79,10 @@ Item {
}
PlasmaComponents.Label {
id: tooltipSubtext
property int _width: Math.min(implicitWidth, preferredTextWidth)
Layout.minimumWidth: _width
Layout.maximumWidth: preferredTextWidth
Layout.fillWidth: true
// Unset Label default height, confuses the layout engine completely
// either shifting the item vertically or letting it get too wide
height: undefined
wrapMode: Text.WordWrap
text: toolTip ? toolTip.subText : ""
textFormat: toolTip ? toolTip.textFormat : Text.AutoText