TextBoundaryFinder
Qt Base Class: QTextBoundaryFinder
Signature: QTextBoundaryFinder(self) -> None
QTextBoundaryFinder(self, other: PySide6.QtCore.QTextBoundaryFinder) -> None
QTextBoundaryFinder(self, type: PySide6.QtCore.QTextBoundaryFinder.BoundaryType, str: str, buffer: Optional[bytes] = None, bufferSize: int = 0) -> None
QTextBoundaryFinder(self, type: PySide6.QtCore.QTextBoundaryFinder.BoundaryType, string: str) -> None
Base classes
⋔ Inheritance diagram
graph TD
1473299856992["core.TextBoundaryFinder"]
1473243744208["QtCore.QTextBoundaryFinder"]
1473291690208["Shiboken.Object"]
140713234304496["builtins.object"]
1473243744208 --> 1473299856992
1473291690208 --> 1473243744208
140713234304496 --> 1473291690208
🛈 DocStrings
Bases: QTextBoundaryFinder
Way of finding Unicode text boundaries in a string.
Source code in prettyqt\core\textboundaryfinder.py
| class TextBoundaryFinder(QtCore.QTextBoundaryFinder):
"""Way of finding Unicode text boundaries in a string."""
def __init__(
self,
string_or_other: str | QtCore.QTextBoundaryFinder = "",
boundary_type: (
QtCore.QTextBoundaryFinder.BoundaryType | BoundaryTypeStr
) = "grapheme",
):
if isinstance(string_or_other, QtCore.QTextBoundaryFinder):
super().__init__(string_or_other)
else:
if isinstance(boundary_type, str):
typ = BOUNDARY_TYPES[boundary_type]
else:
typ = boundary_type
super().__init__(typ, string_or_other)
def __repr__(self):
return get_repr(self, self.string())
def __reduce__(self):
return type(self), (self.string(), self.type())
def __iter__(self):
pos = self.position()
self.setPosition(0)
p = 0
# if self.isAtBoundary():
# yield 0
while p != -1:
p = self.toNextBoundary()
if p != -1:
yield p
self.setPosition(pos)
def get_boundary_type(self) -> BoundaryTypeStr:
return BOUNDARY_TYPES.inverse[self.type()]
def get_boundary_reasons(self) -> list[BoundaryReasonStr]:
return BOUNDARY_REASONS.get_list(self.boundaryReasons())
|