CopperSpice API  1.9.1
QTextFrame Class Reference

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

Inheritance diagram for QTextFrame:
QTextObject QObject QTextTable

Classes

class  iterator
 The QTextFrame::iterator class provides an iterator for reading the contents of a QTextFrame More...
 

Public Methods

 QTextFrame (QTextDocument *document)
 
 ~QTextFrame ()
 
iterator begin () const
 
QList< QTextFrame * > childFrames () const
 
iterator end () const
 
QTextCursor firstCursorPosition () const
 
int firstPosition () const
 
QTextFrameFormat frameFormat () const
 
QTextCursor lastCursorPosition () const
 
int lastPosition () const
 
QTextFrame * parentFrame () const
 
void setFrameFormat (const QTextFrameFormat &format)
 
- Public Methods inherited from QTextObject
QTextDocumentdocument () const
 
QTextFormat format () const
 
int formatIndex () const
 
int objectIndex () const
 
- Public Methods inherited from QObject
 QObject (QObject *parent=nullptr)
 
 ~QObject ()
 
bool blockSignals (bool block)
 
const QList< QObject * > & children () const
 
bool connect (const QObject *sender, const QString &signalMethod, const QString &location, const QString &slotMethod, Qt::ConnectionType type=Qt::AutoConnection)
 
bool connect (const QObject *sender, const QString &signalMethod, const QString &slotMethod, Qt::ConnectionType type=Qt::AutoConnection)
 
bool disconnect (const QObject *receiver, const QString &slotMethod=QString ()) const
 
bool disconnect (const QString &signalMethod, const QString &location, const QObject *receiver=nullptr, const QString &slotMethod=QString ()) const
 
bool disconnect (const QString &signalMethod=QString (), const QObject *receiver=nullptr, const QString &slotMethod=QString ()) const
 
void dumpObjectInfo ()
 
void dumpObjectTree ()
 
QList< QStringdynamicPropertyNames () const
 
virtual bool event (QEvent *event)
 
virtual bool eventFilter (QObject *watched, QEvent *event)
 
template<typename T >
findChild (const QString &childName=QString ()) const
 
template<class T >
QList< T > findChildren (const QRegularExpression &regExp, Qt::FindChildOptions options=Qt::FindChildrenRecursively) const
 
template<class T >
QList< T > findChildren (const QString &childName=QString (), Qt::FindChildOptions options=Qt::FindChildrenRecursively) const
 
bool inherits (const QString &className) const
 
void installEventFilter (QObject *filterObj)
 
bool isWidgetType () const
 
bool isWindowType () const
 
void killTimer (int id)
 
const QMetaObjectmetaObject () const
 
void moveToThread (QThread *targetThread)
 
QString objectName () const
 
QObject * parent () const
 
template<class T = QVariant>
property (const QString &name) const
 
void removeEventFilter (QObject *obj)
 
void setObjectName (const QString &name)
 
void setParent (QObject *parent)
 
bool setProperty (const QString &name, const QVariant &value)
 
bool signalsBlocked () const
 
int startTimer (int interval, Qt::TimerType timerType=Qt::CoarseTimer)
 
QThreadthread () const
 

Additional Inherited Members

- Public Signals inherited from QObject
void destroyed (QObject *obj=nullptr)
 
void objectNameChanged (const QString &objectName)
 
- Public Slots inherited from QObject
void deleteLater ()
 
- Static Public Methods inherited from QObject
static bool connect (const QObject *sender, const QMetaMethod &signalMethod, const QObject *receiver, const QMetaMethod &slotMethod, Qt::ConnectionType type=Qt::AutoConnection)
 
static bool connect (const QObject *sender, const QString &signalMethod, const QObject *receiver, const QString &slotMethod, Qt::ConnectionType type=Qt::AutoConnection, const QString &location=QString ())
 
static bool connect (const QObject *sender, const QString &signalMethod, const QString &location, const QObject *receiver, const QString &slotMethod, Qt::ConnectionType type=Qt::AutoConnection)
 
template<class Sender , class SignalClass , class... SignalArgs, class Receiver , class SlotClass , class... SlotArgs, class SlotReturn >
static bool connect (const Sender *sender, void (SignalClass::*signalMethod)(SignalArgs...), const Receiver *receiver, SlotReturn (SlotClass::*slotMethod)(SlotArgs...), Qt::ConnectionType type=Qt::AutoConnection)
 
template<class Sender , class SignalClass , class... SignalArgs, class Receiver , class T >
static bool connect (const Sender *sender, void (SignalClass::*signalMethod)(SignalArgs...), const Receiver *receiver, T slotLambda, Qt::ConnectionType type=Qt::AutoConnection)
 
static bool disconnect (const QObject *sender, const QMetaMethod &signalMethod, const QObject *receiver, const QMetaMethod &slotMethod)
 
static bool disconnect (const QObject *sender, const QString &signalMethod, const QObject *receiver, const QString &slotMethod)
 
static bool disconnect (const QObject *sender, const QString &signalMethod, const QString &location, const QObject *receiver, const QString &slotMethod)
 
static bool disconnect (const QObject *sender, std::nullptr_t, const QObject *receiver, std::nullptr_t)
 
template<class Sender , class SignalClass , class... SignalArgs, class Receiver , class SlotClass , class... SlotArgs, class SlotReturn >
static bool disconnect (const Sender *sender, void (SignalClass::*signalMethod)(SignalArgs...), const Receiver *receiver, SlotReturn (SlotClass::*slotMethod)(SlotArgs...))
 
template<class Sender , class SignalClass , class... SignalArgs, class Receiver >
static bool disconnect (const Sender *sender, void (SignalClass::*signalMethod)(SignalArgs...), const Receiver *receiver, std::nullptr_t slotMethod=nullptr)
 
template<class Sender , class SignalClass , class... SignalArgs, class Receiver , class T >
static bool disconnect (const Sender *sender, void (SignalClass::*signalMethod)(SignalArgs...), const Receiver *receiver, T slotMethod)
 
static QMetaObjectstaticMetaObject ()
 
static QString tr (const char *text, const char *comment=nullptr, std::optional< int > numArg=std::optional< int >())
 
- Protected Methods inherited from QTextObject
 QTextObject (QTextDocument *document)
 
 ~QTextObject ()
 
void setFormat (const QTextFormat &format)
 
- Protected Methods inherited from QObject
virtual void childEvent (QChildEvent *event)
 
virtual void connectNotify (const QMetaMethod &signalMethod) const
 
virtual void customEvent (QEvent *event)
 
virtual void disconnectNotify (const QMetaMethod &signalMethod) const
 
bool isSignalConnected (const QMetaMethod &signalMethod) const
 
int receivers (const QString &signal) const
 
QObject * sender () const
 
int senderSignalIndex () const
 
virtual void timerEvent (QTimerEvent *event)
 
- Properties inherited from QObject
 objectName
 

Detailed Description

The QTextFrame class represents a frame in a 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 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 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 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's extent in the document can be found with firstPosition() and 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.

See also
QTextCursor, QTextDocument

Constructor & Destructor Documentation

QTextFrame::QTextFrame ( QTextDocument document)
explicit

Creates a new empty frame for the text document.

QTextFrame::~QTextFrame ( )

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

Method Documentation

iterator QTextFrame::begin ( ) const

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

See also
end()
QList< QTextFrame * > QTextFrame::childFrames ( ) const

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

See also
parentFrame()
iterator QTextFrame::end ( ) const

Returns an iterator pointing to the position past the last document element inside the frame. Refer to STL style Iterators for more information.

See also
begin()
QTextCursor QTextFrame::firstCursorPosition ( ) const

Returns the first cursor position inside the frame.

See also
lastCursorPosition(), firstPosition(), lastPosition()
int QTextFrame::firstPosition ( ) const

Returns the first document position inside the frame.

See also
lastPosition(), firstCursorPosition(), lastCursorPosition()
QTextFrameFormat QTextFrame::frameFormat ( ) const
inline

Returns the frame's format.

See also
setFrameFormat()
QTextCursor QTextFrame::lastCursorPosition ( ) const

Returns the last cursor position inside the frame.

See also
firstCursorPosition(), firstPosition(), lastPosition()
int QTextFrame::lastPosition ( ) const

Returns the last document position inside the frame.

See also
firstPosition(), firstCursorPosition(), lastCursorPosition()
QTextFrame * QTextFrame::parentFrame ( ) const

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

See also
childFrames(), QTextDocument::rootFrame()
void QTextFrame::setFrameFormat ( const QTextFrameFormat format)
inline

Sets the frame's format.

See also
frameFormat()