From 2d4e6ff9dd1e0e3410c4dc002c25d80fecfeafd2 Mon Sep 17 00:00:00 2001 From: Jerome Pasion Date: Thu, 9 Feb 2012 17:31:02 +0100 Subject: Doc: Overhaul of doc/src/declarative and QtQuick2 docs. -Consolidated model/view documentation into one. -Added a new navigation for all overviews (grouped the pages) -New front page that shows the grouping -Separated the Qt C++ from the main QML overviews -Consolidated Qt C++ into the "declarative runtime" section -New articles about JavaScript, the engine, and plugins -Fixed the older examples. New snippet comments -Renamed some of the articles -kept the qtquick2 qmlmodule -"Qt Quick Elements" Moved contents of doc/src/declarative into respective module dirs. -Qt Quick 2, LocalStorage, Particles, and QML are now separate. -Removed unused or duplicate documentation. -edited C++ examples -removed navigation and "\inqmlmodule QtQuick 2" for those pages that are not in Qt Quick 2 -fixed doc/src/ licenses to header.FDL from qtbase Change-Id: Ib36f9c07565d91160fa8d04f9670c438f684b82a Reviewed-by: Sergio Ahumada --- .../referenceexamples/adding/person.h | 4 +-- .../referenceexamples/attached/birthdayparty.h | 5 +++- .../referenceexamples/attached/example.qml | 31 ++++++++++------------ .../referenceexamples/attached/main.cpp | 7 ++--- .../referenceexamples/coercion/main.cpp | 7 +++-- .../referenceexamples/coercion/person.h | 3 ++- .../referenceexamples/grouped/example.qml | 30 ++++++++++++--------- .../referenceexamples/methods/example.qml | 4 +-- .../referenceexamples/properties/main.cpp | 2 ++ .../referenceexamples/signal/example.qml | 16 +++++------ 10 files changed, 60 insertions(+), 49 deletions(-) (limited to 'examples/declarative/cppextensions') diff --git a/examples/declarative/cppextensions/referenceexamples/adding/person.h b/examples/declarative/cppextensions/referenceexamples/adding/person.h index 896bf4bd52..45fb2f3297 100644 --- a/examples/declarative/cppextensions/referenceexamples/adding/person.h +++ b/examples/declarative/cppextensions/referenceexamples/adding/person.h @@ -41,7 +41,7 @@ #define PERSON_H #include -// ![0] +//![0] class Person : public QObject { Q_OBJECT @@ -60,6 +60,6 @@ private: QString m_name; int m_shoeSize; }; -// ![0] +//![0] #endif // PERSON_H diff --git a/examples/declarative/cppextensions/referenceexamples/attached/birthdayparty.h b/examples/declarative/cppextensions/referenceexamples/attached/birthdayparty.h index 02e9593b8b..c789c0bd51 100644 --- a/examples/declarative/cppextensions/referenceexamples/attached/birthdayparty.h +++ b/examples/declarative/cppextensions/referenceexamples/attached/birthdayparty.h @@ -75,12 +75,15 @@ public: int guestCount() const; Person *guest(int) const; + //! [static attached] static BirthdayPartyAttached *qmlAttachedProperties(QObject *); + //! [static attached] private: Person *m_host; QList m_guests; }; +//! [declare attached] QML_DECLARE_TYPEINFO(BirthdayParty, QML_HAS_ATTACHED_PROPERTIES) - +//! [declare attached] #endif // BIRTHDAYPARTY_H diff --git a/examples/declarative/cppextensions/referenceexamples/attached/example.qml b/examples/declarative/cppextensions/referenceexamples/attached/example.qml index c21813ebf9..6a83af2804 100644 --- a/examples/declarative/cppextensions/referenceexamples/attached/example.qml +++ b/examples/declarative/cppextensions/referenceexamples/attached/example.qml @@ -40,32 +40,29 @@ import People 1.0 +//! [begin] BirthdayParty { - host: Boy { - name: "Bob Jones" - shoe { size: 12; color: "white"; brand: "Nike"; price: 90.0 } - } +//! [begin] +//! [rsvp] + Boy { + name: "Robert Campbell" + BirthdayParty.rsvp: "2009-07-01" + } +//! [rsvp] // ![1] - Boy { - name: "Leo Hodges" + Boy { + name: "Leo Hodges" shoe { size: 10; color: "black"; brand: "Reebok"; price: 59.95 } BirthdayParty.rsvp: "2009-07-06" } // ![1] - Boy { - name: "Jack Smith" + Boy { + name: "Jack Smith" shoe { size: 8; color: "blue"; brand: "Puma"; price: 19.95 } } - Girl { - name: "Anne Brown" - shoe.size: 7 - shoe.color: "red" - shoe.brand: "Marc Jacobs" - shoe.price: 699.99 - - BirthdayParty.rsvp: "2009-07-01" - } +//! [end] } +//! [end] diff --git a/examples/declarative/cppextensions/referenceexamples/attached/main.cpp b/examples/declarative/cppextensions/referenceexamples/attached/main.cpp index 21f076c3b7..4c2c3003fe 100644 --- a/examples/declarative/cppextensions/referenceexamples/attached/main.cpp +++ b/examples/declarative/cppextensions/referenceexamples/attached/main.cpp @@ -70,12 +70,13 @@ int main(int argc, char ** argv) for (int ii = 0; ii < party->guestCount(); ++ii) { Person *guest = party->guest(ii); + //! [query rsvp] QDate rsvpDate; - QObject *attached = - qmlAttachedPropertiesObject(guest, false); + QObject *attached = qmlAttachedPropertiesObject(guest, false); + if (attached) rsvpDate = attached->property("rsvp").toDate(); - + //! [query rsvp] if (rsvpDate.isNull()) qWarning() << " " << guest->name() << "RSVP date: Hasn't RSVP'd"; else diff --git a/examples/declarative/cppextensions/referenceexamples/coercion/main.cpp b/examples/declarative/cppextensions/referenceexamples/coercion/main.cpp index e0eabae4b4..95b309de4c 100644 --- a/examples/declarative/cppextensions/referenceexamples/coercion/main.cpp +++ b/examples/declarative/cppextensions/referenceexamples/coercion/main.cpp @@ -49,11 +49,14 @@ int main(int argc, char ** argv) QCoreApplication app(argc, argv); qmlRegisterType("People", 1,0, "BirthdayParty"); -// ![0] + //![0] qmlRegisterType(); -// ![0] + //![0] + + //![register boy girl] qmlRegisterType("People", 1,0, "Boy"); qmlRegisterType("People", 1,0, "Girl"); + //![register boy girl] QDeclarativeEngine engine; QDeclarativeComponent component(&engine, QUrl("qrc:example.qml")); diff --git a/examples/declarative/cppextensions/referenceexamples/coercion/person.h b/examples/declarative/cppextensions/referenceexamples/coercion/person.h index 65faaf1521..dc4ae43dd6 100644 --- a/examples/declarative/cppextensions/referenceexamples/coercion/person.h +++ b/examples/declarative/cppextensions/referenceexamples/coercion/person.h @@ -69,13 +69,14 @@ public: Boy(QObject * parent = 0); }; - +//! [girl class] class Girl : public Person { Q_OBJECT public: Girl(QObject * parent = 0); }; +//! [girl class] // ![0] diff --git a/examples/declarative/cppextensions/referenceexamples/grouped/example.qml b/examples/declarative/cppextensions/referenceexamples/grouped/example.qml index 21e368abc4..9ae80f222e 100644 --- a/examples/declarative/cppextensions/referenceexamples/grouped/example.qml +++ b/examples/declarative/cppextensions/referenceexamples/grouped/example.qml @@ -44,30 +44,34 @@ import People 1.0 BirthdayParty { host: Boy { name: "Bob Jones" - shoe { size: 12; color: "white"; brand: "Nike"; price: 90.0 } + shoe { size: 12; color: "white"; brand: "Bikey"; price: 90.0 } } - Boy { - name: "Leo Hodges" - shoe { size: 10; color: "black"; brand: "Reebok"; price: 59.95 } + Boy { + name: "Leo Hodges" +//![grouped] + shoe { size: 10; color: "black"; brand: "Thebok"; price: 59.95 } +//![grouped] } // ![1] - Boy { - name: "Jack Smith" - shoe { + Boy { + name: "Jack Smith" + shoe { size: 8 color: "blue" - brand: "Puma" - price: 19.95 + brand: "Luma" + price: 19.95 } } // ![1] - Girl { - name: "Anne Brown" + Girl { + name: "Anne Brown" +//![ungrouped] shoe.size: 7 shoe.color: "red" - shoe.brand: "Marc Jacobs" - shoe.price: 699.99 + shoe.brand: "Job Macobs" + shoe.price: 699.99 +//![ungrouped] } } // ![0] diff --git a/examples/declarative/cppextensions/referenceexamples/methods/example.qml b/examples/declarative/cppextensions/referenceexamples/methods/example.qml index adc8cf7590..9119835e04 100644 --- a/examples/declarative/cppextensions/referenceexamples/methods/example.qml +++ b/examples/declarative/cppextensions/referenceexamples/methods/example.qml @@ -41,7 +41,6 @@ import QtQuick 2.0 import People 1.0 -// ![0] BirthdayParty { host: Person { name: "Bob Jones" @@ -53,6 +52,7 @@ BirthdayParty { Person { name: "Anne Brown" } ] +// ![0] Component.onCompleted: invite("William Green") -} // ![0] +} diff --git a/examples/declarative/cppextensions/referenceexamples/properties/main.cpp b/examples/declarative/cppextensions/referenceexamples/properties/main.cpp index d037d88f20..421ce9fbaa 100644 --- a/examples/declarative/cppextensions/referenceexamples/properties/main.cpp +++ b/examples/declarative/cppextensions/referenceexamples/properties/main.cpp @@ -48,8 +48,10 @@ int main(int argc, char ** argv) { QCoreApplication app(argc, argv); +//![register list] qmlRegisterType("People", 1,0, "BirthdayParty"); qmlRegisterType("People", 1,0, "Person"); +//![register list] QDeclarativeEngine engine; QDeclarativeComponent component(&engine, QUrl("qrc:example.qml")); diff --git a/examples/declarative/cppextensions/referenceexamples/signal/example.qml b/examples/declarative/cppextensions/referenceexamples/signal/example.qml index ba792a8617..796c2f32a1 100644 --- a/examples/declarative/cppextensions/referenceexamples/signal/example.qml +++ b/examples/declarative/cppextensions/referenceexamples/signal/example.qml @@ -40,8 +40,8 @@ import People 1.0 -// ![0] BirthdayParty { +// ![0] onPartyStarted: console.log("This party started rockin' at " + time); // ![0] @@ -50,22 +50,22 @@ BirthdayParty { shoe { size: 12; color: "white"; brand: "Nike"; price: 90.0 } } - Boy { - name: "Leo Hodges" + Boy { + name: "Leo Hodges" BirthdayParty.rsvp: "2009-07-06" shoe { size: 10; color: "black"; brand: "Reebok"; price: 59.95 } } - Boy { - name: "Jack Smith" + Boy { + name: "Jack Smith" shoe { size: 8; color: "blue"; brand: "Puma"; price: 19.95 } } - Girl { - name: "Anne Brown" + Girl { + name: "Anne Brown" BirthdayParty.rsvp: "2009-07-01" shoe.size: 7 shoe.color: "red" shoe.brand: "Marc Jacobs" - shoe.price: 699.99 + shoe.price: 699.99 } // ![1] } -- cgit v1.2.3