Button QML Type

Push-button that can be clicked to perform a command or answer a question. 更多...

导入语句: import QtQuick.Controls .
Since: Qt Quick Ultralite 1.0
继承:

AbstractButton

详细描述

Button presents a push-button control that can be pushed or clicked by the user. Buttons are normally used to perform an action, or to answer a question. Typical buttons are OK , Apply , Cancel , Close , Yes , No ,和 Help .

Button inherits its API from AbstractButton . For instance, you can set text and react to clicks 使用 AbstractButton API.

A button emits the signal clicked() when it is activated by the user. Connect to this signal to perform the button's action. Buttons also provide the signals canceled() , pressed() ,和 released() .

See the snippet below on how to connect to the button's signals.

Row {
    Button {
        text: "Ok"
        onClicked: model.submit()
    }
    Button {
        text: "Cancel"
        onClicked: model.revert()
    }
}
						

另请参阅 Controls Styling and 按钮控件 .