Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-75589

need QTextList::parentList() API; associate continuation paragraphs with list items

    XMLWordPrintable

Details

    • Suggestion
    • Resolution: Unresolved
    • Not Evaluated
    • None
    • None
    • GUI: Text handling
    • None

    Description

      When we parse something like

      <ul><li>one<p>continuation</p></li><ul><li>one dot one</li></ul></ul>
      

      it's not easy to find out that "one dot one" is inside the first list: you can only see that it's indented further. (And which indent is most relevant BTW? We store several.) Assuming that the cursor is already on the "one dot one" line, I could just about solve it with code like this

              QTextCursor above(cursor);
              above.movePosition(QTextCursor::Up);
              if (above.currentList()) 
      ...
      

      except that the continuation paragraph is in the way, and it has also lost track of the fact that it "belongs to" the first list item.

      I'm trying to implement interactive changing of list nesting (as part of a general indent/outdent feature in the richtext example).

      If QTextList had a parentList() accessor, it would be a start towards solving this at least some of the time: if the cursor is on a list item, and I want to outdent it, I could check that the parent list is the one that the list item should be moved into (because it's already outdented).

      But this would not solve how to indent the current list item. You might need a new list, or you might need to move it into a list below, one that is already indented. But now let's say the current list item also has a continuation paragraph: we would need to change its indent too, unless it already knows which list item it belongs to. So, perhaps QTextBlock needs a parentList() accessor.

      Remembering syntactic structure is mainly relevant for HTML editing; but for markdown, it might be enough to just remember the indentation, and be able to rewrite the markdown on that basis.

      Attachments

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              esabraha Eskil Abrahamsen Blomfeldt
              srutledg Shawn Rutledge
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:

                Gerrit Reviews

                  There are no open Gerrit changes