QTextFrame¶
The
QTextFrame
class represents a frame in aQTextDocument
. More…
Inherited by: QTextTable
Synopsis¶
Functions¶
def
__iter__
()def
begin
()def
childFrames
()def
end
()def
firstCursorPosition
()def
firstPosition
()def
frameFormat
()def
lastCursorPosition
()def
lastPosition
()def
parentFrame
()def
setFrameFormat
(format)
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 withparentFrame()
, and thechildFrames()
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 withbegin()
andend()
.A frame also has a format (specified using
QTextFrameFormat
) which can be set withsetFormat()
and read withformat()
.Text cursors can be obtained that point to the first and last valid cursor positions within a frame; use the
firstCursorPosition()
andlastCursorPosition()
functions for this. The frame’s extent in the document can be found withfirstPosition()
andlastPosition()
.You can iterate over a frame’s contents using the
iterator
class: this provides read-only access to its internal list of text blocks and child frames.See also
- class PySide2.QtGui.QTextFrame(doc)¶
- param doc:
Creates a new empty frame for the text
document
.
- PySide2.QtGui.QTextFrame.__iter__()¶
- Return type:
object
- PySide2.QtGui.QTextFrame.begin()¶
- Return type:
Returns an iterator pointing to the first document element inside the frame. Please see the document STL-style-Iterators for more information.
See also
- PySide2.QtGui.QTextFrame.childFrames()¶
- Return type:
Returns a (possibly empty) list of the frame’s child frames.
See also
- PySide2.QtGui.QTextFrame.end()¶
- Return type:
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
- PySide2.QtGui.QTextFrame.firstCursorPosition()¶
- Return type:
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:
Returns the frame’s format.
See also
- PySide2.QtGui.QTextFrame.lastCursorPosition()¶
- Return type:
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:
Returns the frame’s parent frame. If the frame is the root frame of a document, this will return 0.
See also
- PySide2.QtGui.QTextFrame.setFrameFormat(format)¶
- Parameters:
format –
PySide2.QtGui.QTextFrameFormat
Sets the frame’s
format
.See also
© 2022 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.