summaryrefslogtreecommitdiffstats
path: root/examples/corelib/serialization
diff options
context:
space:
mode:
authorEdward Welbourne <edward.welbourne@qt.io>2023-06-14 16:53:27 +0200
committerEdward Welbourne <edward.welbourne@qt.io>2023-07-10 12:57:21 +0200
commite8a68b556cfa7f4e72faecb400db625608bf6460 (patch)
tree3f926b53417c3dd408f42e81c7a296741fcb74a1 /examples/corelib/serialization
parent98765cab974d02ccd364355a44dfeb8e8ef969d5 (diff)
XBEL streaming example: renumber xbelreader.cpp's snippet fragments
I'll be adding docs for parts currently lacking them; fix up the numbering first, to disentangle from "real" changes to docs. Pick-to: 6.6 6.5 Task-number: QTBUG-111228 Change-Id: Ia10f212626bf5ca9fab2b6ba6cf02dbd560a2f02 Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io>
Diffstat (limited to 'examples/corelib/serialization')
-rw-r--r--examples/corelib/serialization/streambookmarks/doc/src/qxmlstreambookmarks.qdoc4
-rw-r--r--examples/corelib/serialization/streambookmarks/xbelreader.cpp14
2 files changed, 12 insertions, 6 deletions
diff --git a/examples/corelib/serialization/streambookmarks/doc/src/qxmlstreambookmarks.qdoc b/examples/corelib/serialization/streambookmarks/doc/src/qxmlstreambookmarks.qdoc
index 4659a103cf..9c46c3d9b8 100644
--- a/examples/corelib/serialization/streambookmarks/doc/src/qxmlstreambookmarks.qdoc
+++ b/examples/corelib/serialization/streambookmarks/doc/src/qxmlstreambookmarks.qdoc
@@ -95,13 +95,13 @@
The \c readTitle() function reads the bookmark's title.
- \snippet serialization/streambookmarks/xbelreader.cpp 4
+ \snippet serialization/streambookmarks/xbelreader.cpp 5
The \c readSeparator() function creates a separator and sets its flags.
The text is set to 30 "0xB7", the HEX equivalent for period. The element
is then skipped using \l{QXmlStreamReader::}{skipCurrentElement()}.
- \snippet serialization/streambookmarks/xbelreader.cpp 5
+ \snippet serialization/streambookmarks/xbelreader.cpp 6
\section1 MainWindow Class Definition
diff --git a/examples/corelib/serialization/streambookmarks/xbelreader.cpp b/examples/corelib/serialization/streambookmarks/xbelreader.cpp
index 88ed256cb7..3f5e967499 100644
--- a/examples/corelib/serialization/streambookmarks/xbelreader.cpp
+++ b/examples/corelib/serialization/streambookmarks/xbelreader.cpp
@@ -68,6 +68,7 @@ void XbelReader::readXBEL()
}
//! [3]
+//! [4]
void XbelReader::readBookmark(QTreeWidgetItem *item)
{
Q_ASSERT(xml.isStartElement() && xml.name() == "bookmark"_L1);
@@ -85,16 +86,17 @@ void XbelReader::readBookmark(QTreeWidgetItem *item)
xml.skipCurrentElement();
}
}
-
//! [4]
+
+//! [5]
void XbelReader::readTitle(QTreeWidgetItem *item)
{
Q_ASSERT(xml.isStartElement() && xml.name() == "title"_L1);
item->setText(0, xml.readElementText());
}
-//! [4]
-
//! [5]
+
+//! [6]
void XbelReader::readSeparator(QTreeWidgetItem *item)
{
Q_ASSERT(xml.isStartElement() && xml.name() == "separator"_L1);
@@ -106,8 +108,9 @@ void XbelReader::readSeparator(QTreeWidgetItem *item)
separator->setText(0, dots);
xml.skipCurrentElement();
}
-//! [5]
+//! [6]
+//! [7]
void XbelReader::readFolder(QTreeWidgetItem *item)
{
Q_ASSERT(xml.isStartElement() && xml.name() == "folder"_L1);
@@ -129,10 +132,13 @@ void XbelReader::readFolder(QTreeWidgetItem *item)
xml.skipCurrentElement();
}
}
+//! [7]
+//! [8]
QTreeWidgetItem *XbelReader::createChildItem(QTreeWidgetItem *item)
{
QTreeWidgetItem *childItem = item ? new QTreeWidgetItem(item) : new QTreeWidgetItem(treeWidget);
childItem->setData(0, Qt::UserRole, xml.name().toString());
return childItem;
}
+//! [8]