diff options
author | Thierry Bastian <thierry.bastian@nokia.com> | 2010-03-03 13:53:16 (GMT) |
---|---|---|
committer | Thierry Bastian <thierry.bastian@nokia.com> | 2010-03-03 13:58:05 (GMT) |
commit | 515f6a8c3dbe382bbb4f84f758a61c719143d8a6 (patch) | |
tree | 0f43fe3f20d7b2c34b6ac1667db7fdeef9eb6f66 /src | |
parent | 4a5eaccce02dbabfd81e8809d453fc268cdba644 (diff) | |
download | Qt-515f6a8c3dbe382bbb4f84f758a61c719143d8a6.zip Qt-515f6a8c3dbe382bbb4f84f758a61c719143d8a6.tar.gz Qt-515f6a8c3dbe382bbb4f84f758a61c719143d8a6.tar.bz2 |
sizeHint of checkbox/radiobutton without text is not correct
Reviewed-by: Jens Bache-Wiig
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/styles/qcommonstyle.cpp | 2 | ||||
-rw-r--r-- | src/gui/widgets/qcheckbox.cpp | 2 | ||||
-rw-r--r-- | src/gui/widgets/qradiobutton.cpp | 2 |
3 files changed, 3 insertions, 3 deletions
diff --git a/src/gui/styles/qcommonstyle.cpp b/src/gui/styles/qcommonstyle.cpp index f8464cc..b0e2d37 100644 --- a/src/gui/styles/qcommonstyle.cpp +++ b/src/gui/styles/qcommonstyle.cpp @@ -4760,7 +4760,7 @@ QSize QCommonStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt, int margins = 0; // we add 4 pixels for label margins - if (btn->icon.isNull() || !btn->text.isEmpty()) + if (!btn->icon.isNull() || !btn->text.isEmpty()) margins = 4 + proxy()->pixelMetric(isRadio ? PM_RadioButtonLabelSpacing : PM_CheckBoxLabelSpacing, opt, widget); sz += QSize(w + margins, 4); diff --git a/src/gui/widgets/qcheckbox.cpp b/src/gui/widgets/qcheckbox.cpp index 4e0ff66..bc0900e 100644 --- a/src/gui/widgets/qcheckbox.cpp +++ b/src/gui/widgets/qcheckbox.cpp @@ -291,7 +291,7 @@ QSize QCheckBox::sizeHint() const QFontMetrics fm = fontMetrics(); QStyleOptionButton opt; initStyleOption(&opt); - QSize sz = style()->itemTextRect(fm, QRect(0, 0, 1, 1), Qt::TextShowMnemonic, false, + QSize sz = style()->itemTextRect(fm, QRect(), Qt::TextShowMnemonic, false, text()).size(); if (!opt.icon.isNull()) sz = QSize(sz.width() + opt.iconSize.width() + 4, qMax(sz.height(), opt.iconSize.height())); diff --git a/src/gui/widgets/qradiobutton.cpp b/src/gui/widgets/qradiobutton.cpp index d73ff2f..20b6c720 100644 --- a/src/gui/widgets/qradiobutton.cpp +++ b/src/gui/widgets/qradiobutton.cpp @@ -195,7 +195,7 @@ QSize QRadioButton::sizeHint() const ensurePolished(); QStyleOptionButton opt; initStyleOption(&opt); - QSize sz = style()->itemTextRect(fontMetrics(), QRect(0, 0, 1, 1), Qt::TextShowMnemonic, + QSize sz = style()->itemTextRect(fontMetrics(), QRect(), Qt::TextShowMnemonic, false, text()).size(); if (!opt.icon.isNull()) sz = QSize(sz.width() + opt.iconSize.width() + 4, qMax(sz.height(), opt.iconSize.height())); |