summaryrefslogtreecommitdiffstats
path: root/examples/declarative/extending/coercion
diff options
context:
space:
mode:
Diffstat (limited to 'examples/declarative/extending/coercion')
-rw-r--r--examples/declarative/extending/coercion/birthdayparty.cpp5
-rw-r--r--examples/declarative/extending/coercion/birthdayparty.h6
-rw-r--r--examples/declarative/extending/coercion/main.cpp15
-rw-r--r--examples/declarative/extending/coercion/person.cpp6
-rw-r--r--examples/declarative/extending/coercion/person.h2
5 files changed, 17 insertions, 17 deletions
diff --git a/examples/declarative/extending/coercion/birthdayparty.cpp b/examples/declarative/extending/coercion/birthdayparty.cpp
index 15a4ca9..523a42d 100644
--- a/examples/declarative/extending/coercion/birthdayparty.cpp
+++ b/examples/declarative/extending/coercion/birthdayparty.cpp
@@ -55,9 +55,9 @@ void BirthdayParty::setCelebrant(Person *c)
m_celebrant = c;
}
-QmlListProperty<Person> BirthdayParty::guests()
+QDeclarativeListProperty<Person> BirthdayParty::guests()
{
- return QmlListProperty<Person>(this, m_guests);
+ return QDeclarativeListProperty<Person>(this, m_guests);
}
int BirthdayParty::guestCount() const
@@ -70,4 +70,3 @@ Person *BirthdayParty::guest(int index) const
return m_guests.at(index);
}
-QML_DEFINE_TYPE(People, 1,0, BirthdayParty, BirthdayParty);
diff --git a/examples/declarative/extending/coercion/birthdayparty.h b/examples/declarative/extending/coercion/birthdayparty.h
index 5a9eb08..fffd407 100644
--- a/examples/declarative/extending/coercion/birthdayparty.h
+++ b/examples/declarative/extending/coercion/birthdayparty.h
@@ -42,7 +42,7 @@
#define BIRTHDAYPARTY_H
#include <QObject>
-#include <qml.h>
+#include <qdeclarative.h>
#include "person.h"
class BirthdayParty : public QObject
@@ -50,7 +50,7 @@ class BirthdayParty : public QObject
Q_OBJECT
// ![0]
Q_PROPERTY(Person *celebrant READ celebrant WRITE setCelebrant)
-Q_PROPERTY(QmlListProperty<Person> guests READ guests)
+Q_PROPERTY(QDeclarativeListProperty<Person> guests READ guests)
// ![0]
public:
BirthdayParty(QObject *parent = 0);
@@ -58,7 +58,7 @@ public:
Person *celebrant() const;
void setCelebrant(Person *);
- QmlListProperty<Person> guests();
+ QDeclarativeListProperty<Person> guests();
int guestCount() const;
Person *guest(int) const;
diff --git a/examples/declarative/extending/coercion/main.cpp b/examples/declarative/extending/coercion/main.cpp
index ccbee83..1e2209f 100644
--- a/examples/declarative/extending/coercion/main.cpp
+++ b/examples/declarative/extending/coercion/main.cpp
@@ -39,8 +39,8 @@
**
****************************************************************************/
#include <QCoreApplication>
-#include <QmlEngine>
-#include <QmlComponent>
+#include <QDeclarativeEngine>
+#include <QDeclarativeComponent>
#include <QDebug>
#include "birthdayparty.h"
#include "person.h"
@@ -49,8 +49,15 @@ int main(int argc, char ** argv)
{
QCoreApplication app(argc, argv);
- QmlEngine engine;
- QmlComponent component(&engine, ":example.qml");
+ QML_REGISTER_TYPE(People, 1,0, BirthdayParty, BirthdayParty);
+// ![0]
+ QML_REGISTER_NOCREATE_TYPE(Person);
+// ![0]
+ QML_REGISTER_TYPE(People, 1,0, Boy, Boy);
+ QML_REGISTER_TYPE(People, 1,0, Girl, Girl);
+
+ QDeclarativeEngine engine;
+ QDeclarativeComponent component(&engine, ":example.qml");
BirthdayParty *party = qobject_cast<BirthdayParty *>(component.create());
if (party && party->celebrant()) {
diff --git a/examples/declarative/extending/coercion/person.cpp b/examples/declarative/extending/coercion/person.cpp
index 9eef8f7..5b5203a 100644
--- a/examples/declarative/extending/coercion/person.cpp
+++ b/examples/declarative/extending/coercion/person.cpp
@@ -65,22 +65,16 @@ void Person::setShoeSize(int s)
m_shoeSize = s;
}
-// ![0]
-QML_DEFINE_NOCREATE_TYPE(Person);
-// ![0]
-
// ![1]
Boy::Boy(QObject * parent)
: Person(parent)
{
}
-QML_DEFINE_TYPE(People, 1,0, Boy, Boy);
Girl::Girl(QObject * parent)
: Person(parent)
{
}
-QML_DEFINE_TYPE(People, 1,0, Girl, Girl);
// ![1]
diff --git a/examples/declarative/extending/coercion/person.h b/examples/declarative/extending/coercion/person.h
index 9bb9a3d..298ffb1 100644
--- a/examples/declarative/extending/coercion/person.h
+++ b/examples/declarative/extending/coercion/person.h
@@ -42,7 +42,7 @@
#define PERSON_H
#include <QObject>
-#include <qml.h>
+#include <qdeclarative.h>
class Person : public QObject {
Q_OBJECT