A check box component has an image and a label and can be clicked by the user. More...
A check box is an component that can be switched on (checked) or off (unchecked). Check boxes are typically used to represent features in an application that can be enabled or disabled without affecting others, but different types of behavior can be implemented. When a check box is checked or unchecked it sends a clicked() signal for the application to handle.
In this example the user can check and uncheck a check box. In the code snippet below the check box is defined. When the user clicks the check box, the application shows the signal and the state ('checked' or 'unchecked') of the check box.
CheckBox { id: chkCheckBox text: "Check box text" anchors.left: parent.left anchors.right: parent.right onClicked: { txtLog.text = txtLog.text + "The 'clicked' signal: " if (checked) { txtLog.text = txtLog.text + "The check box is checked. <br>" } else { txtLog.text = txtLog.text + "The check box is unchecked. <br>" } } }
The screenshot below illustrates the case where the user has checked the check box.
If the button is checked, its checked property is true. The property is false by default.
If the button is pressed, its pressed property is true.
See also clicked.
The signal is emitted when the button is pressed and then released.
The signal handler, onClicked(), can bind to state changes or other actions.