summaryrefslogtreecommitdiffstats
path: root/src/declarative/graphicsitems/qdeclarativetextedit.cpp
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2010-06-24 03:39:38 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2010-06-24 03:39:38 (GMT)
commitfb5fc5eead19a079853ebc3b0f8eddd94bbc0154 (patch)
tree8aec4d1a03e199a8c0f8cc7b9cecf91a098630fd /src/declarative/graphicsitems/qdeclarativetextedit.cpp
parente5722f539888913b9bea4f91db95f5e2c5fceed1 (diff)
parent52b3d6263bb58ca82a8f00d42af801f5ed521f6b (diff)
downloadQt-fb5fc5eead19a079853ebc3b0f8eddd94bbc0154.zip
Qt-fb5fc5eead19a079853ebc3b0f8eddd94bbc0154.tar.gz
Qt-fb5fc5eead19a079853ebc3b0f8eddd94bbc0154.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: Update lupdate to recognize concatenated text in QML files. Ensure sourcesize is in pixmap cache key. Use ugly but reliable bitmaps fonts in test. doc: note that calling methods before component completion may have no effect Fix unstable qdeclarativeviewer tests Use Pen with Qt::MiterJoin when drawing Rectangles with gradients Update screenshot Fix and better test Text / TextEdit alignments. Ensure the view is correctly positioned at component complete. Support for non-literal plural arguments to qsTr() in lupdate (QML). References to undefined variables throws a ReferenceError
Diffstat (limited to 'src/declarative/graphicsitems/qdeclarativetextedit.cpp')
-rw-r--r--src/declarative/graphicsitems/qdeclarativetextedit.cpp28
1 files changed, 24 insertions, 4 deletions
diff --git a/src/declarative/graphicsitems/qdeclarativetextedit.cpp b/src/declarative/graphicsitems/qdeclarativetextedit.cpp
index 3106daf..7db21f2 100644
--- a/src/declarative/graphicsitems/qdeclarativetextedit.cpp
+++ b/src/declarative/graphicsitems/qdeclarativetextedit.cpp
@@ -1231,8 +1231,13 @@ void QDeclarativeTextEdit::updateImgCache(const QRectF &rf)
r = QRect(0,0,INT_MAX,INT_MAX);
} else {
r = rf.toRect();
- if (r != QRect(0,0,INT_MAX,INT_MAX)) // Don't translate "everything"
+ if (r.height() > INT_MAX/2) {
+ // Take care of overflow when translating "everything"
+ r.setTop(r.y() + d->yoff);
+ r.setBottom(INT_MAX/2);
+ } else {
r = r.translated(0,d->yoff);
+ }
}
dirtyCache(r);
emit update();
@@ -1327,6 +1332,14 @@ void QDeclarativeTextEdit::updateSelectionMarkers()
}
}
+QRectF QDeclarativeTextEdit::boundingRect() const
+{
+ Q_D(const QDeclarativeTextEdit);
+ QRectF r = QDeclarativePaintedItem::boundingRect();
+ return r.translated(0,d->yoff);
+}
+
+
//### we should perhaps be a bit smarter here -- depending on what has changed, we shouldn't
// need to do all the calculations each time
void QDeclarativeTextEdit::updateSize()
@@ -1341,13 +1354,20 @@ void QDeclarativeTextEdit::updateSize()
d->document->setTextWidth(width());
dy -= (int)d->document->size().height();
+ int nyoff;
if (heightValid()) {
if (d->vAlign == AlignBottom)
- d->yoff = dy;
+ nyoff = dy;
else if (d->vAlign == AlignVCenter)
- d->yoff = dy/2;
+ nyoff = dy/2;
+ else
+ nyoff = 0;
} else {
- d->yoff = 0;
+ nyoff = 0;
+ }
+ if (nyoff != d->yoff) {
+ prepareGeometryChange();
+ d->yoff = nyoff;
}
setBaselineOffset(fm.ascent() + d->yoff + d->textMargin);