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. QTextEdit: How to create nested lists starting on level 2?
QtWS25 Last Chance

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

Scheduled Pinned Locked Moved General and Desktop
2 Posts 1 Posters 2.6k Views
  • 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.
  • C Offline
    C Offline
    conny
    wrote on last edited by
    #1

    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;
    listFormat.setStyle(QTextListFormat::ListDisc);

    // First level
    listFormat.setIndent(1);
    cursor.createList(listFormat);

    // Second level
    listFormat.setIndent(2);
    cursor.createList(listFormat);
    @

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

    Thanks!
    Conny

    1 Reply Last reply
    0
    • C Offline
      C Offline
      conny
      wrote on last edited by
      #2

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

      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