aboutsummaryrefslogtreecommitdiffstats
path: root/examples/declarative/qtquick1/cppextensions/referenceexamples/binding
diff options
context:
space:
mode:
Diffstat (limited to 'examples/declarative/qtquick1/cppextensions/referenceexamples/binding')
-rw-r--r--examples/declarative/qtquick1/cppextensions/referenceexamples/binding/binding.pro19
-rw-r--r--examples/declarative/qtquick1/cppextensions/referenceexamples/binding/binding.qrc5
-rw-r--r--examples/declarative/qtquick1/cppextensions/referenceexamples/binding/birthdayparty.cpp113
-rw-r--r--examples/declarative/qtquick1/cppextensions/referenceexamples/binding/birthdayparty.h102
-rw-r--r--examples/declarative/qtquick1/cppextensions/referenceexamples/binding/example.qml77
-rw-r--r--examples/declarative/qtquick1/cppextensions/referenceexamples/binding/happybirthdaysong.cpp85
-rw-r--r--examples/declarative/qtquick1/cppextensions/referenceexamples/binding/happybirthdaysong.h74
-rw-r--r--examples/declarative/qtquick1/cppextensions/referenceexamples/binding/main.cpp92
-rw-r--r--examples/declarative/qtquick1/cppextensions/referenceexamples/binding/person.cpp138
-rw-r--r--examples/declarative/qtquick1/cppextensions/referenceexamples/binding/person.h113
10 files changed, 0 insertions, 818 deletions
diff --git a/examples/declarative/qtquick1/cppextensions/referenceexamples/binding/binding.pro b/examples/declarative/qtquick1/cppextensions/referenceexamples/binding/binding.pro
deleted file mode 100644
index f1e38a9b5e..0000000000
--- a/examples/declarative/qtquick1/cppextensions/referenceexamples/binding/binding.pro
+++ /dev/null
@@ -1,19 +0,0 @@
-TEMPLATE = app
-TARGET = binding
-DEPENDPATH += .
-INCLUDEPATH += .
-QT += declarative
-
-# Input
-SOURCES += main.cpp \
- person.cpp \
- birthdayparty.cpp \
- happybirthdaysong.cpp
-HEADERS += person.h \
- birthdayparty.h \
- happybirthdaysong.h
-RESOURCES += binding.qrc
-target.path = $$[QT_INSTALL_EXAMPLES]/declarative/extending/binding
-sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS binding.pro
-sources.path = $$[QT_INSTALL_EXAMPLES]/declarative/extending/binding
-INSTALLS += target sources
diff --git a/examples/declarative/qtquick1/cppextensions/referenceexamples/binding/binding.qrc b/examples/declarative/qtquick1/cppextensions/referenceexamples/binding/binding.qrc
deleted file mode 100644
index e2fa01d5e7..0000000000
--- a/examples/declarative/qtquick1/cppextensions/referenceexamples/binding/binding.qrc
+++ /dev/null
@@ -1,5 +0,0 @@
-<!DOCTYPE RCC><RCC version="1.0">
-<qresource>
- <file>example.qml</file>
-</qresource>
-</RCC>
diff --git a/examples/declarative/qtquick1/cppextensions/referenceexamples/binding/birthdayparty.cpp b/examples/declarative/qtquick1/cppextensions/referenceexamples/binding/birthdayparty.cpp
deleted file mode 100644
index 682647aea6..0000000000
--- a/examples/declarative/qtquick1/cppextensions/referenceexamples/binding/birthdayparty.cpp
+++ /dev/null
@@ -1,113 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-#include "birthdayparty.h"
-
-BirthdayPartyAttached::BirthdayPartyAttached(QObject *object)
-: QObject(object)
-{
-}
-
-QDate BirthdayPartyAttached::rsvp() const
-{
- return m_rsvp;
-}
-
-void BirthdayPartyAttached::setRsvp(const QDate &d)
-{
- if (d != m_rsvp) {
- m_rsvp = d;
- emit rsvpChanged();
- }
-}
-
-
-BirthdayParty::BirthdayParty(QObject *parent)
-: QObject(parent), m_host(0)
-{
-}
-
-Person *BirthdayParty::host() const
-{
- return m_host;
-}
-
-void BirthdayParty::setHost(Person *c)
-{
- if (c == m_host) return;
- m_host = c;
- emit hostChanged();
-}
-
-QDeclarativeListProperty<Person> BirthdayParty::guests()
-{
- return QDeclarativeListProperty<Person>(this, m_guests);
-}
-
-int BirthdayParty::guestCount() const
-{
- return m_guests.count();
-}
-
-Person *BirthdayParty::guest(int index) const
-{
- return m_guests.at(index);
-}
-
-void BirthdayParty::startParty()
-{
- QTime time = QTime::currentTime();
- emit partyStarted(time);
-}
-
-QString BirthdayParty::announcement() const
-{
- return QString();
-}
-
-void BirthdayParty::setAnnouncement(const QString &speak)
-{
- qWarning() << qPrintable(speak);
-}
-
-BirthdayPartyAttached *BirthdayParty::qmlAttachedProperties(QObject *object)
-{
- return new BirthdayPartyAttached(object);
-}
-
diff --git a/examples/declarative/qtquick1/cppextensions/referenceexamples/binding/birthdayparty.h b/examples/declarative/qtquick1/cppextensions/referenceexamples/binding/birthdayparty.h
deleted file mode 100644
index 376d107f26..0000000000
--- a/examples/declarative/qtquick1/cppextensions/referenceexamples/binding/birthdayparty.h
+++ /dev/null
@@ -1,102 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-#ifndef BIRTHDAYPARTY_H
-#define BIRTHDAYPARTY_H
-
-#include <QObject>
-#include <QDate>
-#include <QDebug>
-#include <qdeclarative.h>
-#include "person.h"
-
-class BirthdayPartyAttached : public QObject
-{
- Q_OBJECT
- Q_PROPERTY(QDate rsvp READ rsvp WRITE setRsvp NOTIFY rsvpChanged)
-public:
- BirthdayPartyAttached(QObject *object);
-
- QDate rsvp() const;
- void setRsvp(const QDate &);
-
-signals:
- void rsvpChanged();
-
-private:
- QDate m_rsvp;
-};
-
-class BirthdayParty : public QObject
-{
- Q_OBJECT
-// ![0]
- Q_PROPERTY(Person *host READ host WRITE setHost NOTIFY hostChanged)
-// ![0]
- Q_PROPERTY(QDeclarativeListProperty<Person> guests READ guests)
- Q_PROPERTY(QString announcement READ announcement WRITE setAnnouncement)
- Q_CLASSINFO("DefaultProperty", "guests")
-public:
- BirthdayParty(QObject *parent = 0);
-
- Person *host() const;
- void setHost(Person *);
-
- QDeclarativeListProperty<Person> guests();
- int guestCount() const;
- Person *guest(int) const;
-
- QString announcement() const;
- void setAnnouncement(const QString &);
-
- static BirthdayPartyAttached *qmlAttachedProperties(QObject *);
-
- void startParty();
-signals:
- void partyStarted(const QTime &time);
- void hostChanged();
-
-private:
- Person *m_host;
- QList<Person *> m_guests;
-};
-
-QML_DECLARE_TYPEINFO(BirthdayParty, QML_HAS_ATTACHED_PROPERTIES)
-
-#endif // BIRTHDAYPARTY_H
diff --git a/examples/declarative/qtquick1/cppextensions/referenceexamples/binding/example.qml b/examples/declarative/qtquick1/cppextensions/referenceexamples/binding/example.qml
deleted file mode 100644
index 99a0098ff6..0000000000
--- a/examples/declarative/qtquick1/cppextensions/referenceexamples/binding/example.qml
+++ /dev/null
@@ -1,77 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import People 1.0
-
-// ![0]
-BirthdayParty {
- id: theParty
-
- HappyBirthdaySong on announcement { name: theParty.host.name }
-
- host: Boy {
- name: "Bob Jones"
- shoe { size: 12; color: "white"; brand: "Nike"; price: 90.0 }
- }
-// ![0]
- onPartyStarted: console.log("This party started rockin' at " + time);
-
-
- Boy {
- name: "Leo Hodges"
- BirthdayParty.rsvp: "2009-07-06"
- shoe { size: 10; color: "black"; brand: "Reebok"; price: 59.95 }
- }
- Boy {
- name: "Jack Smith"
- shoe { size: 8; color: "blue"; brand: "Puma"; price: 19.95 }
- }
- Girl {
- name: "Anne Brown"
- BirthdayParty.rsvp: "2009-07-01"
- shoe.size: 7
- shoe.color: "red"
- shoe.brand: "Marc Jacobs"
- shoe.price: 699.99
- }
-
-// ![1]
-}
-// ![1]
diff --git a/examples/declarative/qtquick1/cppextensions/referenceexamples/binding/happybirthdaysong.cpp b/examples/declarative/qtquick1/cppextensions/referenceexamples/binding/happybirthdaysong.cpp
deleted file mode 100644
index 5738e9a5ae..0000000000
--- a/examples/declarative/qtquick1/cppextensions/referenceexamples/binding/happybirthdaysong.cpp
+++ /dev/null
@@ -1,85 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-#include "happybirthdaysong.h"
-#include <QTimer>
-
-HappyBirthdaySong::HappyBirthdaySong(QObject *parent)
-: QObject(parent), m_line(-1)
-{
- setName(QString());
- QTimer *timer = new QTimer(this);
- QObject::connect(timer, SIGNAL(timeout()), this, SLOT(advance()));
- timer->start(1000);
-}
-
-void HappyBirthdaySong::setTarget(const QDeclarativeProperty &p)
-{
- m_target = p;
-}
-
-QString HappyBirthdaySong::name() const
-{
- return m_name;
-}
-
-void HappyBirthdaySong::setName(const QString &name)
-{
- if (m_name == name)
- return;
-
- m_name = name;
-
- m_lyrics.clear();
- m_lyrics << "Happy birthday to you,";
- m_lyrics << "Happy birthday to you,";
- m_lyrics << "Happy birthday dear " + m_name + ",";
- m_lyrics << "Happy birthday to you!";
- m_lyrics << "";
-
- emit nameChanged();
-}
-
-void HappyBirthdaySong::advance()
-{
- m_line = (m_line + 1) % m_lyrics.count();
-
- m_target.write(m_lyrics.at(m_line));
-}
-
diff --git a/examples/declarative/qtquick1/cppextensions/referenceexamples/binding/happybirthdaysong.h b/examples/declarative/qtquick1/cppextensions/referenceexamples/binding/happybirthdaysong.h
deleted file mode 100644
index a9f3a94544..0000000000
--- a/examples/declarative/qtquick1/cppextensions/referenceexamples/binding/happybirthdaysong.h
+++ /dev/null
@@ -1,74 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-#ifndef HAPPYBIRTHDAYSONG_H
-#define HAPPYBIRTHDAYSONG_H
-
-#include <QDeclarativePropertyValueSource>
-#include <QDeclarativeProperty>
-
-#include <QStringList>
-
-class HappyBirthdaySong : public QObject, public QDeclarativePropertyValueSource
-{
- Q_OBJECT
- Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged)
- Q_INTERFACES(QDeclarativePropertyValueSource)
-public:
- HappyBirthdaySong(QObject *parent = 0);
-
- virtual void setTarget(const QDeclarativeProperty &);
-
- QString name() const;
- void setName(const QString &);
-
-private slots:
- void advance();
-
-signals:
- void nameChanged();
-private:
- int m_line;
- QStringList m_lyrics;
- QDeclarativeProperty m_target;
- QString m_name;
-};
-
-#endif // HAPPYBIRTHDAYSONG_H
-
diff --git a/examples/declarative/qtquick1/cppextensions/referenceexamples/binding/main.cpp b/examples/declarative/qtquick1/cppextensions/referenceexamples/binding/main.cpp
deleted file mode 100644
index 110ea9c4df..0000000000
--- a/examples/declarative/qtquick1/cppextensions/referenceexamples/binding/main.cpp
+++ /dev/null
@@ -1,92 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-#include <QCoreApplication>
-#include <QDeclarativeEngine>
-#include <QDeclarativeComponent>
-#include <QDebug>
-#include "birthdayparty.h"
-#include "happybirthdaysong.h"
-#include "person.h"
-
-int main(int argc, char ** argv)
-{
- QCoreApplication app(argc, argv);
- qmlRegisterType<BirthdayPartyAttached>();
- qmlRegisterType<BirthdayParty>("People", 1,0, "BirthdayParty");
- qmlRegisterType<HappyBirthdaySong>("People", 1,0, "HappyBirthdaySong");
- qmlRegisterType<ShoeDescription>();
- qmlRegisterType<Person>();
- qmlRegisterType<Boy>("People", 1,0, "Boy");
- qmlRegisterType<Girl>("People", 1,0, "Girl");
-
- QDeclarativeEngine engine;
- QDeclarativeComponent component(&engine, QUrl("qrc:example.qml"));
- BirthdayParty *party = qobject_cast<BirthdayParty *>(component.create());
-
- if (party && party->host()) {
- qWarning() << party->host()->name() << "is having a birthday!";
-
- if (qobject_cast<Boy *>(party->host()))
- qWarning() << "He is inviting:";
- else
- qWarning() << "She is inviting:";
-
- for (int ii = 0; ii < party->guestCount(); ++ii) {
- Person *guest = party->guest(ii);
-
- QDate rsvpDate;
- QObject *attached =
- qmlAttachedPropertiesObject<BirthdayParty>(guest, false);
- if (attached)
- rsvpDate = attached->property("rsvp").toDate();
-
- if (rsvpDate.isNull())
- qWarning() << " " << guest->name() << "RSVP date: Hasn't RSVP'd";
- else
- qWarning() << " " << guest->name() << "RSVP date:" << qPrintable(rsvpDate.toString());
- }
-
- party->startParty();
- } else {
- qWarning() << component.errors();
- }
-
- return app.exec();
-}
diff --git a/examples/declarative/qtquick1/cppextensions/referenceexamples/binding/person.cpp b/examples/declarative/qtquick1/cppextensions/referenceexamples/binding/person.cpp
deleted file mode 100644
index 89e7127caf..0000000000
--- a/examples/declarative/qtquick1/cppextensions/referenceexamples/binding/person.cpp
+++ /dev/null
@@ -1,138 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-#include "person.h"
-
-ShoeDescription::ShoeDescription(QObject *parent)
-: QObject(parent), m_size(0), m_price(0)
-{
-}
-
-int ShoeDescription::size() const
-{
- return m_size;
-}
-
-void ShoeDescription::setSize(int s)
-{
- if (m_size == s)
- return;
-
- m_size = s;
- emit shoeChanged();
-}
-
-QColor ShoeDescription::color() const
-{
- return m_color;
-}
-
-void ShoeDescription::setColor(const QColor &c)
-{
- if (m_color == c)
- return;
-
- m_color = c;
- emit shoeChanged();
-}
-
-QString ShoeDescription::brand() const
-{
- return m_brand;
-}
-
-void ShoeDescription::setBrand(const QString &b)
-{
- if (m_brand == b)
- return;
-
- m_brand = b;
- emit shoeChanged();
-}
-
-qreal ShoeDescription::price() const
-{
- return m_price;
-}
-
-void ShoeDescription::setPrice(qreal p)
-{
- if (m_price == p)
- return;
-
- m_price = p;
- emit shoeChanged();
-}
-
-Person::Person(QObject *parent)
-: QObject(parent)
-{
-}
-
-QString Person::name() const
-{
- return m_name;
-}
-
-void Person::setName(const QString &n)
-{
- if (m_name == n)
- return;
-
- m_name = n;
- emit nameChanged();
-}
-
-ShoeDescription *Person::shoe()
-{
- return &m_shoe;
-}
-
-
-Boy::Boy(QObject * parent)
-: Person(parent)
-{
-}
-
-
-Girl::Girl(QObject * parent)
-: Person(parent)
-{
-}
-
diff --git a/examples/declarative/qtquick1/cppextensions/referenceexamples/binding/person.h b/examples/declarative/qtquick1/cppextensions/referenceexamples/binding/person.h
deleted file mode 100644
index d0f196b95c..0000000000
--- a/examples/declarative/qtquick1/cppextensions/referenceexamples/binding/person.h
+++ /dev/null
@@ -1,113 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-#ifndef PERSON_H
-#define PERSON_H
-
-#include <QObject>
-#include <QColor>
-
-class ShoeDescription : public QObject
-{
- Q_OBJECT
- Q_PROPERTY(int size READ size WRITE setSize NOTIFY shoeChanged)
- Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY shoeChanged)
- Q_PROPERTY(QString brand READ brand WRITE setBrand NOTIFY shoeChanged)
- Q_PROPERTY(qreal price READ price WRITE setPrice NOTIFY shoeChanged)
-public:
- ShoeDescription(QObject *parent = 0);
-
- int size() const;
- void setSize(int);
-
- QColor color() const;
- void setColor(const QColor &);
-
- QString brand() const;
- void setBrand(const QString &);
-
- qreal price() const;
- void setPrice(qreal);
-signals:
- void shoeChanged();
-
-private:
- int m_size;
- QColor m_color;
- QString m_brand;
- qreal m_price;
-};
-
-class Person : public QObject
-{
- Q_OBJECT
- Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged)
-// ![0]
- Q_PROPERTY(ShoeDescription *shoe READ shoe CONSTANT)
-// ![0]
-public:
- Person(QObject *parent = 0);
-
- QString name() const;
- void setName(const QString &);
-
- ShoeDescription *shoe();
-signals:
- void nameChanged();
-
-private:
- QString m_name;
- ShoeDescription m_shoe;
-};
-
-class Boy : public Person
-{
- Q_OBJECT
-public:
- Boy(QObject * parent = 0);
-};
-
-class Girl : public Person
-{
- Q_OBJECT
-public:
- Girl(QObject * parent = 0);
-};
-
-#endif // PERSON_H