summaryrefslogtreecommitdiffstats
path: root/src/declarative/graphicsitems
diff options
context:
space:
mode:
authorYann Bodson <yann.bodson@nokia.com>2010-11-02 06:41:01 (GMT)
committerYann Bodson <yann.bodson@nokia.com>2010-11-02 06:43:34 (GMT)
commit11bb4f85ef38270758ec0930709c23c7fcb5840c (patch)
tree5cbefe18875c73f2a7441de0ef51894fea38be34 /src/declarative/graphicsitems
parent13eebf835df3d8fec88a68b571d33e73da929413 (diff)
downloadQt-11bb4f85ef38270758ec0930709c23c7fcb5840c.zip
Qt-11bb4f85ef38270758ec0930709c23c7fcb5840c.tar.gz
Qt-11bb4f85ef38270758ec0930709c23c7fcb5840c.tar.bz2
Regression: Text element breaks when using \n for separating lines
Task-number: QTBUG-14915 Reviewed-by: Michael Brasser
Diffstat (limited to 'src/declarative/graphicsitems')
-rw-r--r--src/declarative/graphicsitems/qdeclarativetext.cpp24
1 files changed, 12 insertions, 12 deletions
diff --git a/src/declarative/graphicsitems/qdeclarativetext.cpp b/src/declarative/graphicsitems/qdeclarativetext.cpp
index 03c9765..8cb47aa 100644
--- a/src/declarative/graphicsitems/qdeclarativetext.cpp
+++ b/src/declarative/graphicsitems/qdeclarativetext.cpp
@@ -291,30 +291,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();
}
/*!