qt5base-lts/tests/auto/gui/text
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
..
qabstracttextdocumentlayout QtGui tests: Remove DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 2013-03-27 03:54:42 +01:00
qcssparser Make QColor understand #AARRGGBB 2013-04-26 09:59:04 +02:00
qfont Deprecate QFont::setRawName() and QFont::rawName() 2014-03-27 22:02:39 +01:00
qfontcache QtGui tests: Remove DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 2013-03-27 03:54:42 +01:00
qfontdatabase Fix application font removal when using FontConfig 2014-03-27 14:41:53 +01:00
qfontmetrics Fix QFontMetrics width 2014-02-20 20:13:27 +01:00
qglyphrun tests: Replace Q_OS_MACX -> Q_OS_OSX 2013-10-21 10:37:56 +02:00
qrawfont Revert "test: Mark tst_QRawFont::fromFont() as XFAIL" 2013-09-20 23:45:06 +02:00
qstatictext Merge remote-tracking branch 'origin/release' into stable 2014-03-17 12:29:11 +01:00
qsyntaxhighlighter QtGui tests: Remove DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 2013-03-27 03:54:42 +01:00
qtextblock QtGui tests: Remove DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 2013-03-27 03:54:42 +01:00
qtextcursor QtGui tests: Remove DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 2013-03-27 03:54:42 +01:00
qtextdocument Fix incorrect repaints with plain text edit 2014-04-30 18:23:23 +02:00
qtextdocumentfragment Support empty inline elements in block tags in QTextDocument 2014-02-05 09:10:25 +01:00
qtextdocumentlayout QTextEngine: fix layouting of inline objects in right-aligned tabs. 2013-12-05 16:40:06 +01:00
qtextformat Allow QTextCharFormat::setFont() to skip unresolved font props 2014-01-31 00:24:48 +01:00
qtextlayout Make HarfBuzz-NG the default shaper on Mac 2014-04-14 06:43:54 +02:00
qtextlist expand tabs and related whitespace fixes in *.{cpp,h,qdoc} 2014-01-13 22:46:50 +01:00
qtextobject QtGui tests: Remove DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 2013-03-27 03:54:42 +01:00
qtextodfwriter QtGui tests: Remove DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 2013-03-27 03:54:42 +01:00
qtextpiecetable expand tabs and related whitespace fixes in *.{cpp,h,qdoc} 2014-01-13 22:46:50 +01:00
qtextscriptengine Improve the Unicode script itemization implementation 2014-04-14 06:43:57 +02:00
qtexttable QtGui tests: Remove DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 2013-03-27 03:54:42 +01:00
qzip QtGui tests: Remove DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 2013-03-27 03:54:42 +01:00
text.pro Fix the font engines leaking 2013-03-20 07:02:29 +01:00