examples/declarative/tutorials/extending/chapter2-methods/app.qml
changeset 33 3e2da88830cd
parent 30 5dc02b23752f
equal deleted inserted replaced
30:5dc02b23752f 33:3e2da88830cd
    35 ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
    35 ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
    36 ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
    36 ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
    37 ** $QT_END_LICENSE$
    37 ** $QT_END_LICENSE$
    38 **
    38 **
    39 ****************************************************************************/
    39 ****************************************************************************/
    40 
    40 //![0]
    41 import Music 1.0
    41 import Charts 1.0
    42 import Qt 4.7
    42 import Qt 4.7
    43 
    43 
    44 Rectangle {
    44 Item {
    45     width: 200; height: 200
    45     width: 300; height: 200
    46 
    46 
    47     Musician {
    47     PieChart {
    48         id: aMusician
    48         id: aPieChart
    49         name: "Reddy the Rocker"
    49         anchors.centerIn: parent
    50         instrument: "Guitar"
    50         width: 100; height: 100
       
    51         color: "red"
    51 
    52 
    52         onPerformanceEnded: console.log("The performance has now ended")
    53         onChartCleared: console.log("The chart has been cleared")
    53     }
    54     }
    54 
    55 
    55     MouseArea {
    56     MouseArea {
    56         anchors.fill: parent
    57         anchors.fill: parent
    57         onClicked: aMusician.perform()
    58         onClicked: aPieChart.clearChart()
       
    59     }
       
    60 
       
    61     Text {
       
    62         anchors { bottom: parent.bottom; horizontalCenter: parent.horizontalCenter; bottomMargin: 20 }
       
    63         text: "Click anywhere to clear the chart"
    58     }
    64     }
    59 }
    65 }
       
    66 //![0]