summaryrefslogtreecommitdiff
path: root/src/plugins/coreplugin/manhattanstyle.cpp
diff options
context:
space:
mode:
authorVasiliy Sorokin <sorokin.vasiliy@gmail.com>2012-10-11 11:18:26 +0400
committerDavid Schulz <david.schulz@digia.com>2012-10-30 08:36:30 +0100
commita1340760620a18004a8244e7815bfe645a812d50 (patch)
tree63fea39e7cbc3e674883c1a0c3edd1736072ac74 /src/plugins/coreplugin/manhattanstyle.cpp
parent67b0637934d0aacc5f9e3525fb8e91623fd7a9bf (diff)
downloadqt-creator-a1340760620a18004a8244e7815bfe645a812d50.tar.gz
Showing asterisk on EditorToolbar for unsaved files with long names
Task-number: QTCREATORBUG-8003 Change-Id: If9ac6d75123e65486ff0cf243c9537805f3fe5a3 Reviewed-by: David Schulz <david.schulz@digia.com>
Diffstat (limited to 'src/plugins/coreplugin/manhattanstyle.cpp')
-rw-r--r--src/plugins/coreplugin/manhattanstyle.cpp15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/plugins/coreplugin/manhattanstyle.cpp b/src/plugins/coreplugin/manhattanstyle.cpp
index 3b0163217a..330f6576d3 100644
--- a/src/plugins/coreplugin/manhattanstyle.cpp
+++ b/src/plugins/coreplugin/manhattanstyle.cpp
@@ -718,7 +718,20 @@ void ManhattanStyle::drawControl(ControlElement element, const QStyleOption *opt
editRect.adjust(0, 0, -13, 0);
}
- QString text = option->fontMetrics.elidedText(cb->currentText, Qt::ElideRight, editRect.width());
+ QLatin1Char asterisk('*');
+ int elideWidth = editRect.width();
+
+ bool notElideAsterisk = widget && widget->property("notelideasterisk").toBool()
+ && cb->currentText.endsWith(asterisk)
+ && option->fontMetrics.width(cb->currentText) > elideWidth;
+
+ QString text;
+ if (notElideAsterisk) {
+ elideWidth -= option->fontMetrics.width(asterisk);
+ text = asterisk;
+ }
+ text.prepend(option->fontMetrics.elidedText(cb->currentText, Qt::ElideRight, elideWidth));
+
if ((option->state & State_Enabled)) {
painter->setPen(QColor(0, 0, 0, 70));
painter->drawText(editRect.adjusted(1, 0, -1, 0), Qt::AlignLeft | Qt::AlignVCenter, text);