diff options
-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())); |