summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJens Bache-Wiig <jbache@trolltech.com>2009-04-29 12:34:23 (GMT)
committerJens Bache-Wiig <jbache@trolltech.com>2009-04-29 13:18:24 (GMT)
commitee7b95f7d1f975c18603d98e877910d9d805ee8a (patch)
tree067c48fc95eb01991dbf96d74cc23a5b026d2abd
parentff57b90c0419a7058cf44413ab19d5aac7fb5f50 (diff)
downloadQt-ee7b95f7d1f975c18603d98e877910d9d805ee8a.zip
Qt-ee7b95f7d1f975c18603d98e877910d9d805ee8a.tar.gz
Qt-ee7b95f7d1f975c18603d98e877910d9d805ee8a.tar.bz2
Fix incorrect size hint for QGroupBox Cleanlooks/GTK
These styles render using a bigger font than the one set on the groupbox. We basically have to recalculate the minimum size to ensure text is not clipped. Task-number: 16483 Reviewed-by: ogoffart
-rw-r--r--src/gui/styles/qcleanlooksstyle.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/gui/styles/qcleanlooksstyle.cpp b/src/gui/styles/qcleanlooksstyle.cpp
index 11f4d26..3fb63f2 100644
--- a/src/gui/styles/qcleanlooksstyle.cpp
+++ b/src/gui/styles/qcleanlooksstyle.cpp
@@ -3768,6 +3768,20 @@ QSize QCleanlooksStyle::sizeFromContents(ContentsType type, const QStyleOption *
}
break;
case CT_GroupBox:
+ // Since we use a bold font we have to recalculate base width
+ if (const QGroupBox *gb = qobject_cast<const QGroupBox*>(widget)) {
+ QFont font = gb->font();
+ font.setBold(true);
+ QFontMetrics metrics(font);
+ int baseWidth = metrics.width(gb->title()) + metrics.width(QLatin1Char(' '));
+ if (gb->isCheckable()) {
+ baseWidth += pixelMetric(QStyle::PM_IndicatorWidth, option, widget);
+ baseWidth += pixelMetric(QStyle::PM_CheckBoxLabelSpacing, option, widget);
+ }
+ newSize.setWidth(qMax(baseWidth, newSize.width()));
+ }
+ newSize += QSize(0, 1);
+ break;
case CT_RadioButton:
case CT_CheckBox:
newSize += QSize(0, 1);