qml1.qml

import QtQuick 2.0


Rectangle {
    id: rect
    color: "red"
    width: 360
    height: 360
    Text {
        anchors.centerIn: parent
        text: "Hello QML"
        font.pointSize: 24; font.bold: true
        color:  "lightgray"
    }
    function fun() {
    if(rect.color == "blue") {
    rect.color = "red"
    }
    else {
    rect.color = "blue"
    }
    }
    MouseArea {
        anchors.fill: parent
        onClicked: {
            fun()
        }
    }
}

 

posted on 2013-02-23 11:36  小风儿_xf  阅读(214)  评论(0编辑  收藏  举报

导航