Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Deriving from QTextDocument
Qt 6.11 is out! See what's new in the release blog

Deriving from QTextDocument

Scheduled Pinned Locked Moved General and Desktop
1 Posts 1 Posters 1.1k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G Offline
    G Offline
    GrahamL
    wrote on last edited by
    #1

    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

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved