diff options
author | Aaron McCarthy <aaron.mccarthy@nokia.com> | 2012-05-31 14:13:24 +1000 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-06-05 06:53:19 +0200 |
commit | 9feb3e6e0e3e50ca66998fd382ac80b49f18eb2b (patch) | |
tree | cea7a33cb4b64f69c246afb7a1fc6b32e9c959cd /tests/plugins | |
parent | 67fddddd184402d1f7ac29c4d6d8a990a211823b (diff) | |
download | qtlocation-9feb3e6e0e3e50ca66998fd382ac80b49f18eb2b.tar.gz |
QAbstractItemModel::setRoleNames is deprecated in favour of a virtual.
Based on https://codereview.qt-project.org/25219.
Change-Id: I31f51bb5e532e57fd29a42e2ee6520e5f28d4cb1
Reviewed-by: abcd <amos.choy@nokia.com>
Diffstat (limited to 'tests/plugins')
-rw-r--r-- | tests/plugins/declarativetestplugin/qdeclarativelocationtestmodel.cpp | 12 | ||||
-rw-r--r-- | tests/plugins/declarativetestplugin/qdeclarativelocationtestmodel_p.h | 1 |
2 files changed, 8 insertions, 5 deletions
diff --git a/tests/plugins/declarativetestplugin/qdeclarativelocationtestmodel.cpp b/tests/plugins/declarativetestplugin/qdeclarativelocationtestmodel.cpp index b88f4923..ddf20309 100644 --- a/tests/plugins/declarativetestplugin/qdeclarativelocationtestmodel.cpp +++ b/tests/plugins/declarativetestplugin/qdeclarativelocationtestmodel.cpp @@ -56,11 +56,6 @@ QDeclarativeLocationTestModel::QDeclarativeLocationTestModel(QObject *parent): qsrand(QTime(0,0,0).secsTo(QTime::currentTime()) + QCoreApplication::applicationPid()); timer_.setSingleShot(true); connect(&timer_, SIGNAL(timeout()), this, SLOT(timerFired())); - // Establish role names so that they can be queried from this model - QHash<int, QByteArray> roleNames; - roleNames = QAbstractItemModel::roleNames(); - roleNames.insert(TestDataRole, "modeldata"); - setRoleNames(roleNames); } QDeclarativeLocationTestModel::~QDeclarativeLocationTestModel() @@ -257,3 +252,10 @@ QVariant QDeclarativeLocationTestModel::data(const QModelIndex& index, int role) } return QVariant(); } + +QHash<int, QByteArray> QDeclarativeLocationTestModel::roleNames() const +{ + QHash<int, QByteArray> roles = QAbstractListModel::roleNames(); + roles.insert(TestDataRole, "modeldata"); + return roles; +} diff --git a/tests/plugins/declarativetestplugin/qdeclarativelocationtestmodel_p.h b/tests/plugins/declarativetestplugin/qdeclarativelocationtestmodel_p.h index 4ad14348..1244b3fc 100644 --- a/tests/plugins/declarativetestplugin/qdeclarativelocationtestmodel_p.h +++ b/tests/plugins/declarativetestplugin/qdeclarativelocationtestmodel_p.h @@ -87,6 +87,7 @@ public: // From QAbstractListModel virtual int rowCount(const QModelIndex &parent) const; virtual QVariant data(const QModelIndex &index, int role) const; + virtual QHash<int, QByteArray> roleNames() const; int datacount() const; void setDatacount(int datacount); |