Description
This is a button with a customizable text, font and text color. The button has three states (default, pressed and active) and each state has its own image.
API properties
- string text
- Sets the text displayed on the button.
- alias font
- Pointing to the button's font.
- string textColor
- Sets the color of the button's text.
- bool hasBackground
- If set to false, the button graphics will be invisible, only the text will be displayed.
- string bgSourceUp
- Path to an image file used while the button is in released state and active is false.
- string bgSourceDn
- Path to an image file used while the button is in pressed state.
- string bgSourceActive
- Path to an image file used while the button is in released state and active is true.
- bool elideText
- Activates text eliding on true. If this property is true, the width property must be explicitly set.
- bool active
- If active is set to true, the button will use bgSourceActive instead of bgSourceUp for its visual representation while in released state. For example the button could have a red background image after it was clicked to simulate the behavior of a switch. This property must be set externally, the button itself never changes the value.
- bool enabled
- If enabled is set to false, the button can't be clicked and it's opacity is set to 0.5 to give a visual feedback about this state.
- bool pressed
- True if the button is currently pressed. Intended as read-only.
Signals
- clicked
- Emitted if the button is enabled and clicked.
- Parameters:
- MouseEvent mouse, contains mouse event data.
Functions
-
Example
Button {
id: myButton
text: "Click me"
}