How to extract the text of custom text object format in QTextEdit
-
@JonB Emm,I use
QTextObjectInterface
is aim to show my own custom text object, and use the string property to control how to paint the object.Also i want to export the string to other using. -
I hava created a custom text object class derived from QTextObjectInterface.And I want to use QTextEdit::toPlainText to export the text.
Any help is appreciated! -
@Hanson
If you have aQTextObjectInterface
to allow drawing of something (right?), what do you expect the output to be forQTextEdit::toPlainText
? -
@JonB I set the string property of the custom text object, like this
And I want to export the string property.Or you have other method that can export this string.@Hanson
Hmm, never usedQTextObjectInterface
. The only documentation I can see for its text is the cryptic/terse:The data of a text object is usually stored in the QTextCharFormat using QTextCharFormat::setProperty(), and then retrieved with QTextCharFormat::property().
But I don't know if that has any relationship to how you would get that out into
QTextEdit::toPlainText()
:(If you/someone else cannot find any way to do this, I can only think you might copy the whole of the
QTextDocument
, replace yourQTextObjectInterface
node(s) with their plain text, and then export that document. Not nice, but.... -
@JonB Emm,I use
QTextObjectInterface
is aim to show my own custom text object, and use the string property to control how to paint the object.Also i want to export the string to other using. -