diff options
author | Stephen Kelly <stephen.kelly@kdab.com> | 2012-06-07 10:39:42 +0200 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-06-12 04:30:07 +0200 |
commit | f9caf48beebb935c7c1ca71745b2646b872b65d1 (patch) | |
tree | cce24c1336eb0cc1ce422292623eb6f34c18f553 /tests/auto | |
parent | 3df316e9615027d9384cef81ac6cbfa2f9f81f01 (diff) |
Use a QVector<int> instead of a QSet<int> in itemviews/models.
The QSet<int> 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 <lars.knoll@nokia.com>
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
Diffstat (limited to 'tests/auto')
-rw-r--r-- | tests/auto/corelib/itemmodels/qabstractitemmodel/tst_qabstractitemmodel.cpp | 14 |
1 files changed, 6 insertions, 8 deletions
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<int>() << Qt::ToolTipRole); - emit dataChanged(top, bottom, QSet<int>() << Qt::ToolTipRole << Custom1); + emit dataChanged(top, bottom, QVector<int>() << Qt::ToolTipRole); + emit dataChanged(top, bottom, QVector<int>() << Qt::ToolTipRole << Custom1); } }; -Q_DECLARE_METATYPE(QSet<int>) - void tst_QAbstractItemModel::testDataChanged() { - qRegisterMetaType<QSet<int> >(); + qRegisterMetaType<QVector<int> >(); CustomRoleModel model; - QSignalSpy withRoles(&model, SIGNAL(dataChanged(QModelIndex,QModelIndex,QSet<int>))); + QSignalSpy withRoles(&model, SIGNAL(dataChanged(QModelIndex,QModelIndex,QVector<int>))); 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<int> secondRoles = secondEmission.at(2).value<QSet<int> >(); - const QSet<int> thirdRoles = thirdEmission.at(2).value<QSet<int> >(); + const QVector<int> secondRoles = secondEmission.at(2).value<QVector<int> >(); + const QVector<int> thirdRoles = thirdEmission.at(2).value<QVector<int> >(); QCOMPARE(secondRoles.size(), 1); QVERIFY(secondRoles.contains(Qt::ToolTipRole)); |