PySide6.QtGui.QAccessibleTextInterface¶
- class QAccessibleTextInterface¶
The
QAccessibleTextInterfaceclass implements support for text handling.Details
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()withNameas type). TheQAccessibleTextInterfaceis 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.Synopsis¶
Virtual methods¶
def
addSelection()def
characterCount()def
characterRect()def
cursorPosition()def
offsetAtPoint()def
selectionCount()def
setSelection()def
text()
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
- abstract addSelection(startOffset, endOffset)¶
- Parameters:
startOffset – int
endOffset – int
Select the text from
startOffsettoendOffset. ThestartOffsetis the first character that will be selected. TheendOffsetis 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 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
startIndexandendIndexis visible.- 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 fromstartOffsettoendOffset.See also
selection()addSelection()removeSelection()- abstract text(startOffset, endOffset)¶
- Parameters:
startOffset – int
endOffset – int
- Return type:
str
Returns the text from
startOffsettoendOffset. ThestartOffsetis the first character that will be returned. TheendOffsetis the first character that will not be returned.