diff --git a/src/widgets/widgets/qlineedit.cpp b/src/widgets/widgets/qlineedit.cpp index 1833dce40b..ba4dbcc878 100644 --- a/src/widgets/widgets/qlineedit.cpp +++ b/src/widgets/widgets/qlineedit.cpp @@ -1493,6 +1493,9 @@ void QLineEdit::mousePressEvent(QMouseEvent* e) return; } bool mark = e->modifiers() & Qt::ShiftModifier; +#ifdef Q_OS_ANDROID + mark = mark && (d->imHints & Qt::ImhNoPredictiveText); +#endif // Q_OS_ANDROID int cursor = d->xToPos(e->pos().x()); #ifndef QT_NO_DRAGANDDROP if (!mark && d->dragEnabled && d->control->echoMode() == Normal && @@ -1520,14 +1523,19 @@ void QLineEdit::mouseMoveEvent(QMouseEvent * e) } else #endif { - if (d->control->composeMode()) { +#ifndef Q_OS_ANDROID + const bool select = true; +#else + const bool select = (d->imHints & Qt::ImhNoPredictiveText); +#endif + if (d->control->composeMode() && select) { int startPos = d->xToPos(d->mousePressPos.x()); int currentPos = d->xToPos(e->pos().x()); if (startPos != currentPos) d->control->setSelection(startPos, currentPos - startPos); } else { - d->control->moveCursor(d->xToPos(e->pos().x()), true); + d->control->moveCursor(d->xToPos(e->pos().x()), select); } } } diff --git a/src/widgets/widgets/qlineedit_p.cpp b/src/widgets/widgets/qlineedit_p.cpp index 891839ed56..9ff77c87de 100644 --- a/src/widgets/widgets/qlineedit_p.cpp +++ b/src/widgets/widgets/qlineedit_p.cpp @@ -95,7 +95,12 @@ void QLineEditPrivate::_q_completionHighlighted(QString newText) QString text = control->text(); q->setText(text.left(c) + newText.mid(c)); control->moveCursor(control->end(), false); - control->moveCursor(c, true); +#ifndef Q_OS_ANDROID + const bool mark = true; +#else + const bool mark = (imHints & Qt::ImhNoPredictiveText); +#endif + control->moveCursor(c, mark); } }