[graphics/drawy/gsoc2026] src/gui/item: fix: bug with serializing ListStyleUndefined
Laurent Montel <[email protected]>
| Newsgroups | gmane.comp.kde.cvs |
|---|---|
| Message-ID | <[email protected]> |
Git commit a2cea631bebebd000c8342b5ccc29e12a90d5496 by Laurent Montel, on behalf of Abdelhadi Wael.
Committed on 06/08/2026 at 09:10.
Pushed by mlaurent into branch 'gsoc2026'.
fix: bug with serializing ListStyleUndefined
M +13 -3 src/gui/item/text.cpp
https://invent.kde.org/graphics/drawy/-/commit/a2cea631bebebd000c8342b5ccc29e12a90d5496
diff --git a/src/gui/item/text.cpp b/src/gui/item/text.cpp
index 84c13d22..50b65282 100644
--- a/src/gui/item/text.cpp
+++ b/src/gui/item/text.cpp
@@ -606,9 +606,19 @@ void TextItem::setProperty(const Property::Type propertyType, const Property new
blockFmt.setIndent(0);
cursor.mergeBlockFormat(blockFmt);
- QTextListFormat listFmt;
- listFmt.setStyle(style);
- cursor.createList(listFmt);
+ if (style != QTextListFormat::ListStyleUndefined) {
+ QTextListFormat listFmt;
+ listFmt.setStyle(style);
+ cursor.createList(listFmt);
+ } else {
+ QTextBlock block = m_document.firstBlock();
+ while (block.isValid()) {
+ if (QTextList *list = block.textList()) {
+ list->remove(block);
+ }
+ block = block.next();
+ }
+ }
cursor.mergeBlockCharFormat(cursor.charFormat());
break;
}