AbstractButton QML Type

Abstract base type providing functionality common to buttons. 更多...

import 语句: import QtQuick.Controls 2.2
Since: Qt 5.7
继承: Control
继承者: Button , CheckBox , DelayButton , ItemDelegate , MenuItem , RadioButton , Switch ,和 TabButton

特性

信号

方法

详细描述

AbstractButton provides the interface for controls with button-like behavior; for example, push buttons and checkable controls like radio buttons and check boxes. As an abstract control, it has no delegate implementations, leaving them to the types that derive from it.

另请参阅 ButtonGroup and 按钮控件 .

特性文档编制

autoExclusive : bool

This property holds whether auto-exclusivity is enabled.

If auto-exclusivity is enabled, checkable buttons that belong to the same parent item behave as if they were part of the same ButtonGroup . Only one button can be checked at any time; checking another button automatically unchecks the previously checked one.

注意: The property has no effect on buttons that belong to a ButtonGroup .

RadioButton and TabButton are auto-exclusive by default.

checkable : bool

This property holds whether the button is checkable.

A checkable button toggles between checked (on) and unchecked (off) when the user clicks on it or presses the space bar while the button has active focus.

设置 checked to true forces this property to true .

默认值为 false .

另请参阅 checked .

checked : bool

This property holds whether the button is checked.

另请参阅 checkable .

down : bool

This property holds whether the button is visually down.

Unless explicitly set, this property follows the value of pressed . To return to the default value, set this property to undefined .

另请参阅 pressed .

indicator : Item

This property holds the indicator item.

[read-only] pressed : bool

This property holds whether the button is physically pressed. A button can be pressed by either touch or key events.

另请参阅 down .

text : string

This property holds a textual description of the button.

注意: The text is used for accessibility purposes, so it makes sense to set a textual description even if the content item is an image.

另请参阅 contentItem .


信号文档编制

void canceled ()

This signal is emitted when the button loses mouse grab while being pressed, or when it would emit the released signal but the mouse cursor is not inside the button.

void clicked ()

This signal is emitted when the button is interactively clicked by the user via touch, mouse, or keyboard.

void doubleClicked ()

This signal is emitted when the button is interactively double clicked by the user via touch or mouse.

void pressAndHold ()

This signal is emitted when the button is interactively pressed and held down by the user via touch or mouse.

void pressed ()

This signal is emitted when the button is interactively pressed by the user via touch, mouse, or keyboard.

void released ()

This signal is emitted when the button is interactively released by the user via touch, mouse, or keyboard.

void toggled ()

This signal is emitted when a checkable button is interactively toggled by the user via touch, mouse, or keyboard.

This QML signal was introduced in QtQuick.Controls 2.2 (Qt 5.9).


方法文档编制

void toggle ()

Toggles the checked state of the button.