• PySide 模块
  • PySide.QtCore
  • 内容表

    上一话题

    Qt

    下一话题

    QRectF

    QTextBoundaryFinder

    详细描述

    PySide.QtCore.QTextBoundaryFinder class provides a way of finding Unicode text boundaries in a string.

    PySide.QtCore.QTextBoundaryFinder allows to find Unicode text boundaries in a string, similar to the Unicode text boundary specification (see http://www.unicode.org/reports/tr29/tr29-11.html ).

    PySide.QtCore.QTextBoundaryFinder can operate on a PySide.QtCore.QString in four possible modes depending on the value of BoundaryType .

    Units of Unicode characters that make up what the user thinks of as a character or basic unit of the language are here called Grapheme clusters. The two unicode characters ‘A' + diaeresis do for example form one grapheme cluster as the user thinks of them as one character, yet it is in this case represented by two unicode code points.

    Word boundaries are there to locate the start and end of what a language considers to be a word.

    Line break boundaries give possible places where a line break might happen and sentence boundaries will show the beginning and end of whole sentences.

    The first position in a string is always a valid boundary and refers to the position before the first character. The last position at the length of the string is also valid and refers to the position after the last character.

    class PySide.QtCore. QTextBoundaryFinder
    class PySide.QtCore. QTextBoundaryFinder ( type , string )
    class PySide.QtCore. QTextBoundaryFinder ( other )
    参数:

    Constructs an invalid PySide.QtCore.QTextBoundaryFinder 对象。

    创建 PySide.QtCore.QTextBoundaryFinder object of type operating on string .

    拷贝 PySide.QtCore.QTextBoundaryFinder 对象, other .

    PySide.QtCore.QTextBoundaryFinder. BoundaryReason
    常量 描述
    QTextBoundaryFinder.NotAtBoundary The boundary finder is not at a boundary position.
    QTextBoundaryFinder.StartWord The boundary finder is at the start of a word.
    QTextBoundaryFinder.EndWord The boundary finder is at the end of a word.
    PySide.QtCore.QTextBoundaryFinder. BoundaryType
    常量 描述
    QTextBoundaryFinder.Grapheme Finds a grapheme which is the smallest boundary. It including letters, punctation marks, numerals and more.
    QTextBoundaryFinder.Word Finds a word.
    QTextBoundaryFinder.Line Finds possible positions for breaking the text into multiple lines.
    QTextBoundaryFinder.Sentence Finds sentence boundaries. These include periods, question marks etc.
    PySide.QtCore.QTextBoundaryFinder. boundaryReasons ( )
    返回类型: PySide.QtCore.QTextBoundaryFinder.BoundaryReasons

    Returns the reasons for the boundary finder to have chosen the current position as a boundary.

    PySide.QtCore.QTextBoundaryFinder. isAtBoundary ( )
    返回类型: PySide.QtCore.bool

    Returns true if the object's PySide.QtCore.QTextBoundaryFinder.position() is currently at a valid text boundary.

    PySide.QtCore.QTextBoundaryFinder. isValid ( )
    返回类型: PySide.QtCore.bool

    Returns true if the text boundary finder is valid; otherwise returns false. A default PySide.QtCore.QTextBoundaryFinder is invalid.

    PySide.QtCore.QTextBoundaryFinder. position ( )
    返回类型: PySide.QtCore.int

    Returns the current position of the PySide.QtCore.QTextBoundaryFinder .

    The range is from 0 (the beginning of the string) to the length of the string inclusive.

    PySide.QtCore.QTextBoundaryFinder. setPosition ( position )
    参数: position PySide.QtCore.int

    Sets the current position of the PySide.QtCore.QTextBoundaryFinder to position .

    position is out of bounds, it will be bound to only valid positions. In this case, valid positions are from 0 to the length of the string inclusive.

    PySide.QtCore.QTextBoundaryFinder. string ( )
    返回类型: unicode

    Returns the string the PySide.QtCore.QTextBoundaryFinder object operates on.

    PySide.QtCore.QTextBoundaryFinder. toEnd ( )

    Moves the finder to the end of the string. This is equivalent to setPosition(string. length() ).

    PySide.QtCore.QTextBoundaryFinder. toNextBoundary ( )
    返回类型: PySide.QtCore.int

    Moves the PySide.QtCore.QTextBoundaryFinder to the next boundary position and returns that position.

    Returns -1 if there is no next boundary.

    PySide.QtCore.QTextBoundaryFinder. toPreviousBoundary ( )
    返回类型: PySide.QtCore.int

    Moves the PySide.QtCore.QTextBoundaryFinder to the previous boundary position and returns that position.

    Returns -1 if there is no previous boundary.

    PySide.QtCore.QTextBoundaryFinder. toStart ( )

    Moves the finder to the start of the string. This is equivalent to setPosition(0).

    PySide.QtCore.QTextBoundaryFinder. type ( )
    返回类型: PySide.QtCore.QTextBoundaryFinder.BoundaryType

    Returns the type of the PySide.QtCore.QTextBoundaryFinder .