Gang:

The doc shows this code as part of inserting a custom object into a 
QTextDocument.

     QTextCursor cursor = textEdit->textCursor();
     cursor.insertText(QString(QChar::ObjectReplacementCharacter), 
svgCharFormat);
     textEdit->setTextCursor(cursor);

But, svgCharFormat now becomes the "current format" of the cursor
and is applied to any subsequent text I type into the textEdit.

How do I stop that?
How do I constrain svgCharFormat to my intended range
which is just the QChar::ObjectReplacementCharacter?

I tried appending a space:

    cursor.insertText(" ",QTextCharFormat());

which works until (by typing into the textEdit) I delete that space.

It also appears that my custom format, applied to the QChar::ObjectReplacementCharacter
is somewhat fragile and can be lost by editing the surrounding text.

But, that format appears to be the only place where I can add descriptive
information about my object using the setProperty system.

Is this the best way to add custom objects to a QTextDocument?

Thanks.

Bill
_______________________________________________
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest

Reply via email to