Logo Search packages:      
Sourcecode: qt4-x11 version File versions  Download package

void QTextCursor::insertImage ( const QTextImageFormat format,
QTextFrameFormat::Position  alignment 
)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Since:
4.2

Inserts the image defined by the given format at the cursor's current position with the specified alignment.

See also:
position()

Definition at line 2126 of file qtextcursor.cpp.

References QTextObject::objectIndex(), QTextFormat::setObjectIndex(), and QTextFrameFormat::setPosition().

Referenced by insertImage().

{
    if (!d || !d->priv)
        return;

    QTextFrameFormat ffmt;
    ffmt.setPosition(alignment);
    QTextObject *obj = d->priv->createObject(ffmt);

    QTextImageFormat fmt = format;
    fmt.setObjectIndex(obj->objectIndex());

    d->priv->beginEditBlock();
    d->remove();
    const int idx = d->priv->formatCollection()->indexForFormat(fmt);
    d->priv->insert(d->position, QString(QChar(QChar::ObjectReplacementCharacter)), idx);
    d->priv->endEditBlock();
}

Here is the call graph for this function:

Here is the caller graph for this function:


Generated by  Doxygen 1.6.0   Back to index