Make sure that TextInteractionFlags get set.
The first time the function is called, it could fail to set the flags. Calling setSelectByKeyboard(true) would not actually set the text interaction flags (was == on). The test didn't detect it because it called setReadOnly before setSelectByKeyboard. Change-Id: Ia54cc782b6ad5a74f1d7029c92fa230116d034b0 Reviewed-by: J-P Nurmi <jpnurmi@digia.com>
This commit is contained in:
parent
d6625ac911
commit
7148a79775
|
@ -1265,8 +1265,8 @@ void QQuickTextEdit::setSelectByKeyboard(bool on)
|
|||
{
|
||||
Q_D(QQuickTextEdit);
|
||||
bool was = selectByKeyboard();
|
||||
d->selectByKeyboardSet = true;
|
||||
if (was != on) {
|
||||
if (!d->selectByKeyboardSet || was != on) {
|
||||
d->selectByKeyboardSet = true;
|
||||
d->selectByKeyboard = on;
|
||||
if (on)
|
||||
d->control->setTextInteractionFlags(d->control->textInteractionFlags() | Qt::TextSelectableByKeyboard);
|
||||
|
|
|
@ -2171,8 +2171,8 @@ void tst_qquicktextedit::keyboardSelection()
|
|||
QVERIFY(edit);
|
||||
|
||||
edit->setText(text);
|
||||
edit->setReadOnly(readOnly);
|
||||
edit->setSelectByKeyboard(selectByKeyboard);
|
||||
edit->setReadOnly(readOnly);
|
||||
edit->setCursorPosition(cursorPosition);
|
||||
|
||||
QQuickWindow window;
|
||||
|
|
Loading…
Reference in New Issue