summaryrefslogtreecommitdiffstats
path: root/examples/declarative/objectlistmodel
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2010-05-08 03:24:44 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2010-05-08 03:24:44 (GMT)
commite7cf5fc921c00286846ac552b51a37fe2f51ff3e (patch)
treeaf7c5cade70dfd740b11434a1a5cd7f3ff53ed35 /examples/declarative/objectlistmodel
parent03f8f1df0d88f5ffe0b3120cffce614cbeefdb70 (diff)
parent3ad6f3b1f4d2252e2a004acc8156a1fd308265cf (diff)
downloadQt-e7cf5fc921c00286846ac552b51a37fe2f51ff3e.zip
Qt-e7cf5fc921c00286846ac552b51a37fe2f51ff3e.tar.gz
Qt-e7cf5fc921c00286846ac552b51a37fe2f51ff3e.tar.bz2
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/qt-qml into 4.7-integration
* '4.7' of scm.dev.nokia.troll.no:qt/qt-qml: (131 commits) Avoid many unnecessary allocations, so so that paint engines attached to pixmaps Doc Fix autotests Fix autotests (remove import Qt.widgets) Add missing qml file to qdeclarativemousearea Doc fix Clean up example code, add white background behind text Update mouse area qmlvisual test to follow change QTBUG-10162 Fix autotest bug in MouseArea Avoid emitting release when the mouse is ungrabbed Resize qmlruntime window to new dimensions when orientation changes Compile with opengl enabled. Avoid repeated create/destroy at top list boundary with sub-pixel movement. Call QDeclarativeItem::geometryChanged() base implementation qdoc fixes. Avoid warnings as delegates with bindings to parent are created and destroyed. qdoc fixes TextInput echoMode doc. Make sure to call base class implementation. More cleanup ...
Diffstat (limited to 'examples/declarative/objectlistmodel')
-rw-r--r--examples/declarative/objectlistmodel/dataobject.cpp10
-rw-r--r--examples/declarative/objectlistmodel/dataobject.h8
-rw-r--r--examples/declarative/objectlistmodel/view.qml2
3 files changed, 15 insertions, 5 deletions
diff --git a/examples/declarative/objectlistmodel/dataobject.cpp b/examples/declarative/objectlistmodel/dataobject.cpp
index 4c44ee4..14be1b9 100644
--- a/examples/declarative/objectlistmodel/dataobject.cpp
+++ b/examples/declarative/objectlistmodel/dataobject.cpp
@@ -59,7 +59,10 @@ QString DataObject::name() const
void DataObject::setName(const QString &name)
{
- m_name = name;
+ if (name != m_name) {
+ m_name = name;
+ emit nameChanged();
+ }
}
QString DataObject::color() const
@@ -69,5 +72,8 @@ QString DataObject::color() const
void DataObject::setColor(const QString &color)
{
- m_color = color;
+ if (color != m_color) {
+ m_color = color;
+ emit colorChanged();
+ }
}
diff --git a/examples/declarative/objectlistmodel/dataobject.h b/examples/declarative/objectlistmodel/dataobject.h
index 6804474..852110d 100644
--- a/examples/declarative/objectlistmodel/dataobject.h
+++ b/examples/declarative/objectlistmodel/dataobject.h
@@ -48,8 +48,8 @@ class DataObject : public QObject
{
Q_OBJECT
- Q_PROPERTY(QString name READ name WRITE setName)
- Q_PROPERTY(QString color READ color WRITE setColor)
+ Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged)
+ Q_PROPERTY(QString color READ color WRITE setColor NOTIFY colorChanged)
public:
DataObject(QObject *parent=0);
@@ -61,6 +61,10 @@ public:
QString color() const;
void setColor(const QString &color);
+signals:
+ void nameChanged();
+ void colorChanged();
+
private:
QString m_name;
QString m_color;
diff --git a/examples/declarative/objectlistmodel/view.qml b/examples/declarative/objectlistmodel/view.qml
index 908e388..2b8383f 100644
--- a/examples/declarative/objectlistmodel/view.qml
+++ b/examples/declarative/objectlistmodel/view.qml
@@ -9,7 +9,7 @@ ListView {
Rectangle {
height: 25
width: 100
- color: model.color
+ color: model.modelData.color
Text { text: name }
}
}