summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/declarative/graphicsitems/qmlgraphicstext.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/declarative/graphicsitems/qmlgraphicstext.cpp b/src/declarative/graphicsitems/qmlgraphicstext.cpp
index bfb928a..b13fb7c 100644
--- a/src/declarative/graphicsitems/qmlgraphicstext.cpp
+++ b/src/declarative/graphicsitems/qmlgraphicstext.cpp
@@ -452,7 +452,7 @@ void QmlGraphicsText::setTextFormat(TextFormat format)
the first string that fits will be used, otherwise the last will be elided.
Multi-length strings are ordered from longest to shortest, separated by the
- Unicode "String Terminator" character \c U009C (write this in QML with \c{"\\x9C"}).
+ Unicode "String Terminator" character \c U009C (write this in QML with \c{"\u009C"} or \c{"\x9C"}).
*/
QmlGraphicsText::TextElideMode QmlGraphicsText::elideMode() const
{
@@ -479,6 +479,15 @@ void QmlGraphicsText::geometryChanged(const QRectF &newGeometry,
Q_D(QmlGraphicsText);
if (newGeometry.width() != oldGeometry.width()) {
if (d->wrap || d->elideMode != QmlGraphicsText::ElideNone) {
+ //re-elide if needed
+ if (d->singleline && d->elideMode != QmlGraphicsText::ElideNone &&
+ isComponentComplete() && widthValid()) {
+
+ QFontMetrics fm(d->font);
+ QString tmp = fm.elidedText(d->text,(Qt::TextElideMode)d->elideMode,width()); // XXX still worth layout...?
+ d->layout.setText(tmp);
+ }
+
d->imgDirty = true;
d->updateSize();
}