CopperSpice API  1.9.2
QAccessibleTextInterface Class Referenceabstract

The QAccessibleTextInterface class implements support for text handling. More...

Inherited by QAccessibleAbstractSpinBox, QAccessibleLineEdit, QAccessibleTextWidget

Public Methods

virtual ~QAccessibleTextInterface ()
 
virtual void addSelection (int startOffset, int endOffset) = 0
 
virtual QString attributes (int offset, int *startOffset, int *endOffset) const = 0
 
virtual int characterCount () const = 0
 
virtual QRect characterRect (int offset) const = 0
 
virtual int cursorPosition () const = 0
 
virtual int offsetAtPoint (const QPoint &point) const = 0
 
virtual void removeSelection (int selectionIndex) = 0
 
virtual void scrollToSubstring (int startIndex, int endIndex) = 0
 
virtual void selection (int selectionIndex, int *startOffset, int *endOffset) const = 0
 
virtual int selectionCount () const = 0
 
virtual void setCursorPosition (int position) = 0
 
virtual void setSelection (int selectionIndex, int startOffset, int endOffset) = 0
 
virtual QString text (int startOffset, int endOffset) const = 0
 
virtual QString textAfterOffset (int offset, QAccessible::TextBoundaryType boundaryType, int *startOffset, int *endOffset) const
 
virtual QString textAtOffset (int offset, QAccessible::TextBoundaryType boundaryType, int *startOffset, int *endOffset) const
 
virtual QString textBeforeOffset (int offset, QAccessible::TextBoundaryType boundaryType, int *startOffset, int *endOffset) const
 

Detailed Description

The QAccessibleTextInterface class implements support for text handling.

This interface corresponds to the IAccessibleText interface. It should be implemented for widgets that display more text than a plain label. Labels should be represented by only QAccessibleInterface and return their text as name (QAccessibleInterface::text() with QAccessible::Name as type). The QAccessibleTextInterface is typically for text that a screen reader might want to read line by line, and for widgets that support text selection and input. This interface is, for example, implemented for QLineEdit.

Constructor & Destructor Documentation

QAccessibleTextInterface::~QAccessibleTextInterface ( )
virtual

Destroys the QAccessibleTextInterface.

Method Documentation

void QAccessibleTextInterface::addSelection ( int  startOffset,
int  endOffset 
)
pure virtual

Select the text from startOffset to endOffset. The startOffset is the first character that will be selected. The endOffset is the first character that will not be selected.

When the object supports multiple selections (e.g. in a word processor), this adds a new selection, otherwise it replaces the previous selection.

The selection will be endOffset - startOffset characters long.

QString QAccessibleTextInterface::attributes ( int  offset,
int *  startOffset,
int *  endOffset 
) const
pure virtual

Returns the text attributes at the position offset. In addition the range of the attributes is returned in startOffset and endOffset.

int QAccessibleTextInterface::characterCount ( ) const
pure virtual

Returns the length of the text (total size including spaces).

QRect QAccessibleTextInterface::characterRect ( int  offset) const
pure virtual

Returns the position and size of the character at position offset in screen coordinates.

int QAccessibleTextInterface::cursorPosition ( ) const
pure virtual

Returns the current cursor position.

int QAccessibleTextInterface::offsetAtPoint ( const QPoint point) const
pure virtual

Returns the offset of the character at the point in screen coordinates.

void QAccessibleTextInterface::removeSelection ( int  selectionIndex)
pure virtual

Clears the selection with index selectionIndex.

void QAccessibleTextInterface::scrollToSubstring ( int  startIndex,
int  endIndex 
)
pure virtual

Ensures that the text between startIndex and endIndex is visible.

void QAccessibleTextInterface::selection ( int  selectionIndex,
int *  startOffset,
int *  endOffset 
) const
pure virtual

Returns a selection. The size of the selection is returned in startOffset and endOffset. If there is no selection both startOffset and endOffset are 0.

The accessibility APIs support multiple selections. For most widgets though, only one selection is supported with selectionIndex equal to 0.

int QAccessibleTextInterface::selectionCount ( ) const
pure virtual

Returns the number of selections in this text.

void QAccessibleTextInterface::setCursorPosition ( int  position)
pure virtual

Moves the cursor to position.

void QAccessibleTextInterface::setSelection ( int  selectionIndex,
int  startOffset,
int  endOffset 
)
pure virtual

Set the selection selectionIndex to the range from startOffset to endOffset.

See also
addSelection(), removeSelection()
QString QAccessibleTextInterface::text ( int  startOffset,
int  endOffset 
) const
pure virtual

Returns the text from startOffset to endOffset. The startOffset is the first character that will be returned. The endOffset is the first character that will not be returned.

QString QAccessibleTextInterface::textAfterOffset ( int  offset,
QAccessible::TextBoundaryType  boundaryType,
int *  startOffset,
int *  endOffset 
) const
virtual

Returns the next text item matching the boundaryType after offset. Sets startOffset and endOffset values to the start and end positions of the item which was found. Returns an empty string if no item was found and sets startOffset and endOffset to -1 indicating an error.

This default implementation is provided for small text edits. A word processor or text editor should provide their own efficient implementations. This method makes no distinction between paragraphs and lines.

If the specified value for offset is -1 then the search starts at the end of the string.

QString QAccessibleTextInterface::textAtOffset ( int  offset,
QAccessible::TextBoundaryType  boundaryType,
int *  startOffset,
int *  endOffset 
) const
virtual

Returns the text item of type boundaryType at offset and sets startOffset and endOffset values to the start and end positions of that item. Returns an empty string if no item was found and sets startOffset and endOffset to -1 indicating an error.

This default implementation is provided for small text edits. A word processor or text editor should provide their own efficient implementations. This function makes no distinction between paragraphs and lines.

If the specified value for offset is -1 then the search starts at the end of the string.

QString QAccessibleTextInterface::textBeforeOffset ( int  offset,
QAccessible::TextBoundaryType  boundaryType,
int *  startOffset,
int *  endOffset 
) const
virtual

Returns the text item of type boundaryType that is close to the offset and sets startOffset and endOffset values to the start and end positions of that item. Returns an empty string if no item was found and sets startOffset and endOffset to -1 indicating an error.

This default implementation is provided for small text edits. A word processor or text editor should provide their own efficient implementations. This function makes no distinction between paragraphs and lines.

If the specified value for offset is -1 then the search starts at the end of the string.