ValueA11ySpecialization

Since: BlackBerry 10.2.0

#include <bb/cascades/ValueA11ySpecialization>

Class defining a "Value" accessibility specialization.

This specialization is typically implemented by objects that present some sort of bounded value, such as a progress bar or a slider.

This class doesn't enforce the contract for the minimum and maximum and value values, it's up to the application.

QML usage:
        accessibility: CustomA11yObject {
            id: accessibility0

            role: A11yRole.Slider
            name: "Awesome slider"
            description: "Item describing whether to slide stuff, tap to reset"

            ComponentA11ySpecialization {
                id: component0
                onActivationRequested: {
                    if (event.type == A11yComponentActivationType.Tap) {
                        slider.value = Undefined
                        event.consume()
                    }
                }
            }
            ValueA11ySpecialization {
                id: value0

                minValue: slider.fromValue
                value: slider.immediateValue
                maxValue: slider.toValue

                valueText: "min: " + minValue.toPrecision(3) + " value: " + value.toPrecision(3) + " max: " + maxValue.toPrecision(3)

                onValueAdjust: {
                    switch (adjustmentType) {
                    case A11yValueAdjustmentType.SingleStepAdd: slider.value *= 1.05; break;
                    case A11yValueAdjustmentType.SingleStepSubtract: slider.value *= 0.95; break;
                    }
                }
                onValueSet: {
                    slider.value = value;
                }
            }

        }


Overview

QML properties

maxValue: float
maxValueText: QString
minValue: float
minValueText: QString
value: float
valueText: QString
attachedObjects: QDeclarativeListProperty< QObject > [read-only]Inherited
objectName: QStringInherited
parent: QObject [read-only]Inherited

Properties Index

floatmaxValue
QStringmaxValueText
floatminValue
QStringminValueText
floatvalue
QStringvalueText
QDeclarativeListProperty< QObject >attachedObjects [read-only]Inherited
QStringobjectNameInherited
QObjectparent [read-only]Inherited

Public Functions Index

ValueA11ySpecialization (UIObject *parent=0)
virtual ~ValueA11ySpecialization ()
floatmaxValue () const
QStringmaxValueText () const
floatminValue () const
QStringminValueText () const
Q_SLOT voidresetMaxValue ()
Q_SLOT voidresetMaxValueText ()
Q_SLOT voidresetMinValue ()
Q_SLOT voidresetMinValueText ()
Q_SLOT voidresetValue ()
Q_SLOT voidresetValueText ()
Q_SLOT voidsetMaxValue (float maxValue)
Q_SLOT voidsetMaxValueText (const QString &maxValueText)
Q_SLOT voidsetMinValue (float minValue)
Q_SLOT voidsetMinValueText (const QString &minValueText)
Q_SLOT voidsetValue (float value)
Q_SLOT voidsetValueText (const QString &valueText)
floatvalue () const
QStringvalueText () const
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

voidmaxValueChanged (float maxValue)
voidmaxValueTextChanged (const QString &maxValueText)
voidminValueChanged (float minValue)
voidminValueTextChanged (const QString &minValueText)
voidvalueAdjustmentRequested (bb::cascades::A11yValueAdjustmentType::Type adjustType)
voidvalueChanged (float value)
voidvalueSetRequested (float value)
voidvalueTextChanged (const QString &valueText)
voidcreationCompleted ()Inherited
voidobjectNameChanged (const QString &objectName)Inherited

Properties

float maxValue

The property representing the maximum value of the value property.

The default maxValue for a value is 0.0.

Since:

BlackBerry 10.2.0

QString maxValueText

The textual representation of the value of maxValue property.

This property holds textual human readable representation of the value of the maxValue property. For example, for a slider controlling transparency as a percentage from 0 to 100 it could be set to "Fully Transparent".

Since:

BlackBerry 10.2.0

float minValue

The property representing the minimum value of the value property.

The default minValue for a value is 0.0.

Since:

BlackBerry 10.2.0

QString minValueText

The textual representation of the value of minValue property.

This property holds textual human readable representation of the value of the minValue property. For example, for a slider controlling transparency as a percentage from 0 to 100 it could be set to "Fully Opaque".

Since:

BlackBerry 10.2.0

float value

The current value.

The default value is the same as minValue.

Since:

BlackBerry 10.2.0

QString valueText

The textual representation of the value of value property.

This property holds textual human readable representation of the value of the value property. For example, for a slider representing percentage from 0 to 100 it could be set to "50%" if the value is 50.

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

ValueA11ySpecialization (

Creates a ValueA11ySpecialization with role bb::cascades::A11yRole::Undefined.

Parameters
parent

The parent object, or 0. This parameter is optional. The default is 0 if you don't specify a parent.

Since:

BlackBerry 10.2.0

virtual~ValueA11ySpecialization ()

Destructor.

Since:

BlackBerry 10.2.0

float maxValue ()

Returns the maxValue of the control.

Return:

The maximum value for the value property.

Since:

BlackBerry 10.2.0

QString maxValueText ()

Returns the current value of maxValueText property.

Return:

The current textual representation of maxValue.

Since:

BlackBerry 10.2.0

float minValue ()

Returns the minValue.

Return:

The minimum value for value property.

Since:

BlackBerry 10.2.0

QString minValueText ()

Returns the current value of minValueText property.

Return:

The current textual representation of minValue.

Since:

BlackBerry 10.2.0

Q_SLOT void resetMaxValue ()

Resets the maxValue to the default value of 0.

Since:

BlackBerry 10.2.0

Q_SLOT void resetMaxValueText ()

Resets the textual representation of maxValue to the default value, QString::null.

Since:

BlackBerry 10.2.0

Q_SLOT void resetMinValue ()

Resets the minValue to the default value of 0.

Since:

BlackBerry 10.2.0

Q_SLOT void resetMinValueText ()

Resets the textual representation of minValue to the default value, QString::null.

Since:

BlackBerry 10.2.0

Q_SLOT void resetValue ()

Resets the current value to the default value.

The default value is the same as minValue.

Since:

BlackBerry 10.2.0

Q_SLOT void resetValueText ()

Resets the value text to the default value, QString::null.

Since:

BlackBerry 10.2.0

Q_SLOT void setMaxValue (
  • floatmaxValue)

Sets the maxValue.

Parameters
maxValue

The new maximum value for value property

Since:

BlackBerry 10.2.0

Q_SLOT void setMaxValueText (

Sets the value for maxValueText property.

Parameters
maxValueText

The new textual representation of maxValue.

Since:

BlackBerry 10.2.0

Q_SLOT void setMinValue (
  • floatminValue)

Sets the minValue.

Parameters
minValue

The new minimum value for value property

Since:

BlackBerry 10.2.0

Q_SLOT void setMinValueText (

Sets the value for minValueText property.

Parameters
minValueText

The new textual representation of minValue.

Since:

BlackBerry 10.2.0

Q_SLOT void setValue (
  • floatvalue)

Sets the current value.

If you provide a number outside the defined range, the value is clamped to the range.

Parameters
value

The value

Since:

BlackBerry 10.2.0

Q_SLOT void setValueText (

Sets the value for valueText property.

Parameters
valueText

The new value text.

Since:

BlackBerry 10.2.0

float value ()

Returns the current value.

Since:

BlackBerry 10.2.0

QString valueText ()

Returns the current value of valueText property.

Return:

The current value text.

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 maxValueChanged (
  • floatmaxValue)

Emitted when the maxValue changes.

Parameters
maxValue

The new maximum value for the value property.

Since:

BlackBerry 10.2.0

void maxValueTextChanged (

Emitted when the maxValueText changes.

Parameters
maxValueText

The new value for the maxValueText property.

Since:

BlackBerry 10.2.0

void minValueChanged (
  • floatminValue)

Emitted when the minValue changes.

Parameters
minValue

The new minimum value for the value property.

Since:

BlackBerry 10.2.0

void minValueTextChanged (

Emitted when the minValueText changes.

Parameters
minValueText

The new value for the minValueText property.

Since:

BlackBerry 10.2.0

void valueAdjustmentRequested (

Signal emitted when value adjustment is requested from the object by the a11y framework.

The value of adjustType will correspond to A11yValueAdjustmentType::Type values.

QML usage:
            ValueA11ySpecialization {
                id: value0

                minValue: slider.fromValue
                value: slider.immediateValue
                maxValue: slider.toValue

                valueText: "min: " + minValue.toPrecision(3) + " value: " + value.toPrecision(3) + " max: " + maxValue.toPrecision(3)

                onValueAdjust: {
                    switch (adjustmentType) {
                    case A11yValueAdjustmentType.SingleStepAdd: slider.value *= 1.05; break;
                    case A11yValueAdjustmentType.SingleStepSubtract: slider.value *= 0.95; break;
                    }
                }
                onValueSet: {
                    slider.value = value;
                }
            }
Parameters
adjustType

The type of the requested adjustment

Since:

BlackBerry 10.2.0

void valueChanged (
  • floatvalue)

Emitted when the value changes.

Parameters
value

The current value.

Since:

BlackBerry 10.2.0

void valueSetRequested (
  • floatvalue)

Signal emitted when value set is requested from the object by the a11y framework.

QML usage:
            ValueA11ySpecialization {
                id: value0

                minValue: slider.fromValue
                value: slider.immediateValue
                maxValue: slider.toValue

                valueText: "min: " + minValue.toPrecision(3) + " value: " + value.toPrecision(3) + " max: " + maxValue.toPrecision(3)

                onValueAdjust: {
                    switch (adjustmentType) {
                    case A11yValueAdjustmentType.SingleStepAdd: slider.value *= 1.05; break;
                    case A11yValueAdjustmentType.SingleStepSubtract: slider.value *= 0.95; break;
                    }
                }
                onValueSet: {
                    slider.value = value;
                }
            }
Parameters
value

The value requested to be set

Since:

BlackBerry 10.2.0

void valueTextChanged (

Emitted when the valueText changes.

Parameters
valueText

The new value for the valueText property.

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