diff options
author | Jens Bache-Wiig <jbache@trolltech.com> | 2009-04-29 12:34:23 (GMT) |
---|---|---|
committer | Jens Bache-Wiig <jbache@trolltech.com> | 2009-04-29 13:18:24 (GMT) |
commit | ee7b95f7d1f975c18603d98e877910d9d805ee8a (patch) | |
tree | 067c48fc95eb01991dbf96d74cc23a5b026d2abd /src/gui/styles/qcleanlooksstyle.cpp | |
parent | ff57b90c0419a7058cf44413ab19d5aac7fb5f50 (diff) | |
download | Qt-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
Diffstat (limited to 'src/gui/styles/qcleanlooksstyle.cpp')
-rw-r--r-- | src/gui/styles/qcleanlooksstyle.cpp | 14 |
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); |