| 1 | <h2>Full example</h2> |
| 2 | <pre><code>// https://code.qt.io/cgit/qt/qtdeclarative.git/tree/examples/qml/referenceexamples/valuesource/example.qml?h=5.14 |
| 3 | |
| 4 | import People 1.0 |
| 5 | import QtQuick 2.0 // For QColor |
| 6 | |
| 7 | BirthdayParty { |
| 8 | HappyBirthdaySong on announcement { name: "Bob Jones" } |
| 9 | |
| 10 | onPartyStarted: console.log("This party started rockin' at " + time); |
| 11 | |
| 12 | |
| 13 | host: Boy { |
| 14 | name: "Bob Jones" |
| 15 | shoe { size: 12; color: "white"; brand: "Nike"; price: 90.0 } |
| 16 | } |
| 17 | |
| 18 | Boy { |
| 19 | name: "Leo Hodges" |
| 20 | BirthdayParty.rsvp: "2009-07-06" |
| 21 | shoe { size: 10; color: "black"; brand: "Reebok"; price: 59.95 } |
| 22 | } |
| 23 | Boy { |
| 24 | name: "Jack Smith" |
| 25 | shoe { size: 8; color: "blue"; brand: "Puma"; price: 19.95 } |
| 26 | } |
| 27 | Girl { |
| 28 | name: "Anne Brown" |
| 29 | BirthdayParty.rsvp: "2009-07-01" |
| 30 | shoe.size: 7 |
| 31 | shoe.color: "red" |
| 32 | shoe.brand: "Marc Jacobs" |
| 33 | shoe.price: 699.99 |
| 34 | } |
| 35 | |
| 36 | }</code></pre> |