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

    上一话题

    QTextObjectInterface

    下一话题

    QTextInlineObject

    QTextLine

    概要

    函数

    详细描述

    PySide.QtGui.QTextLine class represents a line of text inside a PySide.QtGui.QTextLayout .

    A text line is usually created by QTextLayout.createLine() .

    After being created, the line can be filled using the PySide.QtGui.QTextLine.setLineWidth() or PySide.QtGui.QTextLine.setNumColumns() functions. A line has a number of attributes including the rectangle it occupies, PySide.QtGui.QTextLine.rect() , its coordinates, PySide.QtGui.QTextLine.x() and PySide.QtGui.QTextLine.y() , its PySide.QtGui.QTextLine.textLength() , PySide.QtGui.QTextLine.width() and PySide.QtGui.QTextLine.naturalTextWidth() , and its PySide.QtGui.QTextLine.ascent() and decent() relative to the text. The position of the cursor in terms of the line is available from PySide.QtGui.QTextLine.cursorToX() and its inverse from PySide.QtGui.QTextLine.xToCursor() . A line can be moved with PySide.QtGui.QTextLine.setPosition() .

    class PySide.QtGui. QTextLine
    class PySide.QtGui. QTextLine ( QTextLine )
    参数: QTextLine PySide.QtGui.QTextLine

    Creates an invalid line.

    PySide.QtGui.QTextLine. Edge
    常量 描述
    QTextLine.Leading  
    QTextLine.Trailing  
    PySide.QtGui.QTextLine. CursorPosition
    常量 描述
    QTextLine.CursorBetweenCharacters  
    QTextLine.CursorOnCharacter  
    PySide.QtGui.QTextLine. ascent ( )
    返回类型: PySide.QtCore.qreal

    Returns the line's ascent.

    PySide.QtGui.QTextLine. cursorToX ( cursorPos [ , edge=Leading ] )
    参数:
    返回类型:

    PyObject

    这是重载函数。

    PySide.QtGui.QTextLine. descent ( )
    返回类型: PySide.QtCore.qreal

    Returns the line's descent.

    PySide.QtGui.QTextLine. draw ( p , point [ , selection=0 ] )
    参数:
    PySide.QtGui.QTextLine. height ( )
    返回类型: PySide.QtCore.qreal

    Returns the line's height. This is equal to PySide.QtGui.QTextLine.ascent() + PySide.QtGui.QTextLine.descent() + 1 if leading is not included. If leading is included, this equals to PySide.QtGui.QTextLine.ascent() + PySide.QtGui.QTextLine.descent() + PySide.QtGui.QTextLine.leading() + 1.

    PySide.QtGui.QTextLine. horizontalAdvance ( )
    返回类型: PySide.QtCore.qreal

    Returns the horizontal advance of the text. The advance of the text is the distance from its position to the next position at which text would naturally be drawn.

    By adding the advance to the position of the text line and using this as the position of a second text line, you will be able to position the two lines side-by-side without gaps in-between.

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

    Returns true if this text line is valid; otherwise returns false.

    PySide.QtGui.QTextLine. layout_helper ( numGlyphs )
    参数: numGlyphs PySide.QtCore.int
    PySide.QtGui.QTextLine. leading ( )
    返回类型: PySide.QtCore.qreal

    Returns the line's leading.

    PySide.QtGui.QTextLine. leadingIncluded ( )
    返回类型: PySide.QtCore.bool

    Returns true if positive leading is included into the line's height; otherwise returns false.

    By default, leading is not included.

    PySide.QtGui.QTextLine. lineNumber ( )
    返回类型: PySide.QtCore.int

    Returns the position of the line in the text engine.

    PySide.QtGui.QTextLine. naturalTextRect ( )
    返回类型: PySide.QtCore.QRectF

    Returns the rectangle covered by the line.

    PySide.QtGui.QTextLine. naturalTextWidth ( )
    返回类型: PySide.QtCore.qreal

    Returns the width of the line that is occupied by text. This is always <= to PySide.QtGui.QTextLine.width() , and is the minimum width that could be used by layout() without changing the line break position.

    PySide.QtGui.QTextLine. position ( )
    返回类型: PySide.QtCore.QPointF

    Returns the line's position relative to the text layout's position.

    PySide.QtGui.QTextLine. rect ( )
    返回类型: PySide.QtCore.QRectF

    Returns the line's bounding rectangle.

    PySide.QtGui.QTextLine. setLeadingIncluded ( included )
    参数: included PySide.QtCore.bool

    Includes positive leading into the line's height if included is true; otherwise does not include leading.

    By default, leading is not included.

    Note that negative leading is ignored, it must be handled in the code using the text lines by letting the lines overlap.

    PySide.QtGui.QTextLine. setLineWidth ( width )
    参数: width PySide.QtCore.qreal

    Lays out the line with the given width . The line is filled from its starting position with as many characters as will fit into the line. In case the text cannot be split at the end of the line, it will be filled with additional characters to the next whitespace or end of the text.

    PySide.QtGui.QTextLine. setNumColumns ( columns )
    参数: columns PySide.QtCore.int

    Lays out the line. The line is filled from its starting position with as many characters as are specified by numColumns . In case the text cannot be split until numColumns characters, the line will be filled with as many characters to the next whitespace or end of the text.

    PySide.QtGui.QTextLine. setNumColumns ( columns , alignmentWidth )
    参数:
    • columns PySide.QtCore.int
    • alignmentWidth PySide.QtCore.qreal

    Lays out the line. The line is filled from its starting position with as many characters as are specified by numColumns . In case the text cannot be split until numColumns characters, the line will be filled with as many characters to the next whitespace or end of the text. The provided alignmentWidth is used as reference width for alignment.

    PySide.QtGui.QTextLine. setPosition ( pos )
    参数: pos PySide.QtCore.QPointF

    Moves the line to position pos .

    PySide.QtGui.QTextLine. textLength ( )
    返回类型: PySide.QtCore.int

    Returns the length of the text in the line.

    PySide.QtGui.QTextLine. textStart ( )
    返回类型: PySide.QtCore.int

    Returns the start of the line from the beginning of the string passed to the PySide.QtGui.QTextLayout .

    PySide.QtGui.QTextLine. width ( )
    返回类型: PySide.QtCore.qreal

    Returns the line's width as specified by the layout() function.

    PySide.QtGui.QTextLine. x ( )
    返回类型: PySide.QtCore.qreal

    Returns the line's x position.

    PySide.QtGui.QTextLine. xToCursor ( x [ , edge=CursorBetweenCharacters ] )
    参数:
    返回类型:

    PySide.QtCore.int

    Converts the x-coordinate x , to the nearest matching cursor position, depending on the cursor position type, cpos .

    PySide.QtGui.QTextLine. y ( )
    返回类型: PySide.QtCore.qreal

    Returns the line's y position.