AbstractA11yObject

Since: BlackBerry 10.2.0

#include <bb/cascades/AbstractA11yObject>

Defines a control's accessibility properties.

A control's accessiblity 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

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

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

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.

An accessible description is typically a short phrase or sentence that briefly describes the purpose of the object. This is not a required attribute of the object.

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

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 datail.

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 labelling 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.

This QDeclarativeListProperty can contain any QObject. When a QObject is added to property, the UIObject takes ownership of the attached object.

This feature is typically used from QML to specify business logic object or any other shared objects for the subnodes of this UIObject. In C++ the same functionality can be achived by setting a parent of a QObject to be attached to the QObject which is going to own it.

QML usage example (MyObject is a custom class registered for QML using the qmlRegisterType() function):

Container {
    Label { text: "Title: " + myObject.title } 
    Label { text: "Subject: " + myObject.subject }
    attachedObjects: [
        MyObject { id: myObject
            title: "Hello World"
            subject: "Nice Day"
        }
    ]
}

Since:

BlackBerry 10.0.0

QString objectNameInherited

This property is overridden from QObject.

As the objectName property is overridden from the QObject class, this signal will not be emitted if setObjectName() function is called directly on QObject.

The default value of this property is QString::null.

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

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 accesible 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

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

This signal is emitted only when this object is instantiated as a result of loading a QML document and creating the root node, or when an object is being constructed using its builder class.

This signal is emitted only 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 is emitted to indicate 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-03-13

comments powered by Disqus