[Interest] My next QText* issue.
Bill Crocker
william.crocker at analog.com
Thu Jan 14 13:48:11 CET 2016
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
More information about the Interest
mailing list