Fixed QLineEdit to emit selectionChanged
Was not emitted when removed by input method event. Change-Id: Ia2c0dcb09d42826188d4612f4c1705a41874a31d Reviewed-by: Andrew den Exter <andrew.den-exter@nokia.com>
This commit is contained in:
parent
b188221fee
commit
337eedb316
@ -552,6 +552,8 @@ void QWidgetLineControl::processInputMethodEvent(QInputMethodEvent *event)
|
|||||||
}
|
}
|
||||||
selectionChange = true;
|
selectionChange = true;
|
||||||
} else {
|
} else {
|
||||||
|
if (m_selstart != m_selend)
|
||||||
|
selectionChange = true;
|
||||||
m_selstart = m_selend = 0;
|
m_selstart = m_selend = 0;
|
||||||
}
|
}
|
||||||
cursorPositionChanged = true;
|
cursorPositionChanged = true;
|
||||||
|
@ -3846,13 +3846,26 @@ void tst_QLineEdit::inputMethodSelection()
|
|||||||
QCOMPARE(selectionSpy.count(), 1);
|
QCOMPARE(selectionSpy.count(), 1);
|
||||||
QCOMPARE(testWidget->selectionStart(), 0);
|
QCOMPARE(testWidget->selectionStart(), 0);
|
||||||
|
|
||||||
QList<QInputMethodEvent::Attribute> attributes;
|
// selection gained
|
||||||
attributes << QInputMethodEvent::Attribute(QInputMethodEvent::Selection, 12, 5, QVariant());
|
{
|
||||||
QInputMethodEvent event("", attributes);
|
QList<QInputMethodEvent::Attribute> attributes;
|
||||||
QApplication::sendEvent(testWidget, &event);
|
attributes << QInputMethodEvent::Attribute(QInputMethodEvent::Selection, 12, 5, QVariant());
|
||||||
|
QInputMethodEvent event("", attributes);
|
||||||
|
QApplication::sendEvent(testWidget, &event);
|
||||||
|
}
|
||||||
|
|
||||||
QCOMPARE(selectionSpy.count(), 2);
|
QCOMPARE(selectionSpy.count(), 2);
|
||||||
QCOMPARE(testWidget->selectionStart(), 12);
|
QCOMPARE(testWidget->selectionStart(), 12);
|
||||||
|
|
||||||
|
// selection removed
|
||||||
|
{
|
||||||
|
QList<QInputMethodEvent::Attribute> attributes;
|
||||||
|
attributes << QInputMethodEvent::Attribute(QInputMethodEvent::Selection, 0, 0, QVariant());
|
||||||
|
QInputMethodEvent event("", attributes);
|
||||||
|
QApplication::sendEvent(testWidget, &event);
|
||||||
|
}
|
||||||
|
|
||||||
|
QCOMPARE(selectionSpy.count(), 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
void tst_QLineEdit::inputMethodTentativeCommit()
|
void tst_QLineEdit::inputMethodTentativeCommit()
|
||||||
|
Loading…
Reference in New Issue
Block a user