Fixed QLineEdit::inputMethodQuery() for Qt::ImHints

It should return QWidget::inputMethodHints() instead of QVariant()

Change-Id: I01f5de8f2087ac67d125f54f08abed523653eb92
Reviewed-by: Joona Petrell <joona.t.petrell@nokia.com>
bb10
Tasuku Suzuki 2012-05-22 03:05:00 +09:00 committed by Qt by Nokia
parent 6ee1c645ac
commit 8b78b3a620
2 changed files with 22 additions and 1 deletions

View File

@ -1682,7 +1682,7 @@ QVariant QLineEdit::inputMethodQuery(Qt::InputMethodQuery property) const
else
return QVariant(d->control->selectionStart());
default:
return QVariant();
return QWidget::inputMethodQuery(property);
}
}

View File

@ -283,6 +283,9 @@ private slots:
void inputMethod();
void inputMethodSelection();
void inputMethodQueryImHints_data();
void inputMethodQueryImHints();
protected slots:
void editingFinished();
@ -3924,6 +3927,24 @@ void tst_QLineEdit::inputMethodSelection()
QCOMPARE(selectionSpy.count(), 3);
}
Q_DECLARE_METATYPE(Qt::InputMethodHints)
void tst_QLineEdit::inputMethodQueryImHints_data()
{
QTest::addColumn<Qt::InputMethodHints>("hints");
QTest::newRow("None") << static_cast<Qt::InputMethodHints>(Qt::ImhNone);
QTest::newRow("Password") << static_cast<Qt::InputMethodHints>(Qt::ImhHiddenText);
QTest::newRow("Normal") << static_cast<Qt::InputMethodHints>(Qt::ImhNoAutoUppercase | Qt::ImhNoPredictiveText | Qt::ImhSensitiveData);
}
void tst_QLineEdit::inputMethodQueryImHints()
{
QFETCH(Qt::InputMethodHints, hints);
testWidget->setInputMethodHints(hints);
QVariant value = testWidget->inputMethodQuery(Qt::ImHints);
QCOMPARE(static_cast<Qt::InputMethodHints>(value.toInt()), hints);
}
QTEST_MAIN(tst_QLineEdit)
#include "tst_qlineedit.moc"