Deriving from QTextDocument



  • 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


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.