summaryrefslogtreecommitdiffstats
path: root/examples
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-14 14:12:21 +0200
commitf329934052a73ed996744b73aeaf103983e05202 (patch)
tree0ab1a3d0deb2e5bf215130295620ac3f2d643c84 /examples
parente4d9303a467b74eed1986fd3f7391500ff4ba0d7 (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. Task-number: QTBUG-111228 Change-Id: Ia10f212626bf5ca9fab2b6ba6cf02dbd560a2f02 Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io> (cherry picked from commit e8a68b556cfa7f4e72faecb400db625608bf6460)
Diffstat (limited to 'examples')
-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]