summaryrefslogtreecommitdiffstats
path: root/examples/declarative/extending/default
diff options
context:
space:
mode:
Diffstat (limited to 'examples/declarative/extending/default')
-rw-r--r--examples/declarative/extending/default/birthdayparty.cpp5
-rw-r--r--examples/declarative/extending/default/birthdayparty.h6
-rw-r--r--examples/declarative/extending/default/main.cpp13
-rw-r--r--examples/declarative/extending/default/person.cpp3
-rw-r--r--examples/declarative/extending/default/person.h2
5 files changed, 15 insertions, 14 deletions
diff --git a/examples/declarative/extending/default/birthdayparty.cpp b/examples/declarative/extending/default/birthdayparty.cpp
index 15a4ca9..523a42d 100644
--- a/examples/declarative/extending/default/birthdayparty.cpp
+++ b/examples/declarative/extending/default/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/default/birthdayparty.h b/examples/declarative/extending/default/birthdayparty.h
index f25f8c2..49c20bd 100644
--- a/examples/declarative/extending/default/birthdayparty.h
+++ b/examples/declarative/extending/default/birthdayparty.h
@@ -42,7 +42,7 @@
#define BIRTHDAYPARTY_H
#include <QObject>
-#include <qml.h>
+#include <qdeclarative.h>
#include "person.h"
// ![0]
@@ -50,7 +50,7 @@ class BirthdayParty : public QObject
{
Q_OBJECT
Q_PROPERTY(Person *celebrant READ celebrant WRITE setCelebrant)
-Q_PROPERTY(QmlListProperty<Person> guests READ guests)
+Q_PROPERTY(QDeclarativeListProperty<Person> guests READ guests)
Q_CLASSINFO("DefaultProperty", "guests")
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/default/main.cpp b/examples/declarative/extending/default/main.cpp
index ccbee83..7d7f8a1 100644
--- a/examples/declarative/extending/default/main.cpp
+++ b/examples/declarative/extending/default/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,13 @@ 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);
+ QML_REGISTER_NOCREATE_TYPE(Person);
+ 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/default/person.cpp b/examples/declarative/extending/default/person.cpp
index a0b4960..69216d3 100644
--- a/examples/declarative/extending/default/person.cpp
+++ b/examples/declarative/extending/default/person.cpp
@@ -65,18 +65,15 @@ void Person::setShoeSize(int s)
m_shoeSize = s;
}
-QML_DEFINE_NOCREATE_TYPE(Person);
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);
diff --git a/examples/declarative/extending/default/person.h b/examples/declarative/extending/default/person.h
index 884dda3..b3eceaa 100644
--- a/examples/declarative/extending/default/person.h
+++ b/examples/declarative/extending/default/person.h
@@ -42,7 +42,7 @@
#define PERSON_H
#include <QObject>
-#include <qml.h>
+#include <qdeclarative.h>
class Person : public QObject {
Q_OBJECT