diff options
author | Friedemann Kleint <Friedemann.Kleint@theqtcompany.com> | 2015-09-22 09:15:33 +0200 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@theqtcompany.com> | 2015-09-22 14:26:26 +0000 |
commit | d417f81f28039b9165780f937c08ac9b2b92127d (patch) | |
tree | 1b986b4a758af76487669f00e299c89ddad8008c /tests | |
parent | 7edd10e6cc215c419c2cb492ffca997faa520c4c (diff) |
QAbstractSpinBox::inputMethodQuery(): Consider input method hints set on the spin box.
The derived classes (QSpinBox, QDoubleSpinBox, QDateTimeEdit, QTimeEdit)
set various input method hints on the spin box in the init() methods
of their private classes which did not have any effect since
QAbstractSpinBox::inputMethodQuery() was implemented to return the
hints of the embedded QLineEdit only. Change it so that hints set
on the QAbstractSpinBox are also considered.
Change-Id: I76b7c4d3e0869589c110cf3a0b2c3f94201db5d5
Reviewed-by: Andy Shaw <andy.shaw@theqtcompany.com>
Reviewed-by: Liang Qi <liang.qi@theqtcompany.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/widgets/widgets/qdatetimeedit/tst_qdatetimeedit.cpp | 6 | ||||
-rw-r--r-- | tests/auto/widgets/widgets/qspinbox/tst_qspinbox.cpp | 2 |
2 files changed, 8 insertions, 0 deletions
diff --git a/tests/auto/widgets/widgets/qdatetimeedit/tst_qdatetimeedit.cpp b/tests/auto/widgets/widgets/qdatetimeedit/tst_qdatetimeedit.cpp index e8a0916dc5..d41398046f 100644 --- a/tests/auto/widgets/widgets/qdatetimeedit/tst_qdatetimeedit.cpp +++ b/tests/auto/widgets/widgets/qdatetimeedit/tst_qdatetimeedit.cpp @@ -285,6 +285,7 @@ typedef QList<Qt::Key> KeyList; void tst_QDateTimeEdit::getSetCheck() { QDateTimeEdit obj1; + QCOMPARE(obj1.inputMethodQuery(Qt::ImHints), QVariant(int(Qt::ImhPreferNumbers))); obj1.setDisplayFormat("dd/MM/yyyy hh:mm:ss.zzz d/M/yy h:m:s.z AP"); // Section QDateTimeEdit::currentSection() // void QDateTimeEdit::setCurrentSection(Section) @@ -306,6 +307,11 @@ void tst_QDateTimeEdit::getSetCheck() QCOMPARE(QDateTimeEdit::MonthSection, obj1.currentSection()); obj1.setCurrentSection(QDateTimeEdit::YearSection); QCOMPARE(QDateTimeEdit::YearSection, obj1.currentSection()); + + QDateEdit dateEdit; + QCOMPARE(dateEdit.inputMethodQuery(Qt::ImHints), QVariant(int(Qt::ImhPreferNumbers))); + QTimeEdit timeEdit; + QCOMPARE(timeEdit.inputMethodQuery(Qt::ImHints), QVariant(int(Qt::ImhPreferNumbers))); } tst_QDateTimeEdit::tst_QDateTimeEdit() diff --git a/tests/auto/widgets/widgets/qspinbox/tst_qspinbox.cpp b/tests/auto/widgets/widgets/qspinbox/tst_qspinbox.cpp index 05dd834c76..34b05c5291 100644 --- a/tests/auto/widgets/widgets/qspinbox/tst_qspinbox.cpp +++ b/tests/auto/widgets/widgets/qspinbox/tst_qspinbox.cpp @@ -165,6 +165,7 @@ Q_DECLARE_METATYPE(QLocale::Country) void tst_QSpinBox::getSetCheck() { QSpinBox obj1; + QCOMPARE(obj1.inputMethodQuery(Qt::ImHints), QVariant(int(Qt::ImhDigitsOnly))); // int QSpinBox::singleStep() // void QSpinBox::setSingleStep(int) obj1.setSingleStep(0); @@ -202,6 +203,7 @@ void tst_QSpinBox::getSetCheck() QCOMPARE(INT_MAX, obj1.value()); QDoubleSpinBox obj2; + QCOMPARE(obj2.inputMethodQuery(Qt::ImHints), QVariant(int(Qt::ImhFormattedNumbersOnly))); // double QDoubleSpinBox::singleStep() // void QDoubleSpinBox::setSingleStep(double) obj2.setSingleStep(0.0); |