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
Pick-to: 5.15 6.0
Change-Id: Ibec7f8f1f7331a12438fd821c2002903260da10a
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
bb10
Zhang Hao 2020-12-18 14:12:44 +08:00
parent bfc09b8d8f
commit 795ea19ca0
1 changed files with 4 additions and 2 deletions

View File

@ -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));