Button QML Type

A push button with a text label. 更多...

import 语句: import QtQuick.Controls 1.4
Since: Qt 5.1
继承: FocusScope
继承者: DelayButton , ToggleButton ,和 ToolButton

特性

信号

详细描述

The push button is perhaps the most commonly used widget in any graphical user interface. Pushing (or clicking) a button commands the computer to perform some action or answer a question. Common examples of buttons are OK, Apply, Cancel, Close, Yes, No, and Help buttons.

Button {
    text: "Button"
}
					

Button is similar to the QPushButton 小部件。

You can create a custom appearance for a Button by assigning a ButtonStyle .

特性文档编制

action : 动作

This property holds the associated button action.

If a button has an action associated, the action defines the button's properties like checked, text, tooltip etc.

When an action is set, it's still possible to override the text , tooltip , iconSource ,和 iconName 特性。

默认值为 null .

activeFocusOnPress : bool

This property specifies whether the button should gain active focus when pressed.

默认值为 false .

checkable : bool

This property holds whether the button is checkable.

默认值为 false .

checked : bool

This property holds whether the button is checked.

Only checkable buttons can be checked.

默认值为 false .

exclusiveGroup : ExclusiveGroup

此特性保持 ExclusiveGroup that the button belongs to.

默认值为 null .

[read-only] hovered : bool

This property indicates whether the control is being hovered.

iconName : string

The image label source as theme name. When an icon from the platform icon theme is found, this takes precedence over iconSource .

注意: This property requires QApplication .

iconSource : url

This property holds the icon shown on the button. If the button has no icon, the iconSource property will be an empty string.

The default value is the empty string.

isDefault : bool

This property holds whether the push button is the default button. Default buttons decide what happens when the user presses enter in a dialog without giving a button explicit focus.

注意: This property only changes the appearance of the button. The expected behavior needs to be implemented by the user.

默认值为 false .

Assign a Menu to this property to get a pull-down menu button.

默认值为 null .

[read-only] pressed : bool

This property holds whether the button is being pressed.

style : Component

The style Component for this control.

另请参阅 Qt Quick Controls Styles QML Types .

text : string

This property holds the text shown on the button. If the button has no text, the text property will be an empty string.

The default value is the empty string.

tooltip : string

This property holds the button tooltip.


信号文档编制

clicked ()

This signal is emitted when the button is clicked.