Accessible QML Type | QtQuick 5.3

- Qt 5.3
- Qt Quick
- QML Types
- Accessible QML Type
- Qt 5.3.2 Reference Documentation

# Accessible QML Type

Enables accessibility of QML items More...

Import Statement: | `import QtQuick 2.3`

- List of all members, including inherited members

## Properties

- checkStateMixed : bool
- checkable : bool
- checked : bool
- defaultButton : bool
- description : string
- editable : bool
- focusable : bool
- focused : bool
- multiLine : bool
- name : string
- passwordEdit : bool
- pressed : bool
- readOnly : bool
- role : enumeration
- selectable : bool
- selectableText : bool
- selected : bool

## Detailed Description

This class is part of the Accessibility for Qt Quick Applications.

Items the user interacts with or that give information to the user need to expose their information to the accessibility framework. Then assistive tools can make use of that information to enable users to interact with the application in various ways. This enables Qt Quick applications to be used with screen-readers for example.

The most important properties are name, description and role.

Example implementation of a simple button:

    Rectangle {
        id: myButton
        Text {
            id: label
            text: "next"
        }
        Accessible.role: Accessible.Button
        Accessible.name: label.text
        Accessible.description: "shows the next page"
        function accessiblePressAction() {
            // do a button click
        }
    }

The role is set to `Button` to indicate the type of control. Accessible.name is the most important information and bound to the text on the button. The name is a short and consise description of the control and should reflect the visual label. In this case it is not clear what the button does with the name only, so description contains an explanation. There is also a function `accessiblePressAction()` which can be invoked by assistive tools to trigger the button. This function needs to have the same effect as tapping or clicking the button would have.

See also Accessibility.

## Property Documentation

checkStateMixed : bool

This property holds whether this item is in the partially checked state.

By default this property is `false`.

See also checked and checkable.

checkable : bool

This property holds whether this item is checkable (like a check box or some buttons).

By default this property is `false`.

See also checked.

checked : bool

This property holds whether this item is currently checked.

By default this property is `false`.

See also checkable.

defaultButton : bool

This property holds whether this item is the default button of a dialog.

By default this property is `false`.

description : string

This property sets an accessible description. Similar to the name it describes the item. The description can be a little more verbose and tell what the item does, for example the functionallity of the button it describes.

editable : bool

This property holds whether this item has editable text.

By default this property is `false`.

focusable : bool

This property holds whether this item is focusable.

By default, this property is `false` except for items where the role is one of `CheckBox`, `RadioButton`, `Button`, `MenuItem`, `PageTab`, `EditableText`, `SpinBox`, `ComboBox`, `Terminal` or `ScrollBar`.

See also focused.

focused : bool

This property holds whether this item currently has the active focus.

By default, this property is `false`, but it will return `true` for items that have QQuickItem::hasActiveFocus() returning `true`.

See also focusable.

multiLine : bool

This property holds whether this item has multiple text lines.

By default this property is `false`.

name : string

This property sets an accessible name. For a button for example, this should have a binding to its text. In general this property should be set to a simple and concise but human readable name. Do not include the type of control you want to represent but just the name.

passwordEdit : bool

This property holds whether this item is a password text edit.

By default this property is `false`.

pressed : bool

This property holds whether this item is pressed (for example a button during a mouse click).

By default this property is `false`.

readOnly : bool

This property indicates that a text field is read only.

It is relevant when the role is QAccessible::EditableText and set to be read-only. By default this property is `false`.

role : enumeration

This flags sets the semantic type of the widget. A button for example would have "Button" as type. The value must be one of QAccessible::Role.

Some roles have special semantics. In order to implement check boxes for example a "checked" property is expected.

Role | Properties and functions | Explanation
--- | --- | ---
All interactive elements | focusable and focused | All elements that the user can interact with should have focusable set to `true` and set focus to `true` when they have the focus. This is important even for applications that run on touch-only devices since screen readers often implement a virtual focus that can be moved from item to item.
Button, CheckBox, RadioButton | `accessiblePressAction()` | A button should have a function with the name `accessiblePressAction`. This function may be called by an assistive tool such as a screen-reader. The implementation needs to behave the same as a mouse click or tap on the button.
CheckBox, RadioButton | checkable, checked | The check state of the check box. Updated on Press, Check and Uncheck actions.
Slider, SpinBox, Dial, ScrollBar | `value`, `minimumValue`, `maximumValue`, `stepSize` | These properties reflect the state and possible values for the elements.
Slider, SpinBox, Dial, ScrollBar | `accessibleIncreaseAction()`, `accessibleDecreaseAction()` | Actions to increase and decrease the value of the element.

selectable : bool

This property holds whether this item can be selected.

By default this property is `false`.

See also selected.

selectableText : bool

This property holds whether this item contains selectable text.

By default this property is `false`.

selected : bool

This property holds whether this item is selected.

By default this property is `false`.

See also selectable.