From 373200accf6401f1b5fee7d93e87ab7841c50a6d Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Wed, 23 Nov 2022 11:07:42 +0100 Subject: [PATCH] Fix double * for long names of changed documents We used to elide the right part of the name, and needed to take care of not eliding the * away in that case. Now we elide in the middle, and in that case the * may not be added to the elided text again. Change-Id: I646b51d315e141a65df67841e163826e7136c118 Reviewed-by: Christian Stenger --- src/plugins/coreplugin/manhattanstyle.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/plugins/coreplugin/manhattanstyle.cpp b/src/plugins/coreplugin/manhattanstyle.cpp index 43b30b65550..2164cd22380 100644 --- a/src/plugins/coreplugin/manhattanstyle.cpp +++ b/src/plugins/coreplugin/manhattanstyle.cpp @@ -874,21 +874,24 @@ void ManhattanStyle::drawControl(ControlElement element, const QStyleOption *opt editRect.adjust(0, 0, -13, 0); } + Qt::TextElideMode elideMode = Qt::ElideRight; + if (widget && widget->dynamicPropertyNames().contains("elidemode")) + elideMode = widget->property("elidemode").value(); + QLatin1Char asterisk('*'); int elideWidth = editRect.width(); - bool notElideAsterisk = widget && widget->property("notelideasterisk").toBool() + bool notElideAsterisk = elideMode == Qt::ElideRight && widget + && widget->property("notelideasterisk").toBool() && cb->currentText.endsWith(asterisk) - && option->fontMetrics.horizontalAdvance(cb->currentText) > elideWidth; + && option->fontMetrics.horizontalAdvance(cb->currentText) + > elideWidth; QString text; if (notElideAsterisk) { elideWidth -= option->fontMetrics.horizontalAdvance(asterisk); text = asterisk; } - Qt::TextElideMode elideMode = Qt::ElideRight; - if (widget && widget->dynamicPropertyNames().contains("elidemode")) - elideMode = widget->property("elidemode").value(); text.prepend(option->fontMetrics.elidedText(cb->currentText, elideMode, elideWidth)); if (creatorTheme()->flag(Theme::ComboBoxDrawTextShadow)