summaryrefslogtreecommitdiffstats
path: root/examples/corelib/serialization
diff options
context:
space:
mode:
authorEdward Welbourne <edward.welbourne@qt.io>2023-06-08 18:36:19 +0200
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2023-06-12 15:46:14 +0200
commit97f68cd3068587103c8b0a0ccdcd6e61431efc1e (patch)
tree19f4925d2fd7ec658a4906ccc0c0c59c671bd8c1 /examples/corelib/serialization
parentb610c7aa89dd6224fbf58983ad8c2a391b2a559e (diff)
XBEL examples: construct the text of the separators cleanly
Create the fixed string once and reuse it. Also give a name to the escape code that's its repeated character. Pick-to: 6.6 6.5 Task-number: QTBUG-111228 Change-Id: I3d6416070f1d5490ec137e251daff0e1637fb788 Reviewed-by: Konrad Kujawa <konrad.kujawa@qt.io> Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Diffstat (limited to 'examples/corelib/serialization')
-rw-r--r--examples/corelib/serialization/streambookmarks/xbelreader.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/examples/corelib/serialization/streambookmarks/xbelreader.cpp b/examples/corelib/serialization/streambookmarks/xbelreader.cpp
index 0e7f5f7ef1..1d0b013d4c 100644
--- a/examples/corelib/serialization/streambookmarks/xbelreader.cpp
+++ b/examples/corelib/serialization/streambookmarks/xbelreader.cpp
@@ -97,10 +97,12 @@ void XbelReader::readTitle(QTreeWidgetItem *item)
void XbelReader::readSeparator(QTreeWidgetItem *item)
{
Q_ASSERT(xml.isStartElement() && xml.name() == "separator"_L1);
+ constexpr char16_t midDot = u'\xB7';
+ static const QString dots(30, midDot);
QTreeWidgetItem *separator = createChildItem(item);
separator->setFlags(item ? item->flags() & ~Qt::ItemIsSelectable : Qt::ItemFlags{});
- separator->setText(0, QString(30, u'\xB7'));
+ separator->setText(0, dots);
xml.skipCurrentElement();
}
//! [5]