// If the horizontal alignment is not left and the width was not valid we need to relayout
// now that we know the maximum line width.
- if (!implicitWidthValid && unwrappedLineCount > 1 && q->effectiveHAlign() != QQuickText::AlignLeft) {
+ if (!q->widthValid() && !implicitWidthValid && unwrappedLineCount > 1 && q->effectiveHAlign() != QQuickText::AlignLeft) {
widthExceeded = false;
heightExceeded = false;
continue;
void hover();
+ void growFromZeroWidth();
+
private:
QStringList standard;
QStringList richText;
QVERIFY(mouseArea->property("wasHovered").toBool());
}
+void tst_qquicktext::growFromZeroWidth()
+{
+ QQmlComponent component(&engine, testFile("growFromZeroWidth.qml"));
+
+ QScopedPointer<QObject> object(component.create());
+
+ QQuickText *text = qobject_cast<QQuickText *>(object.data());
+ QVERIFY(text);
+
+ QCOMPARE(text->lineCount(), 3);
+
+ text->setWidth(80);
+
+ // the new width should force our contents to wrap
+ QVERIFY(text->lineCount() > 3);
+}
+
QTEST_MAIN(tst_qquicktext)
#include "tst_qquicktext.moc"