QPlainTextEditPrivate::updatePlaceholderVisibility() issued a full viewport update, when the document became empty and the placeholder text needed to be shown. No update was issued, when the placeholder text was replaced by a first text character entered. That relied on the assumption, that the placeholder text would disappear with the first text line being rendered (even if it has just one char). When the placeholder text covered multiple line, only the first of them disappeared. This patch adds a boolean to remember, that the placeholder text is shown. If that is the case and the first char is entered, a full update is issued, to remove all lines of the placeholder text. The boolean flag is cleared thereafter, to avoid unnecessary viewport updates. isPlaceHolderTextVisible() is renamed into placeHolderTextToBeShown(), because the method returns an instruction, rather than a state. tst_QPlainTextEdit::placeholderVisibility() is adapted to test the boolean flag, hence the real visibility of the placeholder text. That extends its scope to the bug at hand. Fixes: QTBUG-119808 Pick-to: 6.5 6.2 Change-Id: I07a7059ae619dc85d0c21247d829120e6afa7115 Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de> (cherry picked from commit 729e23f15f366f013da8e149fa95e618c9a95e13) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> (cherry picked from commit d19d32a9126f40ce9e55a7bcd976df32a675db0a)
…
Description
Languages
C++
84.3%
HTML
4.9%
C
3.9%
CMake
3.6%
Objective-C++
2%
Other
0.8%