diff options
author | Anselmo L. S. Melo <[email protected]> | 2014-03-29 18:31:57 -0300 |
---|---|---|
committer | Anselmo L. S. Melo <[email protected]> | 2014-05-09 13:04:53 +0200 |
commit | 5a530b2b9e514a83b9e5f2a66f06b37d35cac3f2 (patch) | |
tree | 7d782a5a1e5e1b1afe2cf16fa4c546c6af6eedd2 /src/models/uiproxyqmlmodel.cpp | |
parent | 67d58739f5e2fbefd45ff911da244aa4c910529d (diff) |
This project was developed before the release of Qt 5.0, so some
of the APIs had to be updated in order to build again.
Change-Id: I579d7170ea0d80bd33aee29ec807461af603b0d3
Reviewed-by: Anselmo L. S. Melo <[email protected]>
Diffstat (limited to 'src/models/uiproxyqmlmodel.cpp')
-rw-r--r-- | src/models/uiproxyqmlmodel.cpp | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/src/models/uiproxyqmlmodel.cpp b/src/models/uiproxyqmlmodel.cpp index 47f079c..37e6f55 100644 --- a/src/models/uiproxyqmlmodel.cpp +++ b/src/models/uiproxyqmlmodel.cpp @@ -42,7 +42,8 @@ #ifndef QT_NO_PROXYQMLMODEL #include "uiproxyqmlmodel.h" -#include <QtQml/private/qquicklistmodel_p.h> +#include <QtQml/qqmlprivate.h> +#include <QtQml/private/qqmllistmodel_p.h> QT_BEGIN_NAMESPACE_UIHELPERS @@ -58,7 +59,7 @@ UiProxyQmlModel::ListType UiProxyQmlModel::updateSource(const QVariant &sourceMo if (sourceModel.type() == QVariant::List) { createFromList(sourceModel.toList()); return ArrayList; - } else if (QQuickListModel *list = qvariant_cast<QQuickListModel*>(sourceModel)) { + } else if (QQmlListModel *list = qvariant_cast<QQmlListModel*>(sourceModel)) { createFromQuickList(list); return QuickList; } @@ -66,13 +67,16 @@ UiProxyQmlModel::ListType UiProxyQmlModel::updateSource(const QVariant &sourceMo return InvalidList; } -void UiProxyQmlModel::createFromList(const QVariantList &list) -{ - QHash<int, QByteArray> roleNames; - roleNames[Qt::DisplayRole] = "display"; - setRoleNames(roleNames); +QHash<int, QByteArray> UiProxyQmlModel::roleNames() +{ + QHash<int, QByteArray> roles; + roles.insert(Qt::DisplayRole, "display"); + return roles; +} +void UiProxyQmlModel::createFromList(const QVariantList &list) +{ foreach (const QVariant& var, list) { QStandardItem *item = new QStandardItem(); item->setData(var, Qt::DisplayRole); @@ -81,10 +85,8 @@ void UiProxyQmlModel::createFromList(const QVariantList &list) } } -void UiProxyQmlModel::createFromQuickList(QQuickListModel *list) +void UiProxyQmlModel::createFromQuickList(QQmlListModel *list) { - setRoleNames(list->roleNames()); - for (int i = 0; i < list->count(); i++) { QStandardItem *item = new QStandardItem(); |