summaryrefslogtreecommitdiffstats
path: root/examples/declarative/extending/binding/birthdayparty.cpp
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2010-02-05 00:47:53 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2010-02-05 00:47:53 (GMT)
commit757733f4a5698ec87072031996e6025a51ce1648 (patch)
treeb12e7a6c508a3d7e372556286097e41d4f0307ea /examples/declarative/extending/binding/birthdayparty.cpp
parent7474ad656269aec1352d166bb5a4435086d48482 (diff)
parent8aabb79ccde7502eb82aae5ce614b37c6789bc1f (diff)
downloadQt-757733f4a5698ec87072031996e6025a51ce1648.zip
Qt-757733f4a5698ec87072031996e6025a51ce1648.tar.gz
Qt-757733f4a5698ec87072031996e6025a51ce1648.tar.bz2
Merge branch 'master' of scm.dev.nokia.troll.no:qt/qt-qml into master-integration
* 'master' of scm.dev.nokia.troll.no:qt/qt-qml: (3309 commits) Add some painting benchmarks. Make sure cookies are saved. Fix headers::licenseCheck autotest failure Re-add accidentally deleted file Test SizeItemToLoader to SizeLoaderToItem resizeMode change. Document QmlContext ownership. Add bug note. Fix elision and multilength strings when resizing a Text element. Document calling C++ methods from QML. Document margins property Augment documentation doc: There is no easeNone, it is called easeLinear doc: Converted the basic types page to use \qmlbasictype Focus focusScope from focusing for focusOnPress Really run image reader in its own thread. Don't create one QNetworkAccessManager per XMLHttpRequest We use JavaScript, not ECMAScript. XMLHttpRequest redirection update Image.paintedWidth and Image.paintedHeight when the source changes Remove debug. ...
Diffstat (limited to 'examples/declarative/extending/binding/birthdayparty.cpp')
-rw-r--r--examples/declarative/extending/binding/birthdayparty.cpp106
1 files changed, 106 insertions, 0 deletions
diff --git a/examples/declarative/extending/binding/birthdayparty.cpp b/examples/declarative/extending/binding/birthdayparty.cpp
new file mode 100644
index 0000000..13d6bc8
--- /dev/null
+++ b/examples/declarative/extending/binding/birthdayparty.cpp
@@ -0,0 +1,106 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $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();
+ }
+}
+
+QML_DEFINE_NOCREATE_TYPE(BirthdayPartyAttached);
+
+BirthdayParty::BirthdayParty(QObject *parent)
+: QObject(parent), m_celebrant(0)
+{
+}
+
+Person *BirthdayParty::celebrant() const
+{
+ return m_celebrant;
+}
+
+void BirthdayParty::setCelebrant(Person *c)
+{
+ if (c == m_celebrant) return;
+ m_celebrant = c;
+ emit celebrantChanged();
+}
+
+QmlList<Person *> *BirthdayParty::guests()
+{
+ return &m_guests;
+}
+
+void BirthdayParty::startParty()
+{
+ QTime time = QTime::currentTime();
+ emit partyStarted(time);
+}
+
+QString BirthdayParty::speaker() const
+{
+ return QString();
+}
+
+void BirthdayParty::setSpeaker(const QString &speak)
+{
+ qWarning() << qPrintable(speak);
+}
+
+BirthdayPartyAttached *BirthdayParty::qmlAttachedProperties(QObject *object)
+{
+ return new BirthdayPartyAttached(object);
+}
+
+QML_DEFINE_TYPE(People, 1,0, BirthdayParty, BirthdayParty);