ssu
Loading...
Searching...
No Matches
declarativessufeaturemodel.cpp
Go to the documentation of this file.
1
7
9#include <QHash>
10#include <qqml.h>
11#include <QQmlEngine>
12#include <qqmlinfo.h>
13
14QJSValue DeclarativeSsuFeatureModel::get(int index) const
15{
16 if (index < 0 || index >= count()) {
17 qmlInfo(this) << "Index" << index << "out of bounds";
18 return QJSValue();
19 }
20 const QHash<QByteArray, QString> feature = featureAt(index);
21
22 QJSEngine *const engine = qmlEngine(this);
23 QJSValue value = engine->newObject();
24
25 QHash<QByteArray, QString>::const_iterator i = feature.constBegin();
26 while (i != feature.constEnd()) {
27 value.setProperty(QString::fromLatin1(i.key()), i.value());
28 ++i;
29 }
30
31 return value;
32}