From 443ce5d073f8cd32469fd74e705ca9465013ebcb Mon Sep 17 00:00:00 2001 From: Zhang Hao Date: Fri, 18 Dec 2020 14:12:44 +0800 Subject: QLineEdit Cursor show white area fix QLineEdit Cursor Rect and InputMask area overlapping, the cursor rect area is white. when inputMask is set,we don't need draw cursor. Fixes: QTBUG-89578 Change-Id: Ibec7f8f1f7331a12438fd821c2002903260da10a Reviewed-by: Lars Knoll Reviewed-by: Richard Moe Gustavsen (cherry picked from commit 795ea19ca0a7e484793655b35f19de8dbc88e987) Reviewed-by: Qt Cherry-pick Bot --- src/widgets/widgets/qlineedit.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/widgets/widgets') diff --git a/src/widgets/widgets/qlineedit.cpp b/src/widgets/widgets/qlineedit.cpp index 4a877c7596..9643c4db43 100644 --- a/src/widgets/widgets/qlineedit.cpp +++ b/src/widgets/widgets/qlineedit.cpp @@ -2073,8 +2073,10 @@ void QLineEdit::paintEvent(QPaintEvent *) // Asian users see an IM selection text as cursor on candidate // selection phase of input method, so the ordinary cursor should be - // invisible if we have a preedit string. - if (d->cursorVisible && !d->control->isReadOnly()) + // invisible if we have a preedit string. another condition is when inputmask + // isn't empty,we don't need draw cursor,because cursor and character overlaping + // area is white. + if (d->cursorVisible && !d->control->isReadOnly() && d->control->inputMask().isEmpty()) flags |= QWidgetLineControl::DrawCursor; d->control->setCursorWidth(style()->pixelMetric(QStyle::PM_TextCursorWidth, &panel)); -- cgit v1.2.3