From c76a641a27c46549c8272655be530b804be1936f Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Fri, 20 Jul 2012 11:06:00 +0200 Subject: QAbstractItemView: don't qRegisterMetaType QModelIndex is a build-in type nowadays and doesn't need to be registered anymore. Also remove them from the tests. Change-Id: I47029972651c045c880cee86fb292116a29493d5 Reviewed-by: Stephen Kelly --- .../qabstractitemmodel/tst_qabstractitemmodel.cpp | 13 ------------- .../qidentityproxymodel/tst_qidentityproxymodel.cpp | 4 ---- tests/auto/corelib/itemmodels/qitemmodel/tst_qitemmodel.cpp | 5 ----- 3 files changed, 22 deletions(-) (limited to 'tests/auto/corelib/itemmodels') diff --git a/tests/auto/corelib/itemmodels/qabstractitemmodel/tst_qabstractitemmodel.cpp b/tests/auto/corelib/itemmodels/qabstractitemmodel/tst_qabstractitemmodel.cpp index 999335a8ef..d3e11d8f8b 100644 --- a/tests/auto/corelib/itemmodels/qabstractitemmodel/tst_qabstractitemmodel.cpp +++ b/tests/auto/corelib/itemmodels/qabstractitemmodel/tst_qabstractitemmodel.cpp @@ -47,8 +47,6 @@ #include "dynamictreemodel.h" -Q_DECLARE_METATYPE(QModelIndex) - /*! Note that this doesn't test models, but any functionality that QAbstractItemModel should provide */ @@ -57,7 +55,6 @@ class tst_QAbstractItemModel : public QObject Q_OBJECT public slots: - void initTestCase(); void init(); void cleanup(); @@ -340,16 +337,6 @@ bool QtTestModel::canDropMimeData(const QMimeData *data, Qt::DropAction action, return row % 2 == 0; } -/** - * The source Model *must* be initialized before the _data function, since the _data function uses QModelIndexes to reference the items in the tables. - * Therefore, we must initialize it globally. - */ - -void tst_QAbstractItemModel::initTestCase() -{ - qRegisterMetaType("QModelIndex"); -} - void tst_QAbstractItemModel::init() { m_model = new DynamicTreeModel(this); diff --git a/tests/auto/corelib/itemmodels/qidentityproxymodel/tst_qidentityproxymodel.cpp b/tests/auto/corelib/itemmodels/qidentityproxymodel/tst_qidentityproxymodel.cpp index 01024649aa..49770146ee 100644 --- a/tests/auto/corelib/itemmodels/qidentityproxymodel/tst_qidentityproxymodel.cpp +++ b/tests/auto/corelib/itemmodels/qidentityproxymodel/tst_qidentityproxymodel.cpp @@ -46,8 +46,6 @@ #include "dynamictreemodel.h" #include "qidentityproxymodel.h" -Q_DECLARE_METATYPE(QModelIndex) - class tst_QIdentityProxyModel : public QObject { Q_OBJECT @@ -81,8 +79,6 @@ tst_QIdentityProxyModel::tst_QIdentityProxyModel() void tst_QIdentityProxyModel::initTestCase() { - qRegisterMetaType("QModelIndex"); - m_model = new QStandardItemModel(0, 1); m_proxy = new QIdentityProxyModel(); } diff --git a/tests/auto/corelib/itemmodels/qitemmodel/tst_qitemmodel.cpp b/tests/auto/corelib/itemmodels/qitemmodel/tst_qitemmodel.cpp index 6a15133b27..b8174f8cbf 100644 --- a/tests/auto/corelib/itemmodels/qitemmodel/tst_qitemmodel.cpp +++ b/tests/auto/corelib/itemmodels/qitemmodel/tst_qitemmodel.cpp @@ -45,8 +45,6 @@ #include "modelstotest.cpp" #include -Q_DECLARE_METATYPE(QModelIndex) - /*! See modelstotest.cpp for instructions on how to have your model tested with these tests. @@ -599,7 +597,6 @@ void tst_QItemModel::setData() QFETCH(QString, modelType); currentModel = testModels->createModel(modelType); QVERIFY(currentModel); - qRegisterMetaType("QModelIndex"); QSignalSpy spy(currentModel, SIGNAL(dataChanged(const QModelIndex &, const QModelIndex &))); QVERIFY(spy.isValid()); QCOMPARE(currentModel->setData(QModelIndex(), QVariant()), false); @@ -841,7 +838,6 @@ void tst_QItemModel::remove() // When a row or column is removed there should be two signals. // Watch to make sure they are emitted and get the row/column count when they do get emitted by connecting them to a slot - qRegisterMetaType("QModelIndex"); QSignalSpy columnsAboutToBeRemovedSpy(currentModel, SIGNAL(columnsAboutToBeRemoved( const QModelIndex &, int , int ))); QSignalSpy rowsAboutToBeRemovedSpy(currentModel, SIGNAL(rowsAboutToBeRemoved( const QModelIndex &, int , int ))); QSignalSpy columnsRemovedSpy(currentModel, SIGNAL(columnsRemoved( const QModelIndex &, int, int ))); @@ -1184,7 +1180,6 @@ void tst_QItemModel::insert() // When a row or column is inserted there should be two signals. // Watch to make sure they are emitted and get the row/column count when they do get emitted by connecting them to a slot - qRegisterMetaType("QModelIndex"); QSignalSpy columnsAboutToBeInsertedSpy(currentModel, SIGNAL(columnsAboutToBeInserted( const QModelIndex &, int , int ))); QSignalSpy rowsAboutToBeInsertedSpy(currentModel, SIGNAL(rowsAboutToBeInserted( const QModelIndex &, int , int ))); QSignalSpy columnsInsertedSpy(currentModel, SIGNAL(columnsInserted( const QModelIndex &, int, int ))); -- cgit v1.2.3