Toolbutton: Fix layout issues

- Improve spacing between icon and text
- Do not enforce a minimum width

Having a minimum width does not make much sense for a ToolButton:
1. It should aim at using the minimum amount of horizontal space when
   used in a ToolBar.
2. It looks unbalanced when used with an icon because the content is
   flushed to the left, leaving a large amount of white-space on the right.

REVIEW: 104735
This commit is contained in:
Aurélien Gâteau 2012-04-25 12:37:36 +02:00
parent 90bddbf61e
commit 2b8a7b32c5

View File

@ -84,7 +84,7 @@ Item {
if (label.paintedWidth == 0) {
return implicitHeight
} else {
return Math.max(theme.defaultFont.mSize.width*12, icon.width + label.paintedWidth + surface.margins.left + surface.margins.right) + ((icon.valid) ? surface.margins.left : 0)
return icon.width + label.paintedWidth + surface.margins.left + surface.margins.right + ((icon.valid) ? surface.margins.left : 0)
}
}
implicitHeight: Math.max(theme.defaultFont.mSize.height*1.6, Math.max(icon.height, label.paintedHeight) + surface.margins.top/2 + surface.margins.bottom/2)
@ -200,7 +200,7 @@ Item {
top: parent.top
bottom: parent.bottom
left: icon.valid ? icon.right : parent.left
leftMargin: icon.valid ? parent.anchors.leftMargin : 0
leftMargin: icon.valid ? surface.margins.left : 0
right: parent.right
}
font.capitalization: theme.defaultFont.capitalization