summaryrefslogtreecommitdiffstats
path: root/examples/declarative/extending/signal
diff options
context:
space:
mode:
Diffstat (limited to 'examples/declarative/extending/signal')
-rw-r--r--examples/declarative/extending/signal/birthdayparty.cpp10
-rw-r--r--examples/declarative/extending/signal/birthdayparty.h18
-rw-r--r--examples/declarative/extending/signal/example.qml4
-rw-r--r--examples/declarative/extending/signal/main.cpp6
-rw-r--r--examples/declarative/extending/signal/person.h33
5 files changed, 37 insertions, 34 deletions
diff --git a/examples/declarative/extending/signal/birthdayparty.cpp b/examples/declarative/extending/signal/birthdayparty.cpp
index 65ff530..740c8c9 100644
--- a/examples/declarative/extending/signal/birthdayparty.cpp
+++ b/examples/declarative/extending/signal/birthdayparty.cpp
@@ -57,18 +57,18 @@ void BirthdayPartyAttached::setRsvp(const QDate &d)
BirthdayParty::BirthdayParty(QObject *parent)
-: QObject(parent), m_celebrant(0)
+: QObject(parent), m_host(0)
{
}
-Person *BirthdayParty::celebrant() const
+Person *BirthdayParty::host() const
{
- return m_celebrant;
+ return m_host;
}
-void BirthdayParty::setCelebrant(Person *c)
+void BirthdayParty::setHost(Person *c)
{
- m_celebrant = c;
+ m_host = c;
}
QDeclarativeListProperty<Person> BirthdayParty::guests()
diff --git a/examples/declarative/extending/signal/birthdayparty.h b/examples/declarative/extending/signal/birthdayparty.h
index a2b35cd..ae4dd39 100644
--- a/examples/declarative/extending/signal/birthdayparty.h
+++ b/examples/declarative/extending/signal/birthdayparty.h
@@ -48,8 +48,8 @@
class BirthdayPartyAttached : public QObject
{
-Q_OBJECT
-Q_PROPERTY(QDate rsvp READ rsvp WRITE setRsvp)
+ Q_OBJECT
+ Q_PROPERTY(QDate rsvp READ rsvp WRITE setRsvp)
public:
BirthdayPartyAttached(QObject *object);
@@ -62,15 +62,15 @@ private:
class BirthdayParty : public QObject
{
-Q_OBJECT
-Q_PROPERTY(Person *celebrant READ celebrant WRITE setCelebrant)
-Q_PROPERTY(QDeclarativeListProperty<Person> guests READ guests)
-Q_CLASSINFO("DefaultProperty", "guests")
+ Q_OBJECT
+ Q_PROPERTY(Person *host READ host WRITE setHost)
+ Q_PROPERTY(QDeclarativeListProperty<Person> guests READ guests)
+ Q_CLASSINFO("DefaultProperty", "guests")
public:
BirthdayParty(QObject *parent = 0);
- Person *celebrant() const;
- void setCelebrant(Person *);
+ Person *host() const;
+ void setHost(Person *);
QDeclarativeListProperty<Person> guests();
int guestCount() const;
@@ -85,7 +85,7 @@ signals:
// ![0]
private:
- Person *m_celebrant;
+ Person *m_host;
QList<Person *> m_guests;
};
QML_DECLARE_TYPEINFO(BirthdayParty, QML_HAS_ATTACHED_PROPERTIES)
diff --git a/examples/declarative/extending/signal/example.qml b/examples/declarative/extending/signal/example.qml
index c7d4792..83d6a23 100644
--- a/examples/declarative/extending/signal/example.qml
+++ b/examples/declarative/extending/signal/example.qml
@@ -5,13 +5,13 @@ BirthdayParty {
onPartyStarted: console.log("This party started rockin' at " + time);
// ![0]
- celebrant: Boy {
+ host: Boy {
name: "Bob Jones"
shoe { size: 12; color: "white"; brand: "Nike"; price: 90.0 }
}
Boy {
- name: "Joan Hodges"
+ name: "Leo Hodges"
BirthdayParty.rsvp: "2009-07-06"
shoe { size: 10; color: "black"; brand: "Reebok"; price: 59.95 }
}
diff --git a/examples/declarative/extending/signal/main.cpp b/examples/declarative/extending/signal/main.cpp
index 1b23a46..453f688 100644
--- a/examples/declarative/extending/signal/main.cpp
+++ b/examples/declarative/extending/signal/main.cpp
@@ -60,10 +60,10 @@ int main(int argc, char ** argv)
QDeclarativeComponent component(&engine, ":example.qml");
BirthdayParty *party = qobject_cast<BirthdayParty *>(component.create());
- if (party && party->celebrant()) {
- qWarning() << party->celebrant()->name() << "is having a birthday!";
+ if (party && party->host()) {
+ qWarning() << party->host()->name() << "is having a birthday!";
- if (qobject_cast<Boy *>(party->celebrant()))
+ if (qobject_cast<Boy *>(party->host()))
qWarning() << "He is inviting:";
else
qWarning() << "She is inviting:";
diff --git a/examples/declarative/extending/signal/person.h b/examples/declarative/extending/signal/person.h
index 7a4b9c3..2f444c5 100644
--- a/examples/declarative/extending/signal/person.h
+++ b/examples/declarative/extending/signal/person.h
@@ -43,14 +43,14 @@
#include <QObject>
#include <QColor>
-#include <qdeclarative.h>
-class ShoeDescription : public QObject {
-Q_OBJECT
-Q_PROPERTY(int size READ size WRITE setSize)
-Q_PROPERTY(QColor color READ color WRITE setColor)
-Q_PROPERTY(QString brand READ brand WRITE setBrand)
-Q_PROPERTY(qreal price READ price WRITE setPrice)
+class ShoeDescription : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(int size READ size WRITE setSize)
+ Q_PROPERTY(QColor color READ color WRITE setColor)
+ Q_PROPERTY(QString brand READ brand WRITE setBrand)
+ Q_PROPERTY(qreal price READ price WRITE setPrice)
public:
ShoeDescription(QObject *parent = 0);
@@ -72,10 +72,11 @@ private:
qreal m_price;
};
-class Person : public QObject {
-Q_OBJECT
-Q_PROPERTY(QString name READ name WRITE setName)
-Q_PROPERTY(ShoeDescription *shoe READ shoe)
+class Person : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(QString name READ name WRITE setName)
+ Q_PROPERTY(ShoeDescription *shoe READ shoe)
public:
Person(QObject *parent = 0);
@@ -88,14 +89,16 @@ private:
ShoeDescription m_shoe;
};
-class Boy : public Person {
-Q_OBJECT
+class Boy : public Person
+{
+ Q_OBJECT
public:
Boy(QObject * parent = 0);
};
-class Girl : public Person {
-Q_OBJECT
+class Girl : public Person
+{
+ Q_OBJECT
public:
Girl(QObject * parent = 0);
};