AbstractA11yObject

Since: BlackBerry 10.2.0

#include <bb/cascades/AbstractA11yObject>

Defines a control's accessibility properties.

A control's accessibility properties can be used by assistive technologies for users with special needs.


Overview

QML properties

description: QString
labelledBy: QDeclarativeListProperty< bb::cascades::UIObject > [read-only]
name: QString
role: bb::cascades::A11yRole::Type [read-only]
attachedObjects: QDeclarativeListProperty< QObject > [read-only]Inherited
objectName: QStringInherited
parent: QObject [read-only]Inherited
ui: bb::cascades::UIConfig [read-only]Inherited

Properties Index

QStringdescription
QDeclarativeListProperty< bb::cascades::UIObject >labelledBy [read-only]
QStringname
bb::cascades::A11yRole::Typerole [read-only]
QDeclarativeListProperty< QObject >attachedObjects [read-only]Inherited
QStringobjectNameInherited
QObjectparent [read-only]Inherited
bb::cascades::UIConfigui [read-only]Inherited

Public Functions Index

virtual ~AbstractA11yObject ()
Q_INVOKABLE voidaddLabel (bb::cascades::UIObject *label)
QStringdescription () const
Q_INVOKABLE intindexOfLabel (bb::cascades::UIObject *label) const
Q_INVOKABLE bb::cascades::UIObject *labelAt (int index) const
Q_INVOKABLE intlabelCount () const
QStringname () const
Q_INVOKABLE voidremoveAllLabels ()
Q_INVOKABLE voidremoveLabel (bb::cascades::UIObject *label)
Q_SLOT voidresetDescription ()
Q_SLOT voidresetName ()
bb::cascades::A11yRole::Typerole () const
Q_SLOT voidsetDescription (const QString &description)
Q_SLOT voidsetName (const QString &name)
virtual boolevent (QEvent *event)Inherited
voidsetObjectName (const QString &name)Inherited
virtual Q_INVOKABLE QStringtoDebugString () const Inherited
Q_INVOKABLE bb::cascades::UIConfig *ui () const Inherited

Protected Functions Index

Only has inherited protected functions

BaseObject (QObject *parent=0)Inherited
virtual voidconnectNotify (const char *signal)Inherited
virtual voiddisconnectNotify (const char *signal)Inherited

Signals Index

voiddescriptionChanged (const QString &description)
voidlabelAdded (bb::cascades::UIObject *label)
voidlabelRemoved (bb::cascades::UIObject *label)
voidnameChanged (const QString &name)
voidcreationCompleted ()Inherited
voidobjectNameChanged (const QString &objectName)Inherited

Properties

QString description

The human-readable description for an accessible control.

See also:

bb::cascades::Control::accessibility

Since:

BlackBerry 10.2.0

QDeclarativeListProperty< bb::cascades::UIObject > labelledBy[read-only]

A QDeclarativeListProperty that contains all objects that act as labels for the accessible control.

An accessible control can use other objects as "labels" for description, in addition to the name and description properties. An example of usage could be a text field that is described by a label. Multiple labels can be assigned, if multiple objects provide information of different levels of detail.

If a label is added, the name and description from the label object's accessibility object, or built in defaults, is used. A Label control rarely needs a name set in order to act as label for another control, since by default the text on the label is used as name.

Note:

The objects acting as labels must be of type Control, AbstractPane or AbstractDialog, otherwise the label object will be disregarded.

Since:

BlackBerry 10.2.0

QString name

The human-readable name for an accessible control.

Every accessible control should have human-readable text associated with it. In most cases, this can be inferred by the text being displayed on the object or the text of a label that is labeling the object. In some cases, such as with icon-only push buttons, the name cannot be inferred and must be supplied by the application developer. This property represents that string.

Note:

Setting this property will override the default name inference of the control.

The default value for this property is QString::Null, indicating that no name is set.
Since:

BlackBerry 10.2.0

bb::cascades::A11yRole::Type role[read-only]

The role of an accessible control.

Describes the role of an accessible control, e.g. "button", "checkbox", "text" etc.

The default value for this property is bb::cascades::A11yRole::Undefined.

Since:

BlackBerry 10.2.0

QDeclarativeListProperty< QObject > attachedObjectsInherited[read-only]

A hierarchical list of the UIObject's attached objects.

Since:

BlackBerry 10.0.0

QString objectNameInherited

This property is overridden from QObject.

See also:

QObject::objectName().

Since:

BlackBerry 10.0.0

QObject parentInherited[read-only]

A read-only property that represents this object's parent.

The parent of an object is specified using QObject::setParent(QObject*). The purpose of the property is to expose the object's parent to QML.

This property is read-only to prevent modifications from QML, where typically the parent is declaratively set. In C++ code, the parent can be explicitly set using QObject::setParent(QObject*), or implicitly set by adding it to a visual container.

The default value of this property is 0.

Since:

BlackBerry 10.0.0

bb::cascades::UIConfig uiInherited[read-only]

An object that gives access to unit conversion routines.

QML use:
        // Size using design units
        Container {
            preferredWidth: ui.du(12)
            preferredHeight: ui.du(5)
        }

        // Size using design units, snap to whole pixels
        Container {
            preferredWidth: ui.sdu(13.5)
            preferredHeight: ui.sdu(7.5)
        }

        // Size using absolute pixel values
        Container {
            preferredWidth: ui.px(150)
            preferredHeight: ui.px(50)
        }
C++ use:
Container *container1 = Container::create().background(Color::Red);
UIConfig *ui = container1->ui();
container1->setPreferredWidth(ui->du(12));
container1->setPreferredHeight(ui->du(5));

Container *container2 = Container::create().background(Color::Green);
container2->setPreferredWidth(ui->sdu(13.5));
container2->setPreferredHeight(ui->sdu(7.5));

Container *container3 = Container::create().background(Color::Blue);
container3->setPreferredWidth(ui->px(150));
container3->setPreferredHeight(ui->sdu(50));
Since:

Blackberry 10.3.0

Public Functions

virtual~AbstractA11yObject ()

Destructor.

Q_INVOKABLE void addLabel (

Adds a label to the labelledBy property of the accessible control.

New labels are added as the last item in the list. The object that is passed must not be 0 or it will be ignored.

Ownership of the label object does not change. Since the object used as label is typically part of the UI tree, it retains its parent. The AbstractA11yObject will only become parent if explicitly set.

Parameters
label

The object to be added as label; must be a Control and not 0.

Since:

BlackBerry 10.2.0

QString description ()

Returns the accessibility description of the control.

Return:

The accessibility description of the control.

Since:

BlackBerry 10.2.0

Q_INVOKABLE int indexOfLabel (

Returns the index of a label object in the labelledBy property.

If the object isn't among the labels or if the object is 0, -1 is returned.

Parameters
label

The label object to get the index from.

Return:

The index of the specified label object if the object is valid, -1 otherwise.

Since:

BlackBerry 10.2.0

Q_INVOKABLE bb::cascades::UIObject * labelAt (
  • intindex)

Returns the label object at the specified index in the labelledBy property.

Parameters
index

The index of the object.

Return:

The requested object if the index was valid, 0 otherwise.

Since:

BlackBerry 10.2.0

Q_INVOKABLE int labelCount ()

Returns the number of labels in the labelledBy property of the accessible control.

Return:

The number of labels.

Since:

BlackBerry 10.2.0

QString name ()

Returns the accessibility name of the control.

Return:

The accessibility name of the control.

Since:

BlackBerry 10.2.0

Q_INVOKABLE void removeAllLabels ()

Removes all labels from the labelledBy property of the accessible control.

Emits labelRemoved with 0 as argument. Removed label objects that have the AbstractA11yObject as parent will be destroyed, before the signal is emitted.

Since:

BlackBerry 10.2.0

Q_INVOKABLE void removeLabel (

Removes a label from the labelledBy property of the accessible control.

If the label is found, labelRemoved will be emitted. If the removed label object has the AbstractA11yObject as parent, it will be destroyed after the signal has been emitted.

Parameters
label

The object to be removed; must not be 0.

Since:

BlackBerry 10.2.0

Q_SLOT void resetDescription ()

Resets the accessibility description of the control to QString::Null.

Since:

BlackBerry 10.2.0

Q_SLOT void resetName ()

Resets the accessibility name of the control to QString::Null.

Since:

BlackBerry 10.2.0

bb::cascades::A11yRole::Type role ()

Returns the accessibility role of the control.

Return:

The accessibility role of the control.

Since:

BlackBerry 10.2.0

Q_SLOT void setDescription (

Sets the accessibility description of the control.

Since:

BlackBerry 10.2.0

Q_SLOT void setName (

Sets the accessibility name of the control.

Since:

BlackBerry 10.2.0

virtual bool event (Inherited

Overloaded to implement the event mechanism in Cascades.

Warning!

If this function is overridden, it must be called by the derived class for events to work properly in Cascades.

Parameters
event

The received event.

Return:

True if the received event was recognized and processed, false otherwise.

Since:

BlackBerry 10.0.0

void setObjectName (Inherited

Sets the objectName property.

Parameters
name

The new name for the object.

Since:

BlackBerry 10.0.0

virtual Q_INVOKABLE QString toDebugString ()Inherited

Returns a debug string representing this object.

Return:

A debug string for the object.

Since:

BlackBerry 10.0.0

Q_INVOKABLE bb::cascades::UIConfig * ui ()Inherited

Returns the UIConfig for this ui object.

The UIConfig can be used to perform unit conversions from design units (du) and snapped design units (sdu) to pixels.

Ownership remains with Cascades.

C++ use:
Container *container1 = Container::create().background(Color::Red);
UIConfig *ui = container1->ui();
container1->setPreferredWidth(ui->du(12));
container1->setPreferredHeight(ui->du(5));

Container *container2 = Container::create().background(Color::Green);
container2->setPreferredWidth(ui->sdu(13.5));
container2->setPreferredHeight(ui->sdu(7.5));

Container *container3 = Container::create().background(Color::Blue);
container3->setPreferredWidth(ui->px(150));
container3->setPreferredHeight(ui->sdu(50));
Return:

The UIConfig for this ui object.

Since:

BlackBerry 10.3.0

Protected Functions

(Only has inherited protected functions)

BaseObject (Inherited

Constructs an instance of BaseObject's subclass.

Parameters
parent

An optional parent, defaults to 0.

Since:

BlackBerry 10.0.0

virtual void connectNotify (
  • const char *signal)
Inherited

Overloaded to implement the event mechanism in Cascades.

If this function is overridden, it must be called by the derived class for events to work properly in Cascades.

Parameters
signal

The connected signal.

Since:

BlackBerry 10.0.0

virtual void disconnectNotify (
  • const char *signal)
Inherited

Overloaded to implement the event mechanism in Cascades.

If this function is overridden, it must be called by the derived class for events to work properly in Cascades.

Parameters
signal

The disconnected signal.

Since:

BlackBerry 10.0.0

Signals

void descriptionChanged (

Emitted when the description property changes.

Parameters
description

The new value of description.

Since:

BlackBerry 10.2.0

void labelAdded (

Emitted when a label object has been added to the labelledBy property of the accessible control.

Parameters
label

The label object that has been added.

Since:

BlackBerry 10.2.0

void labelRemoved (

Emitted when a label object has been removed from the labelledBy property of the accessible control.

Parameters
label

The label object that has been removed. 0 if emitted by removeAllLabels().

Since:

BlackBerry 10.2.0

void nameChanged (

Emitted when the name property changes.

Parameters
name

The new value of name.

Since:

BlackBerry 10.2.0

void creationCompleted ()Inherited

Emitted when this object is instantiated as a result of loading a QML document and creating the root node (only after the root component that caused this instantiation has completed construction), or when the object is being constructed from its builder class.

This signal indicates that the construction and initialization of the object has been completed, the properties are initialized, and any QML binding values have been assigned to the object.

This signal is not emitted when the object is constructed from C++ using the constructor. If the object is constructed using its builder class, the signal is emitted when the the builder class returns the fully constructed object.

This signal can be used when there is an activity that needs to be performed, such as a property state integrity verification after the object is instantiated from a QML document or a builder, but before control is returned to the application.

See also:

QmlDocument

Since:

BlackBerry 10.0.0

void objectNameChanged (Inherited

This signal is emitted when the objectName property is changed.

Since:

BlackBerry 10.0.0

Last modified: 2014-06-24



Got questions about leaving a comment? Get answers from our Disqus FAQ.

comments powered by Disqus