Home | All Classes | Main Classes | Annotated | Grouped Classes | Functions |

# QTextFrame Class Reference

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

    #include <QTextFrame>

Inherits QTextObject.

Inherited by QTextTable.

- List of all members, including inherited members

### Public Types

- class iterator
- typedef Iterator

### Writable Properties

- 1 writable property inherited from QObject

### Public Functions

- QTextFrame ( QTextDocument * document )
- ~QTextFrame ()
- iterator begin () const
- QList<QTextFrame *> childFrames ()
- iterator end () const
- QTextCursor firstCursorPosition () const
- int firstPosition () const
- QTextFrameFormat format () const
- QTextCursor lastCursorPosition () const
- int lastPosition () const
- QTextFrame * parentFrame ()
- void setFormat ( const QTextFrameFormat & format )

- 3 public functions inherited from QTextObject
- 24 public functions inherited from QObject

### Public Slots

- 1 public slot inherited from QObject

### Signals

- 1 signal inherited from QObject

### Static Public Members

- 4 static public members inherited from QObject

### Protected Functions

- 1 protected function inherited from QTextObject
- 9 protected functions inherited from QObject

## Detailed Description

The QTextFrame class represents a frame in a QTextDocument.

Text frames provide structure for the text in a document.

Each frame in a document consists of a frame start character, QChar(0xFDD0), followed by the frame's contents, followed by a frame end character, QChar(0xFDD1). The character formats of the start and end character contain a reference to the frame object's objectIndex.

Frames can be used to create hierarchical documents. Each document has a root frame (QTextDocument::rootFrame()), and each frame (except for the root frame), has a parentFrame() and a (possibly empty) list of child frames. In addition to containing childFrames(), a frame can also contain QTextBlocks. A frame also has a format (setFormat(), format()). The positions in a frame are available from firstCursorPosition() and lastCursorPosition(), and the frame's position in the document from firstPosition() and lastPosition().

Frames are usually created using QTextCursor::insertFrame().

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

See also QTextCursor and QTextDocument.

## Member Type Documentation

### typedef QTextFrame::Iterator

Qt-style synonym for QTextFrame::iterator.

## Member Function Documentation

### QTextFrame::QTextFrame ( QTextDocument * document )

Creates a new empty frame for the text document.

### QTextFrame::~QTextFrame ()

Destroys this frame and removes it from the document's layout.

### iterator QTextFrame::begin () const

Returns an iterator pointing to the first child frame inside this frame.

See also end().

### QList<QTextFrame *> QTextFrame::childFrames ()

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

See also parentFrame().

### iterator QTextFrame::end () const

Returns an iterator pointing to the last child frame inside this frame.

See also begin().

### QTextCursor QTextFrame::firstCursorPosition () const

Returns the first cursor position inside the frame.

See also lastCursorPosition(), firstPosition(), and lastPosition().

### int QTextFrame::firstPosition () const

Returns the first document position inside the frame.

See also lastPosition(), firstCursorPosition(), and lastCursorPosition().

### QTextFrameFormat QTextFrame::format () const

Returns the frame's format.

See also setFormat().

### QTextCursor QTextFrame::lastCursorPosition () const

Returns the last cursor position inside the frame.

See also firstCursorPosition(), firstPosition(), and lastPosition().

### int QTextFrame::lastPosition () const

Returns the last document position inside the frame.

See also firstPosition(), firstCursorPosition(), and lastCursorPosition().

### QTextFrame * QTextFrame::parentFrame ()

Returns this frame's parent frame (which will be 0 if this frame is the QTextDocument::rootFrame()).

See also childFrames().

### void QTextFrame::setFormat ( const QTextFrameFormat & format )

Sets the frame's format.

See also format().