QAccessibleTextInterface 类

QAccessibleTextInterface 类实现对文本处理的支持。 更多...

头: #include <QAccessibleTextInterface>
CMake: find_package(Qt6 REQUIRED COMPONENTS Gui)
target_link_libraries(mytarget PRIVATE Qt6::Gui)
qmake: QT += gui

公共函数

virtual ~QAccessibleTextInterface ()
virtual void addSelection (int startOffset , int endOffset ) = 0
virtual QString 属性 (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

详细描述

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 () 采用 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 .

IAccessible2 规范

成员函数文档编制

[虚拟] QAccessibleTextInterface:: ~QAccessibleTextInterface ()

销毁 QAccessibleTextInterface .

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

选择文本从 startOffset to endOffsetstartOffset 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.

[pure virtual] QString QAccessibleTextInterface:: 属性 ( int offset , int * startOffset , int * endOffset ) const

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

[pure virtual] int QAccessibleTextInterface:: characterCount () const

返回文本的长度 (总大小包括空格)。

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

Returns the position and size of the character at position offset 按屏幕坐标。

[pure virtual] int QAccessibleTextInterface:: cursorPosition () const

返回当前光标位置。

另请参阅 setCursorPosition ().

[pure virtual] int QAccessibleTextInterface:: offsetAtPoint (const QPoint & point ) const

Returns the offset of the character at the point 按屏幕坐标。

[pure virtual] void QAccessibleTextInterface:: removeSelection ( int selectionIndex )

Clears the selection with index selectionIndex .

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

Ensures that the text between startIndex and endIndex 可见。

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

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

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

另请参阅 setSelection ().

[pure virtual] int QAccessibleTextInterface:: selectionCount () const

Returns the number of selections in this text.

[pure virtual] void QAccessibleTextInterface:: setCursorPosition ( int position )

把光标移至 position .

另请参阅 cursorPosition ().

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

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

另请参阅 selection (), addSelection (),和 removeSelection ().

[pure virtual] QString QAccessibleTextInterface:: text ( int startOffset , int endOffset ) const

Returns the text from startOffset to endOffsetstartOffset 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

Returns the text item of type boundaryType that is right after offset offset 并设置 startOffset and endOffset values to the start and end positions of that item; returns an empty string if there is no such an item. Sets startOffset and endOffset values to -1 on 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.

注意: this function can not take the cursor position into account. By convention an offset of -2 means that this function should use the cursor position as offset. Thus an offset of -2 must be converted to the cursor position before calling this function. An offset of -1 is used for the text length and custom implementations of this function have to return the result as if the length was passed in as offset.

[虚拟] QString QAccessibleTextInterface:: textAtOffset ( int offset , QAccessible::TextBoundaryType boundaryType , int * startOffset , int * endOffset ) const

Returns the text item of type boundaryType at offset offset 并设置 startOffset and endOffset values to the start and end positions of that item; returns an empty string if there is no such an item. Sets startOffset and endOffset values to -1 on 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.

注意: this function can not take the cursor position into account. By convention an offset of -2 means that this function should use the cursor position as offset. Thus an offset of -2 must be converted to the cursor position before calling this function. An offset of -1 is used for the text length and custom implementations of this function have to return the result as if the length was passed in as offset.

[虚拟] QString QAccessibleTextInterface:: textBeforeOffset ( int offset , QAccessible::TextBoundaryType boundaryType , int * startOffset , int * endOffset ) const

Returns the text item of type boundaryType that is close to offset offset 并设置 startOffset and endOffset values to the start and end positions of that item; returns an empty string if there is no such an item. Sets startOffset and endOffset values to -1 on 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.

注意: this function can not take the cursor position into account. By convention an offset of -2 means that this function should use the cursor position as offset. Thus an offset of -2 must be converted to the cursor position before calling this function. An offset of -1 is used for the text length and custom implementations of this function have to return the result as if the length was passed in as offset.