QTextEdit: How to create nested lists starting on level 2?

  • Hi,

    I'm desperately trying to create a QTextDocument with the following structure using the QTextCursor interface.

    * level two
    * level one

    So basically I want the list to start one level 2 and then continue one level 1.

    The problem seems to be that it is not possible to create a sub-list on an empty list-item. The following code will create a visually correct item on the second level, but the structure of QDocument shows that it is in fact still on the first level. Only indented twice.

    QTextListFormat listFormat;

    // First level

    // Second level

    If anyone has ideas how to implement that, please let me know!


  • It looks like there is actually no way to do that with QDocument. I ended up reimplementing this behavior myself.

Log in to reply

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