-3

//MainPage.qml

   Button{
        id: pushI
        text: qsTr("录音")
        //onClicked: label.visible = true
        MouseArea
        {
            anchors.fill: parent
            MyItem { id: inputA}
            onPressed:
            {
                inputA.on_pressed()//my c++ class method
            }
            onReleased:
            {
                inputA.on_released()//my c++ class method
            }

        }
    }

$onClicked$ 属性可以,但是我有新闻发布流程,怎么办?

4

1 回答 1

0

我很懒

    Button{
        id: button
        state: "RELEASED"
        text: qsTr("录音")
        MouseArea
        {
            anchors.fill: parent
            MyItem { id: inputA}
            onPressed:
            {
                inputA.on_pressed()
                button.state = "PRESSED"
            }
            onReleased:
            {
                inputA.on_released()
                button.state = "RELEASED"
            }
        }
        states: [
        State {
        name: "PRESSED"
        PropertyChanges { target: button; checked: true}
        },
        State {
        name: "RELEASED"
        PropertyChanges { target: button; checked: false}
        }
        ]
    }
于 2013-02-06T03:26:47.693 回答