summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@digia.com>2012-10-24 11:51:20 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2012-10-24 12:00:17 +0200
commit11be2d2449c7e76e921764e6af1d98168b3f1786 (patch)
tree3f6ce21108e15d4bcb462ecb2ec35cf9ab789d92 /examples
parent72724e3158c955eae8d57672d0258e8ba78a6631 (diff)
downloadqtlocation-11be2d2449c7e76e921764e6af1d98168b3f1786.tar.gz
Fix the QML list interface.
The QML list interface was changed, so that there is now a read only constructor and the default properties are removed. This is because the original interface was very runtime centric, like other parts in QML. The new interface was changed for the needs of the QML designer and debugger. Task-number: QTBUG-9390 Change-Id: I1ed36c275fc7f8767956e55ad9afddcb293a970c Reviewed-by: Thomas Hartmann <Thomas.Hartmann@digia.com>
Diffstat (limited to 'examples')
-rw-r--r--examples/weatherinfo/appmodel.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/examples/weatherinfo/appmodel.cpp b/examples/weatherinfo/appmodel.cpp
index fc40ed12..9d17504b 100644
--- a/examples/weatherinfo/appmodel.cpp
+++ b/examples/weatherinfo/appmodel.cpp
@@ -167,6 +167,11 @@ static int forecastCount(QQmlListProperty<WeatherData> *prop)
return d->forecast.size();
}
+static void forecastClear(QQmlListProperty<WeatherData> *prop)
+{
+ static_cast<AppModelPrivate*>(prop->data)->forecast.clear();
+}
+
//! [0]
AppModel::AppModel(QObject *parent) :
QObject(parent),
@@ -176,7 +181,8 @@ AppModel::AppModel(QObject *parent) :
d->fcProp = new QQmlListProperty<WeatherData>(this, d,
forecastAppend,
forecastCount,
- forecastAt);
+ forecastAt,
+ forecastClear);
d->geoReplyMapper = new QSignalMapper(this);
d->weatherReplyMapper = new QSignalMapper(this);