QTextEdit: update cursor and anchor rect upon scrolling

Both cursor and anchor rect will change locally when
scrolling. So inform IM about it, so that any overlay
done from e.g the platform plugins for dealing
with text selection etc. can respond to the change.

Change-Id: I4e839e691a20ad07d2aa062e028d22cf5f31b7fa
Reviewed-by: Jan Arve Sæther <jan-arve.saether@theqtcompany.com>
This commit is contained in:
Richard Moe Gustavsen 2016-04-13 14:40:54 +02:00
parent f8efe8e0c9
commit 40ece5edcf
2 changed files with 2 additions and 0 deletions

View File

@ -667,6 +667,7 @@ void QPlainTextEditPrivate::setTopBlock(int blockNumber, int lineNumber, int dx)
if (dx || dy) { if (dx || dy) {
viewport->scroll(q->isRightToLeft() ? -dx : dx, dy); viewport->scroll(q->isRightToLeft() ? -dx : dx, dy);
QGuiApplication::inputMethod()->update(Qt::ImCursorRectangle | Qt::ImAnchorRectangle);
} else { } else {
viewport->update(); viewport->update();
topLineFracture = 0; topLineFracture = 0;

View File

@ -1713,6 +1713,7 @@ void QTextEdit::scrollContentsBy(int dx, int dy)
if (isRightToLeft()) if (isRightToLeft())
dx = -dx; dx = -dx;
d->viewport->scroll(dx, dy); d->viewport->scroll(dx, dy);
QGuiApplication::inputMethod()->update(Qt::ImCursorRectangle | Qt::ImAnchorRectangle);
} }
/*!\reimp /*!\reimp