diff options
author | Lorn Potter <lorn.potter@nokia.com> | 2010-06-30 02:22:25 (GMT) |
---|---|---|
committer | Lorn Potter <lorn.potter@nokia.com> | 2010-06-30 02:22:25 (GMT) |
commit | a9b6c59857c28f48e093abccaf9a89755b0995bc (patch) | |
tree | 0af25583601858bca4f2d61540220a9c10890e35 /src/gui | |
parent | 5a6d8c40791da2e8751965d05ae2d5ef69bed301 (diff) | |
parent | 587b0fed9bd17a378eb0212c95074df965549ef2 (diff) | |
download | Qt-a9b6c59857c28f48e093abccaf9a89755b0995bc.zip Qt-a9b6c59857c28f48e093abccaf9a89755b0995bc.tar.gz Qt-a9b6c59857c28f48e093abccaf9a89755b0995bc.tar.bz2 |
Merge branch '4.7' of git://gitorious.org/qt/qt into 4.7
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/widgets/qcommandlinkbutton.cpp | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/src/gui/widgets/qcommandlinkbutton.cpp b/src/gui/widgets/qcommandlinkbutton.cpp index e8fe299..d3b5869 100644 --- a/src/gui/widgets/qcommandlinkbutton.cpp +++ b/src/gui/widgets/qcommandlinkbutton.cpp @@ -118,7 +118,7 @@ public: int topMargin() const { return 10; } int leftMargin() const { return 7; } int rightMargin() const { return 4; } - int bottomMargin() const { return 4; } + int bottomMargin() const { return 10; } QString description; QColor currentColor; @@ -174,8 +174,15 @@ QFont QCommandLinkButtonPrivate::descriptionFont() const QRect QCommandLinkButtonPrivate::titleRect() const { Q_Q(const QCommandLinkButton); - return q->rect().adjusted(textOffset(), topMargin(), - -rightMargin(), 0); + QRect r = q->rect().adjusted(textOffset(), topMargin(), -rightMargin(), 0); + if (description.isEmpty()) + { + QFontMetrics fm(titleFont()); + r.setTop(r.top() + qMax(0, (q->icon().actualSize(q->iconSize()).height() + - fm.height()) / 2)); + } + + return r; } QRect QCommandLinkButtonPrivate::descriptionRect() const @@ -254,7 +261,7 @@ QSize QCommandLinkButton::minimumSizeHint() const Q_D(const QCommandLinkButton); QSize size = sizeHint(); int minimumHeight = qMax(d->descriptionOffset() + d->bottomMargin(), - iconSize().height() + d->topMargin()); + icon().actualSize(iconSize()).height() + d->topMargin()); size.setHeight(minimumHeight); return size; } @@ -328,7 +335,8 @@ int QCommandLinkButton::heightForWidth(int width) const int heightWithoutDescription = d->descriptionOffset() + d->bottomMargin(); // find the width available for the description area return qMax(heightWithoutDescription + d->descriptionHeight(width), - iconSize().height() + d->topMargin() + d->bottomMargin()); + icon().actualSize(iconSize()).height() + d->topMargin() + + d->bottomMargin()); } /*! \reimp */ |