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

    上一话题

    QTextObject

    下一话题

    QTextFrame.iterator

    QTextFrame

    继承者: QTextTable

    详细描述

    PySide.QtGui.QTextFrame class represents a frame in a PySide.QtGui.QTextDocument .

    Text frames provide structure for the text in a document. They are used as generic containers for other document elements. Frames are usually created by using QTextCursor.insertFrame() .

    Frames can be used to create hierarchical structures in rich text documents. Each document has a root frame ( QTextDocument.rootFrame() ), and each frame beneath the root frame has a parent frame and a (possibly empty) list of child frames. The parent frame can be found with PySide.QtGui.QTextFrame.parentFrame() ,和 PySide.QtGui.QTextFrame.childFrames() function provides a list of child frames.

    Each frame contains at least one text block to enable text cursors to insert new document elements within. As a result, the QTextFrame.iterator class is used to traverse both the blocks and child frames within a given frame. The first and last child elements in the frame can be found with PySide.QtGui.QTextFrame.begin() and PySide.QtGui.QTextFrame.end() .

    A frame also has a format (specified using PySide.QtGui.QTextFrameFormat ) which can be set with PySide.QtGui.QTextObject.setFormat() and read with PySide.QtGui.QTextObject.format() .

    Text cursors can be obtained that point to the first and last valid cursor positions within a frame; use the PySide.QtGui.QTextFrame.firstCursorPosition() and PySide.QtGui.QTextFrame.lastCursorPosition() functions for this. The frame's extent in the document can be found with PySide.QtGui.QTextFrame.firstPosition() and PySide.QtGui.QTextFrame.lastPosition() .

    You can iterate over a frame's contents using the QTextFrame.iterator class: this provides read-only access to its internal list of text blocks and child frames.

    class PySide.QtGui. QTextFrame ( doc )
    参数: doc PySide.QtGui.QTextDocument

    Creates a new empty frame for the text document .

    PySide.QtGui.QTextFrame. __iter__ ( )
    返回类型: PyObject
    PySide.QtGui.QTextFrame. begin ( )
    返回类型: PySide.QtGui.QTextFrame::iterator

    Returns an iterator pointing to the first document element inside the frame. Please see the document STL-style-Iterators 了解更多信息。

    PySide.QtGui.QTextFrame. childFrames ( )
    返回类型:

    Returns a (possibly empty) list of the frame's child frames.

    PySide.QtGui.QTextFrame. end ( )
    返回类型: PySide.QtGui.QTextFrame::iterator

    Returns an iterator pointing to the position past the last document element inside the frame. Please see the document STL 样式迭代器 了解更多信息。

    PySide.QtGui.QTextFrame. firstCursorPosition ( )
    返回类型: PySide.QtGui.QTextCursor

    Returns the first cursor position inside the frame.

    PySide.QtGui.QTextFrame. firstPosition ( )
    返回类型: PySide.QtCore.int

    Returns the first document position inside the frame.

    PySide.QtGui.QTextFrame. frameFormat ( )
    返回类型: PySide.QtGui.QTextFrameFormat

    Returns the frame's format.

    PySide.QtGui.QTextFrame. lastCursorPosition ( )
    返回类型: PySide.QtGui.QTextCursor

    Returns the last cursor position inside the frame.

    PySide.QtGui.QTextFrame. lastPosition ( )
    返回类型: PySide.QtCore.int

    Returns the last document position inside the frame.

    PySide.QtGui.QTextFrame. parentFrame ( )
    返回类型: PySide.QtGui.QTextFrame

    Returns the frame's parent frame. If the frame is the root frame of a document, this will return 0.

    PySide.QtGui.QTextFrame. setFrameFormat ( format )
    参数: format PySide.QtGui.QTextFrameFormat

    Sets the frame's format .