diff options
author | Qt Continuous Integration System <qt-info@nokia.com> | 2010-11-05 15:41:16 (GMT) |
---|---|---|
committer | Qt Continuous Integration System <qt-info@nokia.com> | 2010-11-05 15:41:16 (GMT) |
commit | caab2c851b4a1b67d57663d791e67f09c54b64fb (patch) | |
tree | deb8245ba69f326fb43e87a13b1b1e5378d90a8f /src/declarative/graphicsitems/qdeclarativetext.cpp | |
parent | 60b09b8915e2095b221eb0a16a76d49e5bb10391 (diff) | |
parent | d2c204a93f30238c705209e65e2e8bce148825cd (diff) | |
download | Qt-caab2c851b4a1b67d57663d791e67f09c54b64fb.zip Qt-caab2c851b4a1b67d57663d791e67f09c54b64fb.tar.gz Qt-caab2c851b4a1b67d57663d791e67f09c54b64fb.tar.bz2 |
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/qt-qml into 4.7-integration
* '4.7' of scm.dev.nokia.troll.no:qt/qt-qml: (24 commits)
Image bounding rect should always include the area being painted
Fix minehunt.pro (minehunt is no longer a plugin)
Don't allow flagging of flipped tiles in Minehunt
Remove Snake demo from QtDemo
Fix samegame text input focus
Whitespace fixes
Update visual tests for Mac.
Run all QML visual tests now.
Make qmlvisual tests more stable
Add documentation about script evaluation context and allowed types
Maintain passing visualtests on X11
Fix errors in example code. Also reverts the example code to the old
Largely rewrite the Using QML in C++ Applications documentation. It
Document list type operations
Fix regression in 648eb76c and update visual tests.
Don't emit xChanged()/yChanged() twice.
Add testcase for QTBUG-13719.
Doc fix
highlightranges.qml example and visual test contained binding loop.
Combining ListView.StrictlyEnforceRange and resizing currentItem stalls.
...
Diffstat (limited to 'src/declarative/graphicsitems/qdeclarativetext.cpp')
-rw-r--r-- | src/declarative/graphicsitems/qdeclarativetext.cpp | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/src/declarative/graphicsitems/qdeclarativetext.cpp b/src/declarative/graphicsitems/qdeclarativetext.cpp index 03c9765..84f276e 100644 --- a/src/declarative/graphicsitems/qdeclarativetext.cpp +++ b/src/declarative/graphicsitems/qdeclarativetext.cpp @@ -219,6 +219,7 @@ void QDeclarativeTextPrivate::updateSize() QFontMetrics fm(font); if (text.isEmpty()) { + q->setImplicitWidth(0); q->setImplicitHeight(fm.height()); emit q->paintedSizeChanged(); q->update(); @@ -291,30 +292,30 @@ QSize QDeclarativeTextPrivate::setupTextLayout() qreal height = 0; qreal lineWidth = 0; - //set manual width - if (q->widthValid()) - lineWidth = q->width(); - QTextOption textOption = layout.textOption(); - textOption.setWrapMode(QTextOption::WrapMode(wrapMode)); + textOption.setWrapMode(QTextOption::NoWrap); textOption.setAlignment(Qt::Alignment(hAlign)); - layout.setTextOption(textOption); + // if the item has an explicit width, we set the line width and enable wrapping + if (q->widthValid()) { + lineWidth = q->width(); + textOption.setWrapMode(QTextOption::WrapMode(wrapMode)); + } + + layout.setTextOption(textOption); layout.beginLayout(); while (1) { QTextLine line = layout.createLine(); if (!line.isValid()) break; - if (q->widthValid()) { - line.setLineWidth(lineWidth); - line.setPosition(QPointF(0, height)); - height += line.height(); - } + line.setLineWidth(lineWidth); + line.setPosition(QPointF(0, height)); + height += line.height(); } layout.endLayout(); - return QSize(qCeil(layout.boundingRect().width()), layout.boundingRect().height()); + return layout.boundingRect().toAlignedRect().size(); } /*! |