From f9caf48beebb935c7c1ca71745b2646b872b65d1 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Thu, 7 Jun 2012 10:39:42 +0200 Subject: Use a QVector instead of a QSet in itemviews/models. The QSet is a more expensive container to use and create, so it should be avoided. This is source incompatible compared to earlier Qt 5 for QAbstractItemView subclasses which reimplement dataChanged, but this patch changes nothing compared to already-present SiC compared to Qt 4. Change-Id: Id95391dfd62a0a7f487a8765790b007badefb937 Reviewed-by: Lars Knoll Reviewed-by: Olivier Goffart --- .../qabstractitemmodel/tst_qabstractitemmodel.cpp | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'tests/auto') diff --git a/tests/auto/corelib/itemmodels/qabstractitemmodel/tst_qabstractitemmodel.cpp b/tests/auto/corelib/itemmodels/qabstractitemmodel/tst_qabstractitemmodel.cpp index 28babdbacb..7d052b225b 100644 --- a/tests/auto/corelib/itemmodels/qabstractitemmodel/tst_qabstractitemmodel.cpp +++ b/tests/auto/corelib/itemmodels/qabstractitemmodel/tst_qabstractitemmodel.cpp @@ -1926,20 +1926,18 @@ public: const QModelIndex bottom = index(2, 0); emit dataChanged(top, bottom); - emit dataChanged(top, bottom, QSet() << Qt::ToolTipRole); - emit dataChanged(top, bottom, QSet() << Qt::ToolTipRole << Custom1); + emit dataChanged(top, bottom, QVector() << Qt::ToolTipRole); + emit dataChanged(top, bottom, QVector() << Qt::ToolTipRole << Custom1); } }; -Q_DECLARE_METATYPE(QSet) - void tst_QAbstractItemModel::testDataChanged() { - qRegisterMetaType >(); + qRegisterMetaType >(); CustomRoleModel model; - QSignalSpy withRoles(&model, SIGNAL(dataChanged(QModelIndex,QModelIndex,QSet))); + QSignalSpy withRoles(&model, SIGNAL(dataChanged(QModelIndex,QModelIndex,QVector))); QSignalSpy withoutRoles(&model, SIGNAL(dataChanged(QModelIndex,QModelIndex))); QVERIFY(withRoles.isValid()); @@ -1953,8 +1951,8 @@ void tst_QAbstractItemModel::testDataChanged() const QVariantList secondEmission = withRoles.at(1); const QVariantList thirdEmission = withRoles.at(2); - const QSet secondRoles = secondEmission.at(2).value >(); - const QSet thirdRoles = thirdEmission.at(2).value >(); + const QVector secondRoles = secondEmission.at(2).value >(); + const QVector thirdRoles = thirdEmission.at(2).value >(); QCOMPARE(secondRoles.size(), 1); QVERIFY(secondRoles.contains(Qt::ToolTipRole)); -- cgit v1.2.3