diff --git a/widgets/iconwidget.cpp b/widgets/iconwidget.cpp index 98f8aba75..5abc579fd 100644 --- a/widgets/iconwidget.cpp +++ b/widgets/iconwidget.cpp @@ -546,9 +546,12 @@ void IconWidgetPrivate::layoutIcons(const QStyleOptionGraphicsItem *option) //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 = currentSize.height() - - horizontalMargin[IconWidgetPrivate::IconMargin].left - - horizontalMargin[IconWidgetPrivate::IconMargin].right; + iconWidth = qMin(currentSize.height() - + horizontalMargin[IconWidgetPrivate::IconMargin].left - + horizontalMargin[IconWidgetPrivate::IconMargin].right, + currentSize.width() - + horizontalMargin[IconWidgetPrivate::IconMargin].left - + horizontalMargin[IconWidgetPrivate::IconMargin].right); } else { iconWidth = currentSize.height() - verticalMargin[IconWidgetPrivate::IconMargin].top -