QTextFrame露

The QTextFrame class represents a frame in a QTextDocument . More鈥�

Inheritance diagram of PySide2.QtGui.QTextFrame

Inherited by: QTextTable

Synopsis露

Functions露

Detailed Description露

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 insertFrame() .

Frames can be used to create hierarchical structures in rich text documents. Each document has a root frame ( 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 parentFrame() , and the 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 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 begin() and end() .

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

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

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

class PySide2.QtGui.QTextFrame(doc)露

Creates a new empty frame for the text document .

PySide2.QtGui.QTextFrame.__iter__()露
Return type:

object

PySide2.QtGui.QTextFrame.begin()露
Return type:

PySide2.QtGui.QTextFrame.iterator

Returns an iterator pointing to the first document element inside the frame. Please see the document STL-style-Iterators for more information.

See also

end()

PySide2.QtGui.QTextFrame.childFrames()露
Return type:

Returns a (possibly empty) list of the frame鈥檚 child frames.

See also

parentFrame()

PySide2.QtGui.QTextFrame.end()露
Return type:

PySide2.QtGui.QTextFrame.iterator

Returns an iterator pointing to the position past the last document element inside the frame. Please see the document STL-Style Iterators for more information.

See also

begin()

PySide2.QtGui.QTextFrame.firstCursorPosition()露
Return type:

PySide2.QtGui.QTextCursor

Returns the first cursor position inside the frame.

PySide2.QtGui.QTextFrame.firstPosition()露
Return type:

int

Returns the first document position inside the frame.

PySide2.QtGui.QTextFrame.frameFormat()露
Return type:

PySide2.QtGui.QTextFrameFormat

Returns the frame鈥檚 format.

See also

setFrameFormat()

PySide2.QtGui.QTextFrame.lastCursorPosition()露
Return type:

PySide2.QtGui.QTextCursor

Returns the last cursor position inside the frame.

PySide2.QtGui.QTextFrame.lastPosition()露
Return type:

int

Returns the last document position inside the frame.

PySide2.QtGui.QTextFrame.parentFrame()露
Return type:

PySide2.QtGui.QTextFrame

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

PySide2.QtGui.QTextFrame.setFrameFormat(format)露
Parameters:

format 鈥� PySide2.QtGui.QTextFrameFormat

Sets the frame鈥檚 format .

See also

frameFormat()