forked from qt-creator/qt-creator
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 <christian.stenger@qt.io>
This commit is contained in:
@@ -874,21 +874,24 @@ void ManhattanStyle::drawControl(ControlElement element, const QStyleOption *opt
|
|||||||
editRect.adjust(0, 0, -13, 0);
|
editRect.adjust(0, 0, -13, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Qt::TextElideMode elideMode = Qt::ElideRight;
|
||||||
|
if (widget && widget->dynamicPropertyNames().contains("elidemode"))
|
||||||
|
elideMode = widget->property("elidemode").value<Qt::TextElideMode>();
|
||||||
|
|
||||||
QLatin1Char asterisk('*');
|
QLatin1Char asterisk('*');
|
||||||
int elideWidth = editRect.width();
|
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)
|
&& cb->currentText.endsWith(asterisk)
|
||||||
&& option->fontMetrics.horizontalAdvance(cb->currentText) > elideWidth;
|
&& option->fontMetrics.horizontalAdvance(cb->currentText)
|
||||||
|
> elideWidth;
|
||||||
|
|
||||||
QString text;
|
QString text;
|
||||||
if (notElideAsterisk) {
|
if (notElideAsterisk) {
|
||||||
elideWidth -= option->fontMetrics.horizontalAdvance(asterisk);
|
elideWidth -= option->fontMetrics.horizontalAdvance(asterisk);
|
||||||
text = asterisk;
|
text = asterisk;
|
||||||
}
|
}
|
||||||
Qt::TextElideMode elideMode = Qt::ElideRight;
|
|
||||||
if (widget && widget->dynamicPropertyNames().contains("elidemode"))
|
|
||||||
elideMode = widget->property("elidemode").value<Qt::TextElideMode>();
|
|
||||||
text.prepend(option->fontMetrics.elidedText(cb->currentText, elideMode, elideWidth));
|
text.prepend(option->fontMetrics.elidedText(cb->currentText, elideMode, elideWidth));
|
||||||
|
|
||||||
if (creatorTheme()->flag(Theme::ComboBoxDrawTextShadow)
|
if (creatorTheme()->flag(Theme::ComboBoxDrawTextShadow)
|
||||||
|
Reference in New Issue
Block a user