From 6ac69be3148822a0dafce227eab19b97722b6cc2 Mon Sep 17 00:00:00 2001 From: Mitch Curtis Date: Thu, 20 Mar 2014 10:54:21 +0100 Subject: Correct QDeclarativeTextEdit::positionToRectangle(). d->yoff is the content offset when the content is not top aligned. This means that positionToRectangle() returned incorrect values when the content was bottom or vertical center aligned. In other words, it didn't apply the offset but gave coordinates from the beginning of the content instead of from the beginning of the item. Change-Id: I044b79434b9a67b0539050e39953d5889a3ed1db Reviewed-by: J-P Nurmi --- src/declarative/graphicsitems/qdeclarativetextedit.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/declarative/graphicsitems') diff --git a/src/declarative/graphicsitems/qdeclarativetextedit.cpp b/src/declarative/graphicsitems/qdeclarativetextedit.cpp index bdcc66ba..a2e8e65c 100644 --- a/src/declarative/graphicsitems/qdeclarativetextedit.cpp +++ b/src/declarative/graphicsitems/qdeclarativetextedit.cpp @@ -673,7 +673,7 @@ QRectF QDeclarativeTextEdit::positionToRectangle(int pos) const Q_D(const QDeclarativeTextEdit); QTextCursor c(d->document); c.setPosition(pos); - return d->control->cursorRect(c); + return d->control->cursorRect(c).translated(0, d->yoff); } -- cgit v1.2.3