aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/quick/items/qquicktext.cpp17
1 files changed, 15 insertions, 2 deletions
diff --git a/src/quick/items/qquicktext.cpp b/src/quick/items/qquicktext.cpp
index d7303352c5..e1a28a466a 100644
--- a/src/quick/items/qquicktext.cpp
+++ b/src/quick/items/qquicktext.cpp
@@ -402,7 +402,7 @@ void QQuickTextPrivate::updateSize()
if (text.isEmpty()) {
qreal fontHeight = fm.height();
q->setImplicitSize(0, fontHeight);
- layedOutTextRect = QRect(0, 0, 0, fontHeight);
+ layedOutTextRect = QRectF(0, 0, 0, fontHeight);
emit q->contentSizeChanged();
updateType = UpdatePaintNode;
q->update();
@@ -2001,7 +2001,20 @@ QRectF QQuickText::boundingRect() const
// Could include font max left/right bearings to either side of rectangle.
- int h = height();
+ qreal w = width();
+ switch (d->hAlign) {
+ case AlignLeft:
+ case AlignJustify:
+ break;
+ case AlignRight:
+ rect.moveLeft(w - rect.width());
+ break;
+ case AlignHCenter:
+ rect.moveLeft((w - rect.width()) / 2);
+ break;
+ }
+
+ qreal h = height();
switch (d->vAlign) {
case AlignTop:
break;