PySide6.QtGui.QAccessibleTextInterface¶
- class QAccessibleTextInterface¶
- The - QAccessibleTextInterfaceclass implements support for text handling. More…- Synopsis¶- Virtual methods¶- def - addSelection()
- def - attributes()
- def - characterCount()
- def - characterRect()
- def - cursorPosition()
- def - offsetAtPoint()
- def - selection()
- def - selectionCount()
- def - setSelection()
- def - text()
- def - textAtOffset()
 - Note - This documentation may contain snippets that were automatically translated from C++ to Python. We always welcome contributions to the snippet translation. If you see an issue with the translation, you can also let us know by creating a ticket on https:/bugreports.qt.io/projects/PYSIDE - Detailed Description¶- 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 - QAccessibleInterfaceand return their text as name (- text()with- Nameas type). The- QAccessibleTextInterfaceis 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.- abstract addSelection(startOffset, endOffset)¶
- Parameters:
- startOffset – int 
- endOffset – int 
 
 
 - Select the text from - startOffsetto- endOffset. The- startOffsetis the first character that will be selected. The- endOffsetis 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-- startOffsetcharacters long.- abstract attributes(offset, startOffset, endOffset)¶
- Parameters:
- offset – int 
- startOffset – int 
- endOffset – int 
 
- Return type:
- str 
 
 - Returns the text attributes at the position - offset. In addition the range of the attributes is returned in- startOffsetand- endOffset.- abstract characterCount()¶
- Return type:
- int 
 
 - Returns the length of the text (total size including spaces). - Returns the position and size of the character at position - offsetin screen coordinates.- abstract cursorPosition()¶
- Return type:
- int 
 
 - Returns the current cursor position. - See also - Returns the offset of the character at the - pointin screen coordinates.- abstract removeSelection(selectionIndex)¶
- Parameters:
- selectionIndex – int 
 
 - Clears the selection with index - selectionIndex.- abstract scrollToSubstring(startIndex, endIndex)¶
- Parameters:
- startIndex – int 
- endIndex – int 
 
 
 - Ensures that the text between - startIndexand- endIndexis visible.- abstract selection(selectionIndex, startOffset, endOffset)¶
- Parameters:
- selectionIndex – int 
- startOffset – int 
- endOffset – int 
 
 
 - Returns a selection. The size of the selection is returned in - startOffsetand- endOffset. If there is no selection both- startOffsetand- endOffsetare- None.- The accessibility APIs support multiple selections. For most widgets though, only one selection is supported with - selectionIndexequal to 0.- See also - abstract selectionCount()¶
- Return type:
- int 
 
 - Returns the number of selections in this text. - abstract setCursorPosition(position)¶
- Parameters:
- position – int 
 
 - Moves the cursor to - position.- See also - abstract setSelection(selectionIndex, startOffset, endOffset)¶
- Parameters:
- selectionIndex – int 
- startOffset – int 
- endOffset – int 
 
 
 - Set the selection - selectionIndexto the range from- startOffsetto- endOffset.- See also - abstract text(startOffset, endOffset)¶
- Parameters:
- startOffset – int 
- endOffset – int 
 
- Return type:
- str 
 
 - Returns the text from - startOffsetto- endOffset. The- startOffsetis the first character that will be returned. The- endOffsetis the first character that will not be returned.- textAfterOffset(offset, boundaryType, startOffset, endOffset)¶
- Parameters:
- offset – int 
- boundaryType – - TextBoundaryType
- startOffset – int 
- endOffset – int 
 
- Return type:
- str 
 
 - Returns the text item of type - boundaryTypethat is right after offset- offsetand sets- startOffsetand- endOffsetvalues to the start and end positions of that item; returns an empty string if there is no such an item. Sets- startOffsetand- endOffsetvalues 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. - Note - this function can not take the cursor position into account. By convention an - offsetof -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.- textAtOffset(offset, boundaryType, startOffset, endOffset)¶
- Parameters:
- offset – int 
- boundaryType – - TextBoundaryType
- startOffset – int 
- endOffset – int 
 
- Return type:
- str 
 
 - Returns the text item of type - boundaryTypeat offset- offsetand sets- startOffsetand- endOffsetvalues to the start and end positions of that item; returns an empty string if there is no such an item. Sets- startOffsetand- endOffsetvalues 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. - Note - this function can not take the cursor position into account. By convention an - offsetof -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.- textBeforeOffset(offset, boundaryType, startOffset, endOffset)¶
- Parameters:
- offset – int 
- boundaryType – - TextBoundaryType
- startOffset – int 
- endOffset – int 
 
- Return type:
- str 
 
 - Returns the text item of type - boundaryTypethat is close to offset- offsetand sets- startOffsetand- endOffsetvalues to the start and end positions of that item; returns an empty string if there is no such an item. Sets- startOffsetand- endOffsetvalues 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. - Note - this function can not take the cursor position into account. By convention an - offsetof -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.