Improve tooltip spacing, increase allowance for text

This commit is contained in:
Sebastian Kügler 2014-01-21 02:47:41 +01:00
parent bdc2ad2a84
commit 18c4fc7c60

View File

@ -30,37 +30,40 @@ Row {
property Item toolTip property Item toolTip
property int preferredTextWidth: theme.mSize(theme.defaultFont).width * 25 property int preferredTextWidth: theme.mSize(theme.defaultFont).width * 40
property int _s: theme.iconSizes.small / 2 property int _s: theme.largeSpacing / 2
width: childrenRect.width + _s width: childrenRect.width + _s
height: childrenRect.height height: childrenRect.height + _s * 2
spacing: _s spacing: _s*2
Item { Item {
id: imageContainer id: imageContainer
visible: toolTip != null && (toolTip.image != undefined || toolTip.icon != undefined) visible: toolTip != null && (toolTip.image != null || toolTip.icon != null)
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
y: _s
Image { Image {
id: tooltipImage id: tooltipImage
source: toolTip ? toolTip.image : "" source: toolTip ? toolTip.image : ""
x: _s
} }
PlasmaCore.IconItem { PlasmaCore.IconItem {
id: tooltipIcon id: tooltipIcon
x: _s
width: toolTip != undefined && toolTip.icon != null ? theme.iconSizes.desktop : 0 width: toolTip != undefined && toolTip.icon != null ? theme.iconSizes.desktop : 0
height: width height: width
source: toolTip != undefined && toolTip.icon != null ? toolTip.icon : "" source: toolTip != undefined && toolTip.icon != null ? toolTip.icon : ""
anchors {
leftMargin: width != 0 ? _s : 0
}
} }
} }
Column { Column {
id: mainColumn id: mainColumn
x: _s
y: _s
//This instance is purely for metrics //This instance is purely for metrics
PlasmaExtras.Heading { PlasmaExtras.Heading {