From c3e1abad4e141e6e9d876e5cff194c473a2654eb Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Wed, 21 Mar 2012 20:41:57 +0100 Subject: Add USER properties to QDateEdit and QTimeEdit. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Both classes had such components before, but there were issues with the NOTIFY signal not being in the same class as the Q_PROPERTY. This patch solves that problem by using a signal of a different name. Task-number: QTBUG-15731 Change-Id: Ibc7ce4dba8a6b88c05d62a90e14d0101c5cd3082 Reviewed-by: Olivier Goffart Reviewed-by: Thorbjørn Lund Martsum --- .../auto/widgets/itemviews/qitemdelegate/tst_qitemdelegate.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'tests/auto/widgets/itemviews/qitemdelegate/tst_qitemdelegate.cpp') diff --git a/tests/auto/widgets/itemviews/qitemdelegate/tst_qitemdelegate.cpp b/tests/auto/widgets/itemviews/qitemdelegate/tst_qitemdelegate.cpp index 2b52f5f234..497cdfdeee 100644 --- a/tests/auto/widgets/itemviews/qitemdelegate/tst_qitemdelegate.cpp +++ b/tests/auto/widgets/itemviews/qitemdelegate/tst_qitemdelegate.cpp @@ -780,6 +780,9 @@ void tst_QItemDelegate::dateTimeEditor() QTimeEdit *timeEditor = qFindChild(widget.viewport()); QVERIFY(timeEditor); QCOMPARE(timeEditor->time(), time); + // The data must actually be different in order for the model + // to be updated. + timeEditor->setTime(time.addSecs(60)); widget.clearFocus(); qApp->setActiveWindow(&widget); @@ -791,6 +794,7 @@ void tst_QItemDelegate::dateTimeEditor() QDateEdit *dateEditor = qFindChild(widget.viewport()); QVERIFY(dateEditor); QCOMPARE(dateEditor->date(), date); + dateEditor->setDate(date.addDays(60)); widget.clearFocus(); widget.setFocus(); @@ -806,6 +810,12 @@ void tst_QItemDelegate::dateTimeEditor() QVERIFY(dateTimeEditor); QCOMPARE(dateTimeEditor->date(), date); QCOMPARE(dateTimeEditor->time(), time); + dateTimeEditor->setTime(time.addSecs(600)); + widget.clearFocus(); + + QVERIFY(item1->data(Qt::EditRole).userType() == QMetaType::QTime); + QVERIFY(item2->data(Qt::EditRole).userType() == QMetaType::QDate); + QVERIFY(item3->data(Qt::EditRole).userType() == QMetaType::QDateTime); } void tst_QItemDelegate::decoration_data() -- cgit v1.2.3