Remove metatype registration of built-in types.

As they are built-in, they are effectively registered at compile-time
already.

Change-Id: I7ae6ba16088eab5d19213fa7b07c2a7760988a86
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com>
This commit is contained in:
Stephen Kelly 2013-01-03 10:33:51 +01:00 committed by The Qt Project
parent 0fd0f8dfa0
commit 4319f698c8
25 changed files with 4 additions and 31 deletions

View File

@ -65,7 +65,6 @@ MandelbrotWidget::MandelbrotWidget(QWidget *parent)
pixmapScale = DefaultScale;
curScale = DefaultScale;
qRegisterMetaType<QImage>("QImage");
connect(&thread, SIGNAL(renderedImage(QImage,double)), this, SLOT(updatePixmap(QImage,double)));
setWindowTitle(tr("Mandelbrot"));

View File

@ -65,14 +65,14 @@ QVERIFY(arguments.at(2).type() == QVariant::double);
//! [2]
qRegisterMetaType<QModelIndex>("QModelIndex");
QSignalSpy spy(&model, SIGNAL(whatever(QModelIndex)));
qRegisterMetaType<SomeStruct>();
QSignalSpy spy(&model, SIGNAL(whatever(SomeStruct)));
//! [2]
//! [3]
// get the first argument from the first received signal:
QModelIndex result = qvariant_cast<QModelIndex>(spy.at(0).at(0));
SomeStruct result = qvariant_cast<SomeStruct>(spy.at(0).at(0));
//! [3]

View File

@ -54,7 +54,7 @@
\snippet code/doc_src_qsignalspy.cpp 2
To retrieve the \c QModelIndex, you can use qvariant_cast:
To retrieve the instance, you can use qvariant_cast:
\snippet code/doc_src_qsignalspy.cpp 3
*/

View File

@ -1125,7 +1125,6 @@ void tst_QPropertyAnimation::restart()
void tst_QPropertyAnimation::valueChanged()
{
qRegisterMetaType<QVariant>("QVariant");
//we check that we receive the valueChanged signal
MyErrorObject o;

View File

@ -804,7 +804,6 @@ void tst_QSettings::testIniParsing_data()
#ifdef QT_BUILD_INTERNAL
void tst_QSettings::testIniParsing()
{
qRegisterMetaType<QVariant>("QVariant");
qRegisterMetaType<QSettings::Status>("QSettings::Status");
QDir dir(settingsPath());

View File

@ -179,7 +179,6 @@ tst_QSortFilterProxyModel::tst_QSortFilterProxyModel()
void tst_QSortFilterProxyModel::initTestCase()
{
qRegisterMetaType<QModelIndex>("QModelIndex");
qRegisterMetaType<IntList>("IntList");
qRegisterMetaType<IntPair>("IntPair");
qRegisterMetaType<IntPairList>("IntPairList");

View File

@ -245,7 +245,6 @@ QByteArray verifyZeroTermination(const QByteArray &ba)
tst_QByteArray::tst_QByteArray()
{
qRegisterMetaType<qulonglong>("qulonglong");
}
void tst_QByteArray::qCompress_data()

View File

@ -130,7 +130,6 @@ void tst_QTimeLine::currentTime()
{
QTimeLine timeLine(2000);
timeLine.setUpdateInterval((timeLine.duration()/2) / 33);
qRegisterMetaType<qreal>("qreal");
QSignalSpy spy(&timeLine, SIGNAL(valueChanged(qreal)));
QVERIFY(spy.isValid());
timeLine.setFrameRange(10, 20);
@ -225,7 +224,6 @@ void tst_QTimeLine::value()
QVERIFY(timeLine.currentValue() == 0.0);
// Default speed
qRegisterMetaType<qreal>("qreal");
QSignalSpy spy(&timeLine, SIGNAL(valueChanged(qreal)));
QVERIFY(spy.isValid());
timeLine.start();

View File

@ -178,7 +178,6 @@ tst_QStandardItemModel::~tst_QStandardItemModel()
*/
void tst_QStandardItemModel::init()
{
qRegisterMetaType<QModelIndex>("QModelIndex");
qRegisterMetaType<QStandardItem*>("QStandardItem*");
qRegisterMetaType<Qt::Orientation>("Qt::Orientation");

View File

@ -674,7 +674,6 @@ void tst_QUdpSocket::writeDatagram()
client.setProperty("_q_networksession", QVariant::fromValue(networkSession));
#endif
qRegisterMetaType<qint64>("qint64");
qRegisterMetaType<QAbstractSocket::SocketError>("QAbstractSocket::SocketError");
for(int i=0;;i++) {

View File

@ -124,7 +124,6 @@ tst_QSqlQueryModel::~tst_QSqlQueryModel()
void tst_QSqlQueryModel::initTestCase()
{
qRegisterMetaType<QModelIndex>("QModelIndex");
dbs.open();
for (QStringList::ConstIterator it = dbs.dbNames.begin(); it != dbs.dbNames.end(); ++it) {
QSqlDatabase db = QSqlDatabase::database((*it));

View File

@ -152,7 +152,6 @@ private:
tst_QSqlTableModel::tst_QSqlTableModel()
{
qRegisterMetaType<QModelIndex>("QModelIndex");
dbs.open();
}

View File

@ -183,7 +183,6 @@ void tst_QSignalSpy::spyWithQtClasses()
{
QtTestObject2 obj;
qRegisterMetaType<QDateTime>("QDateTime");
QSignalSpy spy(&obj, SIGNAL(sig2(QDateTime)));
QDateTime dt = QDateTime::currentDateTime();

View File

@ -141,7 +141,6 @@ private:
tst_QFileSystemModel::tst_QFileSystemModel() : model(0)
{
qRegisterMetaType<QModelIndex>("QModelIndex");
}
void tst_QFileSystemModel::init()

View File

@ -588,7 +588,6 @@ void tst_QColumnView::clicked()
QModelIndex parent = home.parent();
QVERIFY(parent.isValid());
qRegisterMetaType<QModelIndex>("QModelIndex");
QSignalSpy clickedSpy(&view, SIGNAL(clicked(QModelIndex)));
QPoint localPoint = view.visualRect(home).center();

View File

@ -464,7 +464,6 @@ void tst_QDirModel::rowsAboutToBeRemoved()
QDirModel model;
model.setReadOnly(false);
qRegisterMetaType<QModelIndex>("QModelIndex");
// NOTE: QDirModel will call refresh() when a file is removed. refresh() will reread the entire directory,
// and emit layoutAboutToBeChanged and layoutChange. So, instead of checking for

View File

@ -642,8 +642,6 @@ void tst_QListView::clicked()
model.rCount = 10;
model.colCount = 2;
qRegisterMetaType<QModelIndex>("QModelIndex");
QListView view;
view.setModel(&model);

View File

@ -1178,7 +1178,6 @@ void tst_QListWidget::setData()
QFETCH(QVariantList, values);
QFETCH(int, expectedSignalCount);
qRegisterMetaType<QListWidgetItem *>("QListWidgetItem*");
qRegisterMetaType<QModelIndex>("QModelIndex");
QVERIFY(roles.count() == values.count());

View File

@ -176,7 +176,6 @@ tst_QTableWidget::~tst_QTableWidget()
void tst_QTableWidget::initTestCase()
{
qRegisterMetaType<QModelIndex>("QModelIndex");
testWidget = new QTableWidget();
testWidget->show();
}

View File

@ -402,7 +402,6 @@ void tst_QTreeView::initTestCase()
#ifdef Q_OS_WINCE //disable magic for WindowsCE
qApp->setAutoMaximizeThreshold(-1);
#endif
qRegisterMetaType<QModelIndex>("QModelIndex");
}
void tst_QTreeView::cleanupTestCase()

View File

@ -377,7 +377,6 @@ Q_DECLARE_METATYPE(QComboBox::InsertPolicy)
tst_QComboBox::tst_QComboBox()
{
qRegisterMetaType<QModelIndex>("QModelIndex");
parent = 0;
}

View File

@ -323,9 +323,6 @@ void tst_QDateTimeEdit::getSetCheck()
tst_QDateTimeEdit::tst_QDateTimeEdit()
{
qRegisterMetaType<QDate>("QDate");
qRegisterMetaType<QTime>("QTime");
qRegisterMetaType<QDateTime>("QDateTime");
qRegisterMetaType<QList<int> >("QList<int>");
}

View File

@ -193,7 +193,6 @@ void tst_QMainWindow::getSetCheck()
tst_QMainWindow::tst_QMainWindow()
{
qRegisterMetaType<QSize>("QSize");
qRegisterMetaType<Qt::ToolButtonStyle>("Qt::ToolButtonStyle");
}

View File

@ -249,7 +249,6 @@ void tst_QTextBrowser::viewportPositionInHistory()
void tst_QTextBrowser::relativeLinks()
{
qRegisterMetaType<QUrl>("QUrl");
QSignalSpy sourceChangedSpy(browser, SIGNAL(sourceChanged(QUrl)));
browser->setSource(QUrl("subdir/../qtextbrowser.html"));
QVERIFY(!browser->document()->isEmpty());

View File

@ -99,7 +99,6 @@ QAction *triggered = 0;
tst_QToolBar::tst_QToolBar()
{
qRegisterMetaType<QSize>("QSize");
qRegisterMetaType<Qt::Orientation>("Qt::Orientation");
qRegisterMetaType<Qt::ToolBarAreas>("Qt::ToolBarAreas");
qRegisterMetaType<Qt::ToolButtonStyle>("Qt::ToolButtonStyle");