Say I have a structure like this:
class AAA
{
BBB bb_member;
double dbl_member;
....................
}
class BBB
{
int in
Here is what I would do :
First (as roop said), you shouldn't store the QTextEdit widget itself, but the underlying text document (QTextDocument). You can get it from the QTextEdit widget with QTextEdit::document().
QTextDocument* pTextDoc = m_textEdit->document();
Then, I would get the html string from this document and from this string, get a QByteArray :
QString MyText = pTextDoc->toHtml();
QByteArray TextAsByteArray = MyText.toUtf8();
Once you have a QByteArray object containing your document, you can use the << and >> operators.
For reading back the QByteArray, store it into a QString(see QString::fromUtf8()), and use QTextDocument::setHtml() to display the content into the QTextEdit widget.
UPDATE
Following jpalecek comment, I'm overcomplicating the solution. Once you have a QString containing your text document as HTML, you can use QString::operator<<() and QString::operator>>() without using a QByteArray.