[Interest] Deriving from QTextDocument

Graham Labdon Graham.Labdon at avalonsciences.com
Thu Mar 8 12:49:21 CET 2012


Hi
I have a text editor application that allows the insertion of custom text objects; this works fine.
I have a class that derives from QTextDocument but does not add any functionality (yet).
I am setting the document for the text edit as follows

theDocument = new ASLTextDocument(this);
ui->textEdit->setDocument(theDocument);

In doing this my custom objects no longer get displayed - can anyone suggest why this might be the case?

I am inserting the custom object as follows -

   QStringList l = action->data().toStringList();
    const QTextCharFormat customCharFormat = customObjectManager.charFormat(currentFont(),l[1]);
    QTextCursor cursor = textCursor();
    QTextCharFormat oldFormat = cursor.charFormat();
    cursor.insertText(QString(QChar::ObjectReplacementCharacter),customCharFormat);
    cursor.setCharFormat(oldFormat);
    setTextCursor(cursor);

but it appears that the custom objects 'drawObject' and 'intrinsicSize' methods are being called

Thanks

Graham

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20120308/25adf347/attachment.html>


More information about the Interest mailing list