diff options
author | Christian Ehrlicher <ch.ehrlicher@gmx.de> | 2023-01-27 16:22:22 +0100 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2023-01-30 23:25:56 +0000 |
commit | 1d01af306dd7affeca055398b74c36883982d631 (patch) | |
tree | a1e3c00b1aa114128e7ed8ac237d44c613e50d0f | |
parent | 872440dc0a565e83d3bf841b9ab3a545156e6c5c (diff) |
QToolButton: Elide text when constraints prevent from showing whole text
Follow-up of b2a282d7c7b8f49819bbc86ed705980438ecb04b - elide the text
also when the QToolButton has no icon (=text only)
Fixes: QTBUG-64132
Change-Id: If4d3758452f37df411931a6628846988a3418d8e
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
(cherry picked from commit 021906f6c985b838461d28c7f121d4c3bc7e6499)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r-- | src/widgets/styles/qcommonstyle.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/widgets/styles/qcommonstyle.cpp b/src/widgets/styles/qcommonstyle.cpp index 8d115c6dc6..62b6a6831f 100644 --- a/src/widgets/styles/qcommonstyle.cpp +++ b/src/widgets/styles/qcommonstyle.cpp @@ -1708,8 +1708,9 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt, alignment |= Qt::TextHideMnemonic; rect.translate(shiftX, shiftY); p->setFont(toolbutton->font); + const QString text = d->toolButtonElideText(toolbutton, rect, alignment); proxy()->drawItemText(p, rect, alignment, toolbutton->palette, - opt->state & State_Enabled, toolbutton->text, + opt->state & State_Enabled, text, QPalette::ButtonText); } else { QPixmap pm; |