diff options
author | Marc Mutz <marc.mutz@kdab.com> | 2012-07-20 11:06:00 +0200 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-07-24 10:46:24 +0200 |
commit | c76a641a27c46549c8272655be530b804be1936f (patch) | |
tree | 3a86a373f0a5e004b7dde00f1938ba43e70a6549 | |
parent | 45cb8be4f9ab2b5b823dda104376b159c9123163 (diff) |
QAbstractItemView: don't qRegisterMetaType<QModelIndex>
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 <stephen.kelly@kdab.com>
4 files changed, 0 insertions, 23 deletions
diff --git a/src/widgets/itemviews/qabstractitemview.cpp b/src/widgets/itemviews/qabstractitemview.cpp index fbe1bf944e..ebfe20c7a8 100644 --- a/src/widgets/itemviews/qabstractitemview.cpp +++ b/src/widgets/itemviews/qabstractitemview.cpp @@ -846,7 +846,6 @@ void QAbstractItemView::setItemDelegate(QAbstractItemDelegate *delegate) connect(delegate, SIGNAL(closeEditor(QWidget*,QAbstractItemDelegate::EndEditHint)), this, SLOT(closeEditor(QWidget*,QAbstractItemDelegate::EndEditHint))); connect(delegate, SIGNAL(commitData(QWidget*)), this, SLOT(commitData(QWidget*))); - qRegisterMetaType<QModelIndex>("QModelIndex"); connect(delegate, SIGNAL(sizeHintChanged(QModelIndex)), this, SLOT(doItemsLayout()), Qt::QueuedConnection); } } 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>("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>("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 <QMetaType> -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>("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>("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>("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 ))); |