IconMargin is useful only to give good proportion when there is text,
when there isn't we want the whole size to be really precise with size calculations svn path=/trunk/KDE/kdelibs/; revision=1108320
This commit is contained in:
parent
2f8e70b7ab
commit
621ead5280
@ -587,6 +587,7 @@ void IconWidgetPrivate::layoutIcons(const QStyleOptionGraphicsItem *option)
|
||||
}
|
||||
|
||||
//aspect ratio very "tall"
|
||||
if (!text.isEmpty() || !infoText.isEmpty()) {
|
||||
if (currentSize.width() < heightAvail) {
|
||||
iconWidth = currentSize.width() -
|
||||
horizontalMargin[IconWidgetPrivate::IconMargin].left -
|
||||
@ -596,18 +597,16 @@ void IconWidgetPrivate::layoutIcons(const QStyleOptionGraphicsItem *option)
|
||||
verticalMargin[IconWidgetPrivate::IconMargin].top -
|
||||
verticalMargin[IconWidgetPrivate::IconMargin].bottom;
|
||||
}
|
||||
} else {
|
||||
iconWidth = qMin(heightAvail, currentSize.width());
|
||||
}
|
||||
iconWidth -= horizontalMargin[IconWidgetPrivate::ItemMargin].left + horizontalMargin[IconWidgetPrivate::ItemMargin].right;
|
||||
} else {
|
||||
//Horizontal layout
|
||||
//if there is text resize the icon in order to make room for the text
|
||||
if (text.isEmpty() && infoText.isEmpty()) {
|
||||
// with no text, we just take up the whole geometry
|
||||
iconWidth = qMin(currentSize.height() -
|
||||
horizontalMargin[IconWidgetPrivate::IconMargin].left -
|
||||
horizontalMargin[IconWidgetPrivate::IconMargin].right,
|
||||
currentSize.width() -
|
||||
horizontalMargin[IconWidgetPrivate::IconMargin].left -
|
||||
horizontalMargin[IconWidgetPrivate::IconMargin].right);
|
||||
iconWidth = qMin(currentSize.height(), currentSize.width());
|
||||
} else {
|
||||
iconWidth = currentSize.height() -
|
||||
verticalMargin[IconWidgetPrivate::IconMargin].top -
|
||||
|
Loading…
Reference in New Issue
Block a user