collapse tooltips that only have text

if a tooltip has only text, expecially only title or only subtitle, make
it as small as possible

BUG:343390
Change-Id: I5eff081613c9c64c78b8c5741bac67409a112c98
This commit is contained in:
Marco Martin 2015-01-28 12:41:34 +01:00
parent 8044e15a71
commit 993cdb54a6

View File

@ -32,7 +32,7 @@ Row {
property Item toolTip property Item toolTip
property int preferredTextWidth: theme.mSize(theme.defaultFont).width * 40 property int preferredTextWidth: theme.mSize(theme.defaultFont).width * 40
property int _s: units.largeSpacing / 2 property int _s: imageContainer.visible || (toolTip.mainText != "" && toolTip.subText != "") ? units.largeSpacing / 2 : 0
Layout.minimumWidth: implicitWidth + _s Layout.minimumWidth: implicitWidth + _s
Layout.minimumHeight: implicitHeight + _s * 2 Layout.minimumHeight: implicitHeight + _s * 2
@ -45,7 +45,7 @@ Row {
Item { Item {
id: imageContainer id: imageContainer
visible: toolTip != null && (toolTip.image != null || toolTip.icon != null) visible: toolTip != null && (toolTip.image != "" || toolTip.icon != "")
width: Math.max(tooltipImage.width, tooltipIcon.width) width: Math.max(tooltipImage.width, tooltipIcon.width)
height: Math.max(tooltipImage.height, tooltipIcon.height) height: Math.max(tooltipImage.height, tooltipIcon.height)
x: _s x: _s