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;
|
||||
} else {
|
||||
if (m_selstart != m_selend)
|
||||
selectionChange = true;
|
||||
m_selstart = m_selend = 0;
|
||||
}
|
||||
cursorPositionChanged = true;
|
||||
|
@ -3846,13 +3846,26 @@ void tst_QLineEdit::inputMethodSelection()
|
||||
QCOMPARE(selectionSpy.count(), 1);
|
||||
QCOMPARE(testWidget->selectionStart(), 0);
|
||||
|
||||
QList<QInputMethodEvent::Attribute> attributes;
|
||||
attributes << QInputMethodEvent::Attribute(QInputMethodEvent::Selection, 12, 5, QVariant());
|
||||
QInputMethodEvent event("", attributes);
|
||||
QApplication::sendEvent(testWidget, &event);
|
||||
// selection gained
|
||||
{
|
||||
QList<QInputMethodEvent::Attribute> attributes;
|
||||
attributes << QInputMethodEvent::Attribute(QInputMethodEvent::Selection, 12, 5, QVariant());
|
||||
QInputMethodEvent event("", attributes);
|
||||
QApplication::sendEvent(testWidget, &event);
|
||||
}
|
||||
|
||||
QCOMPARE(selectionSpy.count(), 2);
|
||||
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()
|
||||
|
Loading…
Reference in New Issue
Block a user