QAccessibleClient::AccessibleObject

QAccessibleClient::AccessibleObject Class Reference

#include <accessibleobject.h>

Public Types

enum  Interface {
  NoInterface = 0x0, AccessibleInterface = 0x1, CacheInterface = 0x2, ActionInterface = 0x4,
  ApplicationInterface = 0x8, CollectionInterface = 0x10, ComponentInterface = 0x20, DocumentInterface = 0x40,
  EditableTextInterface = 0x80, EventKeyboardInterface = 0x100, EventMouseInterface = 0x200, EventObjectInterface = 0x400,
  HyperlinkInterface = 0x800, HypertextInterface = 0x1000, ImageInterface = 0x2000, SelectionInterface = 0x4000,
  TableInterface = 0x8000, TextInterface = 0x10000, ValueInterface = 0x20000, SocketInterface = 0x40000,
  EventWindowInterface = 0x80000, EventFocusInterface = 0x100000, InvalidInterface = 0x80000000
}
 
typedef QFlags< InterfaceInterfaces
 
enum  LocaleType {
  LocaleTypeMessages, LocaleTypeCollate, LocaleTypeCType, LocaleTypeMonetary,
  LocaleTypeNumeric, LocaleTypeTime
}
 
enum  Role {
  NoRole, CheckBox, CheckableMenuItem, ColumnHeader,
  ComboBox, DesktopFrame, Dial, Dialog,
  Filler, Frame, Icon, Label,
  ListView, ListItem, Menu, MenuBar,
  MenuItem, Tab, TabContainer, PasswordText,
  PopupMenu, ProgressBar, Button, RadioButton,
  RadioMenuItem, RowHeader, ScrollBar, ScrollArea,
  Separator, Slider, SpinButton, StatusBar,
  TableView, TableCell, TableColumnHeader, TableColumn,
  TableRowHeader, TableRow, Terminal, Text,
  ToggleButton, ToolBar, ToolTip, TreeView,
  Window, TreeItem
}
 
enum  TextBoundary {
  CharBoundary, WordStartBoundary, WordEndBoundary, SentenceStartBoundary,
  SentenceEndBoundary, LineStartBoundary, LineEndBoundary
}
 

Public Member Functions

 AccessibleObject ()
 
 AccessibleObject (const AccessibleObject &other)
 
 ~AccessibleObject ()
 
QString accessibleId () const
 
QVector< QSharedPointer< QAction > > actions () const
 
double alpha () const
 
QString appBusAddress () const
 
int appId () const
 
AccessibleObject application () const
 
QString appLocale (LocaleType lctype=LocaleTypeMessages) const
 
QString appToolkitName () const
 
QString appVersion () const
 
QRect boundingRect () const
 
int caretOffset () const
 
int characterCount () const
 
QRect characterRect (int offset) const
 
AccessibleObject child (int index) const
 
int childCount () const
 
QList< AccessibleObjectchildren () const
 
QVector< QList< AccessibleObject > > children (const QList< Role > &roles) const
 
bool copyText (int startPos, int endPos)
 
double currentValue () const
 
bool cutText (int startPos, int endPos)
 
bool deleteText (int startPos, int endPos)
 
QString description () const
 
QPoint focusPoint () const
 
bool hasSelectableText () const
 
bool hasToolTip () const
 
QString id () const
 
QString imageDescription () const
 
QString imageLocale () const
 
QRect imageRect () const
 
int indexInParent () const
 
bool insertText (const QString &text, int position=0, int length=-1)
 
bool isActive () const
 
bool isCheckable () const
 
bool isChecked () const
 
bool isDefault () const
 
bool isDefunct () const
 
bool isEditable () const
 
bool isEnabled () const
 
bool isExpandable () const
 
bool isExpanded () const
 
bool isFocusable () const
 
bool isFocused () const
 
bool isMultiLine () const
 
bool isSelectable () const
 
bool isSelected () const
 
bool isSensitive () const
 
bool isSingleLine () const
 
bool isValid () const
 
bool isVisible () const
 
int layer () const
 
QString localizedRoleName () const
 
double maximumValue () const
 
int mdiZOrder () const
 
double minimumValue () const
 
double minimumValueIncrement () const
 
QString name () const
 
bool operator!= (const AccessibleObject &other) const
 
AccessibleObjectoperator= (const AccessibleObject &other)
 
bool operator== (const AccessibleObject &other) const
 
AccessibleObject parent () const
 
bool pasteText (int position)
 
Role role () const
 
QString roleName () const
 
QList< AccessibleObjectselection () const
 
bool setCurrentValue (const double value)
 
bool setText (const QString &text)
 
void setTextSelections (const QList< QPair< int, int > > &selections)
 
QString stateString () const
 
Interfaces supportedInterfaces () const
 
bool supportsAutocompletion () const
 
QString text (int startOffset=0, int endOffset=-1) const
 
QList< QPair< int, int > > textSelections () const
 
QString textWithBoundary (int offset, TextBoundary boundary, int *startOffset=nullptr, int *endOffset=nullptr) const
 
QUrl url () const
 

Friends

QDebug QAccessibleClient::operator<< (QDebug, const AccessibleObject &)
 
uint qHash (const QAccessibleClient::AccessibleObject &object)
 

Detailed Description

This class represents an accessible object.

An accessible object equals usually a visible widget or some kind of other element the user can interact with but can also present a not visible object that offers certain functionality like for example actions which can be triggered.

It is implicitly shared and only created by the library.

Definition at line 56 of file accessibleobject.h.

Member Enumeration Documentation

This enum describes the different interfaces that an AccessibleObject can implement.

Each AccessibleObject must implement the AccessibleInterface, otherwise it is invalid. All other interfaces are optional.

If the ActionInterface is implement the object will have a list of actions that can be invoked.

Definition at line 70 of file accessibleobject.h.

The type of locale.

Definition at line 574 of file accessibleobject.h.

The role indicates the type of UI element that an AccessibleObject represents.

Enumerator
NoRole 

The object is invalid and has no role set. This is generally a bug.

Definition at line 102 of file accessibleobject.h.

The TextBoundaries enum represents the different boundaries when asking for text at a certain offset.

Definition at line 192 of file accessibleobject.h.

Constructor & Destructor Documentation

AccessibleObject::AccessibleObject ( )

Construct an invalid AccessibleObject.

Definition at line 33 of file accessibleobject.cpp.

AccessibleObject::AccessibleObject ( const AccessibleObject other)

Copy constructor.

Definition at line 61 of file accessibleobject.cpp.

AccessibleObject::~AccessibleObject ( )

Destroys the AccessibleObject.

Definition at line 66 of file accessibleobject.cpp.

Member Function Documentation

QString AccessibleObject::accessibleId ( ) const

Returns the accessible id of this accessible.

This is an id which is stable over application development. It may be empty.

Definition at line 145 of file accessibleobject.cpp.

QVector< QSharedPointer< QAction > > AccessibleObject::actions ( ) const

Returns a list of actions supported by this accessible.

Just trigger() the action to execute the underlying method at the accessible.

Definition at line 409 of file accessibleobject.cpp.

double AccessibleObject::alpha ( ) const

Obtain the alpha value of the component.

An alpha value of 1.0 or greater indicates that the object is fully opaque, and an alpha value of 0.0 indicates that the object is fully transparent. Negative alpha values have no defined meaning at this time.

Alpha values are used in conjunction with Z-order calculations to determine whether an object wholly or partially obscures another object's visual intersection, in the event that their bounds intersect.

Definition at line 185 of file accessibleobject.cpp.

QString AccessibleObject::appBusAddress ( ) const

The application dbus address.

Definition at line 359 of file accessibleobject.cpp.

int AccessibleObject::appId ( ) const

Returns the unique application identifier.

Returns
The app id. The identifier will not last over session and everytime the app quits and restarts it gets another identifier that persists as long as the application is running.

Definition at line 349 of file accessibleobject.cpp.

AccessibleObject AccessibleObject::application ( ) const

Returns the application object.

Returns
The top-level application object that expose an org.a11y.atspi.Application accessibility interface.

Definition at line 334 of file accessibleobject.cpp.

QString AccessibleObject::appLocale ( LocaleType  lctype = LocaleTypeMessages) const

The application locale.

Parameters
lctypeThe LocaleType for which the locale is queried.
Returns
A string compliant with the POSIX standard for locale description.

Definition at line 354 of file accessibleobject.cpp.

QString AccessibleObject::appToolkitName ( ) const

Returns the toolkit name.

Returns
The tookit name. This can be for example "Qt" or "gtk".

Definition at line 339 of file accessibleobject.cpp.

QString AccessibleObject::appVersion ( ) const

Returns the toolkit version.

Returns
The tookit version. This can be for example "4.8.3" for Qt 4.8.3.

Definition at line 344 of file accessibleobject.cpp.

QRect AccessibleObject::boundingRect ( ) const

Returns a bounding rectangle for the accessible.

It returns a QRect that bounds the accessible. This can be used to get the focus coordinates.

Returns
QRect that bounds the accessible.

Definition at line 190 of file accessibleobject.cpp.

int AccessibleObject::caretOffset ( ) const

Returns the offset of the caret from the beginning of the text.

This function provides the current offset of the caret from the beginning of the text in an accessible that implements org.a11y.atspi.Text.

Returns
Caret Offset as an integer

Definition at line 215 of file accessibleobject.cpp.

int AccessibleObject::characterCount ( ) const

Returns the number of characters.

Returns
Number of characters.

Definition at line 225 of file accessibleobject.cpp.

QRect AccessibleObject::characterRect ( int  offset) const

Returns a bounding rectangle for the character at position offset.

This function is only supported for accessibles that implement the text interface. It will return an empty rectangle for invalid offsets or accessibles.

Returns
QRect that bounds the character.

Definition at line 200 of file accessibleobject.cpp.

AccessibleObject AccessibleObject::child ( int  index) const

Returns a specific child at position index.

The list of children is 0-based.

Returns
number of children

Definition at line 135 of file accessibleobject.cpp.

int AccessibleObject::childCount ( ) const

Returns the number of children for this accessible.

Returns
number of children

Definition at line 130 of file accessibleobject.cpp.

QList< AccessibleObject > AccessibleObject::children ( ) const

Returns this accessible's children in a list.

Returns
children

Definition at line 112 of file accessibleobject.cpp.

QVector< QList< AccessibleObject > > AccessibleObject::children ( const QList< Role > &  roles) const

Returns this accessible's children according to there roles.

Parameters
rolesThe list of roles to query.
Returns
A vector that contains the children of this object according to there roles. The number of vector-items equals to the number and sorting of the roles items. Example code demonstrating usage:
roles << Label << CheckBox;
Q_ASSERT(c.count() == roles.count());
Q_ASSERT(c[0].isEmpty() || c[0].first().role() == Label);
Q_ASSERT(c[1].isEmpty() || c[1].first().role() == CheckBox);

Definition at line 117 of file accessibleobject.cpp.

bool AccessibleObject::copyText ( int  startPos,
int  endPos 
)

Copy the text from the EditableTextInterface into the clipboard.

Parameters
startPosThe caret position from which to start to copy the text from.
endPosThe caret position from which to end to copy the text from.
Returns
true on success and false on error.

Definition at line 267 of file accessibleobject.cpp.

double AccessibleObject::currentValue ( ) const

The current value of the valuator.

This is the value the org.a11y.atspi.Value accessibility interface has.

Definition at line 379 of file accessibleobject.cpp.

bool AccessibleObject::cutText ( int  startPos,
int  endPos 
)

Cut the text from the EditableTextInterface into the clipboard.

Parameters
startPosThe caret position from which to start to cut the text from.
endPosThe caret position from which to end to cut the text from.
Returns
true on success and false on error.

Definition at line 275 of file accessibleobject.cpp.

bool AccessibleObject::deleteText ( int  startPos,
int  endPos 
)

Delete the text from the EditableTextInterface.

Parameters
startPosThe caret position from which to start to delete the text.
endPosThe caret position from which to end to delete the text.
Returns
true on success and false on error.

Definition at line 283 of file accessibleobject.cpp.

QString AccessibleObject::description ( ) const

Returns the description for this accessible.

The description is more of an explanation than the name. This can be a sentence. The string is localized.

Definition at line 155 of file accessibleobject.cpp.

QPoint AccessibleObject::focusPoint ( ) const

Returns focus-point of the object.

Returns
The Focus Point of the object

Definition at line 314 of file accessibleobject.cpp.

bool AccessibleObject::hasSelectableText ( ) const

Returns if the AccessibleObject allows text selections.

Definition at line 421 of file accessibleobject.cpp.

bool AccessibleObject::hasToolTip ( ) const

Returns if the AccessibleObject has a tool tip.

Definition at line 426 of file accessibleobject.cpp.

QString AccessibleObject::id ( ) const

Returns a unique identifier for the object.

Definition at line 70 of file accessibleobject.cpp.

QString AccessibleObject::imageDescription ( ) const

A description text of the image.

It is recommended that imageDescription be the shorter of the available image descriptions, for instance "alt text" in HTML images, and a longer description be provided in Accessible::accessible-description, if available. A short, one or two word label for the image should be provided in Accessible::accessible-name.

Returns
A UTF-8 string providing a textual description of what is visually depicted in the image.

Definition at line 394 of file accessibleobject.cpp.

QString AccessibleObject::imageLocale ( ) const

The locale of the image.

Returns
A string corresponding to the POSIX LC_MESSAGES locale used by the imageDescription.

Definition at line 399 of file accessibleobject.cpp.

QRect AccessibleObject::imageRect ( ) const

The image boundaries.

Obtain a bounding box which entirely contains the image contents, as displayed on screen.

The bounds returned do not account for any viewport clipping or the fact that the image may be partially or wholly obscured by other onscreen content.

This method returns the bounds of the current onscreen view, and not the nominal size of the source data in the event that the original image has been rescaled.\

Returns
A BoundingBox enclosing the image's onscreen representation.

Definition at line 404 of file accessibleobject.cpp.

int AccessibleObject::indexInParent ( ) const

Returns this accessible's index in it's parent's list of children.

Returns
index

Definition at line 140 of file accessibleobject.cpp.

bool AccessibleObject::insertText ( const QString text,
int  position = 0,
int  length = -1 
)

Insert the text into the EditableTextInterface.

Parameters
textThe text to insert.
positionThe caret position at which to insert the text.
lengthThe length of the text to insert.
Returns
true on success and false on error.

Definition at line 259 of file accessibleobject.cpp.

bool AccessibleObject::isActive ( ) const

Returns if the AccessibleObject is currently active.

Definition at line 431 of file accessibleobject.cpp.

bool AccessibleObject::isCheckable ( ) const

Returns if the AccessibleObject is checkable (often indicates a check action)

Definition at line 436 of file accessibleobject.cpp.

bool AccessibleObject::isChecked ( ) const

Returns if the AccessibleObject is currently checked.

Definition at line 451 of file accessibleobject.cpp.

bool AccessibleObject::isDefault ( ) const

Returns if the AccessibleObject is the default widget (e.g. a button in a dialog)

Definition at line 461 of file accessibleobject.cpp.

bool AccessibleObject::isDefunct ( ) const

Returns if the AccessibleObject is defunct - that means it does not properly respont to requests and should be ignored for accessibility purposes.

Definition at line 456 of file accessibleobject.cpp.

bool AccessibleObject::isEditable ( ) const

Returns if the AccessibleObject is an editable text.

Definition at line 466 of file accessibleobject.cpp.

bool AccessibleObject::isEnabled ( ) const

Returns if the AccessibleObject is currently enabled.

Definition at line 471 of file accessibleobject.cpp.

bool AccessibleObject::isExpandable ( ) const

Returns if the AccessibleObject can be expanded to show more information.

Definition at line 476 of file accessibleobject.cpp.

bool AccessibleObject::isExpanded ( ) const

Returns if the AccessibleObject is currently expanded.

Definition at line 481 of file accessibleobject.cpp.

bool AccessibleObject::isFocusable ( ) const

Returns if the AccessibleObject is focusable.

Definition at line 486 of file accessibleobject.cpp.

bool AccessibleObject::isFocused ( ) const

Returns if the AccessibleObject is currently focused.

Definition at line 491 of file accessibleobject.cpp.

bool AccessibleObject::isMultiLine ( ) const

Returns if the AccessibleObject is a multi line text edit.

Definition at line 496 of file accessibleobject.cpp.

bool AccessibleObject::isSelectable ( ) const

Returns if the AccessibleObject is selectable.

Definition at line 501 of file accessibleobject.cpp.

bool AccessibleObject::isSelected ( ) const

Returns if the AccessibleObject is currently selected.

Definition at line 506 of file accessibleobject.cpp.

bool AccessibleObject::isSensitive ( ) const

Returns if the AccessibleObject reacts to input events.

Definition at line 511 of file accessibleobject.cpp.

bool AccessibleObject::isSingleLine ( ) const

Returns if the AccessibleObject is a single line text edit.

Definition at line 516 of file accessibleobject.cpp.

bool AccessibleObject::isValid ( ) const

Returns true if this object is valid.

Invalid objects are for example returned when asking for the parent of the top most item, or for a child that is out of range.

Definition at line 88 of file accessibleobject.cpp.

bool AccessibleObject::isVisible ( ) const

Returns if the AccessibleObject is currently visible (it can still be off the screen, but there is nothing preventing the user from seeing it in general)

Definition at line 540 of file accessibleobject.cpp.

int AccessibleObject::layer ( ) const

The ComponentLayer in which this object resides.

Definition at line 175 of file accessibleobject.cpp.

QString AccessibleObject::localizedRoleName ( ) const

Returns the name of the role of this accessible.

This name is localized and can be presented to the user.

Definition at line 170 of file accessibleobject.cpp.

double AccessibleObject::maximumValue ( ) const

The maximum value allowed by this valuator.

If both, the minimumValue and maximumValue, are zero then there is no minimum or maximum values. The currentValue has no range restrictions.

Definition at line 369 of file accessibleobject.cpp.

int AccessibleObject::mdiZOrder ( ) const

Obtain the relative stacking order (i.e.

'Z' order) of an object.

Larger values indicate that an object is on "top" of the stack, therefore objects with smaller MDIZOrder may be obscured by objects with a larger MDIZOrder, but not vice-versa.

Definition at line 180 of file accessibleobject.cpp.

double AccessibleObject::minimumValue ( ) const

The minimum value allowed by this valuator.

If both, the minimumValue and maximumValue, are zero then there is no minimum or maximum values. The currentValue has no range restrictions.

Definition at line 364 of file accessibleobject.cpp.

double AccessibleObject::minimumValueIncrement ( ) const

The smallest incremental change which this valuator allows.

This is a helper value to know in what steps the currentValue is incremented or decremented.

If 0, the incremental changes to the valuator are limited only by the precision of a double precision value on the platform.

Definition at line 374 of file accessibleobject.cpp.

QString AccessibleObject::name ( ) const

Returns the name of this accessible.

The name is a short descriptive one or two words. It is localized.

Definition at line 150 of file accessibleobject.cpp.

bool QAccessibleClient::AccessibleObject::operator!= ( const AccessibleObject other) const
inline

Inequality operator.

Definition at line 228 of file accessibleobject.h.

AccessibleObject & AccessibleObject::operator= ( const AccessibleObject other)

Assignment operator.

Definition at line 96 of file accessibleobject.cpp.

bool AccessibleObject::operator== ( const AccessibleObject other) const

Comparison operator.

Definition at line 102 of file accessibleobject.cpp.

AccessibleObject AccessibleObject::parent ( ) const

Returns this object's parent.

Returns
The parent AccessibleObject

Definition at line 107 of file accessibleobject.cpp.

bool AccessibleObject::pasteText ( int  position)

Paste the text from the clipboard into the EditableTextInterface.

Parameters
positionThe caret position at which to insert the text into.
Returns
true on success and false on error.

Definition at line 291 of file accessibleobject.cpp.

AccessibleObject::Role AccessibleObject::role ( ) const

Returns the role as integer value of this accessible.

Definition at line 160 of file accessibleobject.cpp.

QString AccessibleObject::roleName ( ) const

Returns the name of the role of this accessible.

This name is not localized to allow tools to work with the english string.

Definition at line 165 of file accessibleobject.cpp.

QList< AccessibleObject > AccessibleObject::selection ( ) const

Returns the selection of accessible objects.

Definition at line 389 of file accessibleobject.cpp.

bool AccessibleObject::setCurrentValue ( const double  value)

Set the value of the valuator.

Parameters
valuethe value to set.
Returns
true on success and false on error.

Definition at line 384 of file accessibleobject.cpp.

bool AccessibleObject::setText ( const QString text)

Set the text of the EditableTextInterface.

Parameters
textThe text to set.
Returns
true on success and false on error.

Definition at line 251 of file accessibleobject.cpp.

void AccessibleObject::setTextSelections ( const QList< QPair< int, int > > &  selections)

Set text selections, usually only one selection will be set, use a list containing one QPair with the start and end offsets for that.

Definition at line 307 of file accessibleobject.cpp.

QString AccessibleObject::stateString ( ) const

Return a string representing states of this object.

This is useful for debugging applications.

Definition at line 521 of file accessibleobject.cpp.

AccessibleObject::Interfaces AccessibleObject::supportedInterfaces ( ) const

Returns List of interfaces supported by the accessible.

This function provides a list of accessibile interfaces that are implemented by an accessible object. This can be used to avoid calling functions that are not supported by the accessible.

Returns
QStringList that contains list of supported interfaces

Definition at line 210 of file accessibleobject.cpp.

bool AccessibleObject::supportsAutocompletion ( ) const

Returns if the AccessibleObject supports automatic text completion.

Definition at line 545 of file accessibleobject.cpp.

QString AccessibleObject::text ( int  startOffset = 0,
int  endOffset = -1 
) const

Returns the text of the TextInterface.

This function provides the current text as displayed by the org.a11y.atspi.Text TextInterface component.

Parameters
startOffsetThe start caret offset to return the text from.
endOffsetThe end caret offset to return the text from. If -1 then the endOffset is the end of the string what means all characters are included.
Returns
The text as displayed by the TextInterface.

Definition at line 235 of file accessibleobject.cpp.

QList< QPair< int, int > > AccessibleObject::textSelections ( ) const

Returns a list of selections the text has.

Code to demonstrate usage:

QList< QPair<int,int> > sel = acc.textSelections();
int startOffset = sel[0].first;
int endOffset = sel[0].second;
QString allText = acc.text();
QString selText = allText.mid(startOffset, endOffset - startOffset);
Returns
The list of selections where every item in that list is a pair of integers representing startOffset and endOffset of the selection.

Definition at line 299 of file accessibleobject.cpp.

QString AccessibleObject::textWithBoundary ( int  offset,
TextBoundary  boundary,
int *  startOffset = nullptr,
int *  endOffset = nullptr 
) const

Returns the text of the TextInterface by boundary.

Especially for larger text fields it may be more performant and easier to query the text at a certain position instead of the full text.

For example the line where the cursor is currently can be retrieved with this function in a convenient way.

Parameters
offsetis the position of the requested text.
startOffsetreturns the beginning of the offset, for example the start of the line when asking for line boundaries.
endOffsetreturns the end of the text section
Returns
the text at the offset.

Definition at line 243 of file accessibleobject.cpp.

QUrl AccessibleObject::url ( ) const

Returns a QUrl that references the AccessibleObject.

This can be used to serialize/unserialize an AccessibleObject to pass it around as string and restore the AccessibleObject by using Registry::accessibleFromUrl later on.

The returned QUrl returns a scheme of "accessibleobject", the dbus path as url path and the dbus service as url fragment.

Definition at line 77 of file accessibleobject.cpp.


The documentation for this class was generated from the following files:
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Thu Nov 26 2020 23:02:43 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.