From efd8e6922c59f6f9240b01e4e620fb464d11fc78 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Wed, 18 Nov 2015 09:58:34 +0100 Subject: QSqlQueryModel::clear(): Call begin/endResetModel(). Call begin/endResetModel() in QSqlQueryModel and all derived classes. Task-number: QTBUG-49404 Change-Id: I11492d6386efb4c945c246a6379aaa6ca4502a25 Reviewed-by: Mark Brand --- tests/auto/sql/models/qsqlquerymodel/tst_qsqlquerymodel.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'tests/auto/sql') diff --git a/tests/auto/sql/models/qsqlquerymodel/tst_qsqlquerymodel.cpp b/tests/auto/sql/models/qsqlquerymodel/tst_qsqlquerymodel.cpp index ae2f8dde5f..52baa0070b 100644 --- a/tests/auto/sql/models/qsqlquerymodel/tst_qsqlquerymodel.cpp +++ b/tests/auto/sql/models/qsqlquerymodel/tst_qsqlquerymodel.cpp @@ -593,7 +593,7 @@ public: connect(this, SIGNAL(modelReset()), this, SLOT(modelResetSlot())); } - void testme() + void testNested() { // Only the outermost beginResetModel/endResetModel should // emit signals. @@ -618,6 +618,14 @@ public: QCOMPARE(gotReset, true); } + void testClear() // QTBUG-49404: Basic test whether clear() emits signals. + { + gotAboutToBeReset = gotReset = false; + clear(); + QVERIFY(gotAboutToBeReset); + QVERIFY(gotReset); + } + private slots: void modelAboutToBeResetSlot() { gotAboutToBeReset = true; } void modelResetSlot() { gotReset = true; } @@ -634,7 +642,8 @@ void tst_QSqlQueryModel::nestedResets() CHECK_DATABASE(db); NestedResetsTest t; - t.testme(); + t.testClear(); + t.testNested(); } // For task 180617 -- cgit v1.2.3