Details
-
Task
-
Resolution: Fixed
-
P4: Low
-
None
-
None
-
3f40a8b5b (dev)
Description
This was mentioned here http://www.qtcentre.org/threads/62617-QTextList-constructor-question but I've discovered the same problem while trying to write an autotest for the new Markdown writer. Consider
QTextCursor cursor(document);
QTextList *list1 = cursor.createList(QTextListFormat::ListDecimal);
cursor.insertText("ListItem 1");
list1->add(cursor.block());
Now (from the perspective of the writer, later on) what do we expect QTextBlock block.textList()->itemNumber(block) to return? It defaults to zero. (And tst_QTextList::autoNumbering() seems to confirm that it is correct.) It doesn't seem right if it's the view's (or writer's) job to assume that zero should actually mean one. So I think maybe a starting number property should be added to QTextListFormat. It could default to 1, because most people start numbering their lists from 1 when writing documents, but then it's possible to get back the zero-based numbering by setting the style's starting number to 0. It would also be possible to make a new list but continue where a previous list left off. It's not very clear when it's permitted to extend an existing list (after inserting some intervening non-list material) and when it's not permitted, so being able to start a new list with a higher starting number could be a workaround for troublesome use cases.
Attachments
Issue Links
- relates to
-
QTBUG-104997 markdown writer doesn't correctly write blockquotes containing lists
- Reported
-
QTBUG-111707 markdown writer needs to add more newlines after (some) list items
- Reported
-
QTBUG-30407 QTextList does not support the "start" attribute for ordered lists
- Closed
For Gerrit Dashboard: QTBUG-65384 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
464347,5 | tst_QLabel: Combine setTextAndFormat; test markdown and list rendering | dev | qt/qtbase | Status: NEW | -1 | 0 |
460444,12 | Add QTextListFormat::start: html and markdown ordered list index offset | dev | qt/qtbase | Status: MERGED | +2 | 0 |