diff options
| author | Frederik Gladhorn <frederik.gladhorn@digia.com> | 2013-03-20 22:39:59 +0100 |
|---|---|---|
| committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-03-21 11:00:45 +0100 |
| commit | ccdabc99f81770ad62f7a95f14668cefcb35160e (patch) | |
| tree | 16664aa7837523d098ac67370410175de5091d06 /src | |
| parent | 49b6963b40dfa2f0ec9634c71707c70f9842a418 (diff) | |
Prepare ToolButton for text, not icon only
Change-Id: I8311d611fb5e42d6dd28378c59de024dec319bcc
Reviewed-by: Jens Bache-Wiig <jens.bache-wiig@digia.com>
Diffstat (limited to 'src')
| -rw-r--r-- | src/private/qstyleitem.cpp | 4 | ||||
| -rw-r--r-- | src/styles/Desktop/ToolButtonStyle.qml | 1 |
2 files changed, 4 insertions, 1 deletions
diff --git a/src/private/qstyleitem.cpp b/src/private/qstyleitem.cpp index 7fd4dabc5..30e3a173d 100644 --- a/src/private/qstyleitem.cpp +++ b/src/private/qstyleitem.cpp @@ -260,6 +260,8 @@ void QStyleItem::initStyleOption() opt->subControls = QStyle::SC_ToolButton; opt->state |= QStyle::State_AutoRaise; opt->activeSubControls = QStyle::SC_ToolButton; + opt->toolButtonStyle = Qt::ToolButtonIconOnly; + opt->text = text(); opt->icon = m_properties["icon"].value<QIcon>(); int e = qApp->style()->pixelMetric(QStyle::PM_ToolBarIconSize, m_styleoption, 0); opt->iconSize = QSize(e, e); @@ -671,7 +673,7 @@ QSize QStyleItem::sizeFromContents(int width, int height) h = icon.height(); } if (btn->toolButtonStyle != Qt::ToolButtonIconOnly) { - QSize textSize = btn->fontMetrics.size(Qt::TextShowMnemonic, text()); + QSize textSize = btn->fontMetrics.size(Qt::TextShowMnemonic, btn->text); textSize.setWidth(textSize.width() + btn->fontMetrics.width(QLatin1Char(' '))*2); if (btn->toolButtonStyle == Qt::ToolButtonTextUnderIcon) { h += 4 + textSize.height(); diff --git a/src/styles/Desktop/ToolButtonStyle.qml b/src/styles/Desktop/ToolButtonStyle.qml index e591d129e..2fe5ea8da 100644 --- a/src/styles/Desktop/ToolButtonStyle.qml +++ b/src/styles/Desktop/ToolButtonStyle.qml @@ -53,6 +53,7 @@ Style { hover: control.__containsMouse hasFocus: control.activeFocus hints: control.styleHints.concat([control.__position]) + text: control.text properties: { "icon": control.__action.__icon |
