Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Implementing a structured text editor in Qt



  • Hi all,

    I'm hoping to write a structured documentation editor using QTextEdit/QTextDocument. Unfortunately, this is one area where the normally stellar Qt docs can be a bit thin, so I'm hoping y'all can help me out with some things.

    • I need text blocks to remember what "type" they are, and a given type will always have the same block format. Changing the type changes the format, and the format is only ever driven by the type. Should I just store the type as a property, and manage the code to always try to set the appropriate format at the same time as the block type? Or can/should I generate my own QTextBlock objects (from createObject()) that can just point to the type's shared format?

    • Where can I add drawing code to "decorate" blocks/frames with extra information? (For example, I might want to display the block type in the margin next to each block.)

    • Is there a convenient place I could hook into to display interactive widgets around blocks as the user edits them?

    • How can I control rendering of bullet/numbered list styles? I want to draw the bullet at the start of the indent, not the end, so the left margins of blocks at the same level line up, and control the drawing of bullets.

    Thanks in advance for any help you can give!


Log in to reply