diff options
author | Gareth Stockwell <ext-gareth.stockwell@nokia.com> | 2010-02-19 14:34:04 (GMT) |
---|---|---|
committer | Gareth Stockwell <ext-gareth.stockwell@nokia.com> | 2010-02-19 14:34:04 (GMT) |
commit | 3131c8cf9a2641cb62eef8c05acf727282b8f11d (patch) | |
tree | 2577b5277379fa8beb90d66f523b257f6f65fa9b /src | |
parent | 4cabe964bc02e07fe96dd8fda5f8c73a6e1d6a12 (diff) | |
parent | 145f46347bdcdf0efe2821b8ae2c34f53c543d1c (diff) | |
download | Qt-3131c8cf9a2641cb62eef8c05acf727282b8f11d.zip Qt-3131c8cf9a2641cb62eef8c05acf727282b8f11d.tar.gz Qt-3131c8cf9a2641cb62eef8c05acf727282b8f11d.tar.bz2 |
Merge branch '4.6' of S:\dynamic\git\qt\trolltech\qt-s60-public.git\ into 4.6
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/styles/qs60style.cpp | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp index 74707af..565cc2c 100644 --- a/src/gui/styles/qs60style.cpp +++ b/src/gui/styles/qs60style.cpp @@ -2396,10 +2396,20 @@ QSize QS60Style::sizeFromContents(ContentsType ct, const QStyleOption *opt, case CT_PushButton: sz = QCommonStyle::sizeFromContents( ct, opt, csz, widget); //FIXME properly - style should calculate the location of border frame-part - sz += QSize(2 * pixelMetric(PM_ButtonMargin), 2 * pixelMetric(PM_ButtonMargin)); - if (const QAbstractButton *buttonWidget = (qobject_cast<const QAbstractButton *>(widget))) + if (const QAbstractButton *buttonWidget = (qobject_cast<const QAbstractButton *>(widget))) { if (buttonWidget->isCheckable()) sz += QSize(pixelMetric(PM_IndicatorWidth) + pixelMetric(PM_CheckBoxLabelSpacing), 0); + const int iconHeight = (!buttonWidget->icon().isNull()) ? buttonWidget->iconSize().height() : 0; + const int textHeight = (buttonWidget->text().length() > 0) ? + buttonWidget->fontMetrics().size(Qt::TextSingleLine, buttonWidget->text()).height() : 0; + const int decoratorHeight = (buttonWidget->isCheckable()) ? pixelMetric(PM_IndicatorHeight) : 0; + + const int contentHeight = + qMax(qMax(iconHeight, decoratorHeight) + pixelMetric(PM_ButtonMargin), + textHeight + 2*pixelMetric(PM_ButtonMargin)); + sz.setHeight(contentHeight); + sz += QSize(2 * pixelMetric(PM_ButtonMargin), 0); + } break; case CT_LineEdit: if (const QStyleOptionFrame *f = qstyleoption_cast<const QStyleOptionFrame *>(opt)) |