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>
This commit is contained in:
parent
45cb8be4f9
commit
c76a641a27
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -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();
|
||||
}
|
||||
|
@ -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 )));
|
||||
|
Loading…
Reference in New Issue
Block a user