qt5base-lts/tests/auto/gui
Simon Hausmann 12eb3b51c4 Fix incorrect repaints with plain text edit
The plain text edit's smart repaint logic in
QPlainTextDocumentLayout::documentChanged assumes that during a change inside
just one block, the block is in the state before the edit and a call to
layoutBlock() is going to bring it up-to-date. Then only a comparison of the
bounding rect - before and after - is going to allow for smart repaints.

The assumption of the layout being in the same state as before the edit got
broken by commit cc57a2e90f, which introduced
code to use a QTextCursor within a slot connected to QTextDocument's
contentsChange signal. The usage of the QTextCursor there ends up updating the
layout of the block ahead of time, breaking the assumption and therefore the
optimization, in the sense that during changes in the preedit that cause a
change of height / line count, the old bounding rect in
QPlainTextDocumentLayout::documentChanged and the new bounding rect will be the
same. This causes a repaint of only the edited block, missing repaints of the
following blocks, even though the line count effectively changed.

So what's causing QTextCursor to mess with the layout is the attempt of
updating the vertical movement x property. This patch inhibits the update,
marking it as dirty for initialization later. This means that slots connected
to this low-level signal cannot rely on the cursor's visual x position, but
that doesn't seem useful anyway and isn't required for commit
cc57a2e90f.

Task-number: QTBUG-38536
Change-Id: I5fae12d646a4b2d2cc22b9f2d021e5dc8cfdda94
Reviewed-by: Paul Olav Tvete <paul.tvete@digia.com>
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
2014-04-30 18:23:23 +02:00
..
image Avoid out of bounds memory reads when scaling images 2014-03-28 22:52:19 +01:00
itemmodels tests: Remove superfluous gui additions to QT 2014-02-28 17:59:29 +01:00
kernel QEvent: document and check when registerEventTypes() returns -1 2014-03-29 12:40:05 +01:00
math3d Add operator[] to QVectorND classes 2013-08-27 17:50:40 +02:00
painting QPageLayout: provide op!= 2014-04-08 22:07:01 +02:00
qopengl Make tst_qopengl more verbose. 2014-03-31 19:50:37 +02:00
text Fix incorrect repaints with plain text edit 2014-04-30 18:23:23 +02:00
util Bugfix QDesktopServices on Windows 2013-07-11 10:56:49 +02:00
gui.pro purge vestiges of opengl es 1 support 2014-04-04 19:32:21 +02:00