summaryrefslogtreecommitdiffstats
path: root/examples/xml/streambookmarks
diff options
context:
space:
mode:
Diffstat (limited to 'examples/xml/streambookmarks')
-rw-r--r--examples/xml/streambookmarks/CMakeLists.txt37
-rw-r--r--examples/xml/streambookmarks/doc/images/xmlstreamexample-filemenu.pngbin9380 -> 0 bytes
-rw-r--r--examples/xml/streambookmarks/doc/images/xmlstreamexample-helpmenu.pngbin10856 -> 0 bytes
-rw-r--r--examples/xml/streambookmarks/doc/images/xmlstreamexample-screenshot.pngbin22323 -> 0 bytes
-rw-r--r--examples/xml/streambookmarks/doc/src/qxmlstreambookmarks.qdoc194
-rw-r--r--examples/xml/streambookmarks/jennifer.xbel69
-rw-r--r--examples/xml/streambookmarks/main.cpp64
-rw-r--r--examples/xml/streambookmarks/mainwindow.cpp189
-rw-r--r--examples/xml/streambookmarks/mainwindow.h82
-rw-r--r--examples/xml/streambookmarks/streambookmarks.pro15
-rw-r--r--examples/xml/streambookmarks/xbelreader.cpp187
-rw-r--r--examples/xml/streambookmarks/xbelreader.h97
-rw-r--r--examples/xml/streambookmarks/xbelwriter.cpp107
-rw-r--r--examples/xml/streambookmarks/xbelwriter.h75
14 files changed, 0 insertions, 1116 deletions
diff --git a/examples/xml/streambookmarks/CMakeLists.txt b/examples/xml/streambookmarks/CMakeLists.txt
deleted file mode 100644
index 891272ef7f..0000000000
--- a/examples/xml/streambookmarks/CMakeLists.txt
+++ /dev/null
@@ -1,37 +0,0 @@
-cmake_minimum_required(VERSION 3.16)
-project(streambookmarks LANGUAGES CXX)
-
-set(CMAKE_AUTOMOC ON)
-
-if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
-endif()
-
-set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/xml/streambookmarks")
-
-find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets Xml)
-
-qt_add_executable(streambookmarks
- main.cpp
- mainwindow.cpp mainwindow.h
- xbelreader.cpp xbelreader.h
- xbelwriter.cpp xbelwriter.h
-)
-
-set_target_properties(streambookmarks PROPERTIES
- WIN32_EXECUTABLE TRUE
- MACOSX_BUNDLE TRUE
-)
-
-target_link_libraries(streambookmarks PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Widgets
- Qt::Xml
-)
-
-install(TARGETS streambookmarks
- RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
- BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
- LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
-)
diff --git a/examples/xml/streambookmarks/doc/images/xmlstreamexample-filemenu.png b/examples/xml/streambookmarks/doc/images/xmlstreamexample-filemenu.png
deleted file mode 100644
index e074fb7c41..0000000000
--- a/examples/xml/streambookmarks/doc/images/xmlstreamexample-filemenu.png
+++ /dev/null
Binary files differ
diff --git a/examples/xml/streambookmarks/doc/images/xmlstreamexample-helpmenu.png b/examples/xml/streambookmarks/doc/images/xmlstreamexample-helpmenu.png
deleted file mode 100644
index 0dc4392b94..0000000000
--- a/examples/xml/streambookmarks/doc/images/xmlstreamexample-helpmenu.png
+++ /dev/null
Binary files differ
diff --git a/examples/xml/streambookmarks/doc/images/xmlstreamexample-screenshot.png b/examples/xml/streambookmarks/doc/images/xmlstreamexample-screenshot.png
deleted file mode 100644
index bbaa423061..0000000000
--- a/examples/xml/streambookmarks/doc/images/xmlstreamexample-screenshot.png
+++ /dev/null
Binary files differ
diff --git a/examples/xml/streambookmarks/doc/src/qxmlstreambookmarks.qdoc b/examples/xml/streambookmarks/doc/src/qxmlstreambookmarks.qdoc
deleted file mode 100644
index aa0ddd4991..0000000000
--- a/examples/xml/streambookmarks/doc/src/qxmlstreambookmarks.qdoc
+++ /dev/null
@@ -1,194 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:FDL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Free Documentation License Usage
-** Alternatively, this file may be used under the terms of the GNU Free
-** Documentation License version 1.3 as published by the Free Software
-** Foundation and appearing in the file included in the packaging of
-** this file. Please review the following information to ensure
-** the GNU Free Documentation License version 1.3 requirements
-** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-/*!
- \example streambookmarks
- \title QXmlStream Bookmarks Example
- \brief Demonstrates how to read and write to XBEL files.
- \ingroup xml-examples
-
- The QXmlStream Bookmarks example provides a reader for XML Bookmark
- Exchange Language (XBEL) files using Qt's QXmlStreamReader class
- for reading, and QXmlStreamWriter class for writing the files.
-
- \image xmlstreamexample-screenshot.png
-
- \section1 XbelWriter Class Definition
-
- The \c XbelWriter class contains a private instance of QXmlStreamWriter,
- which provides an XML writer with a streaming API. \c XbelWriter also
- has a reference to the QTreeWidget instance where the bookmark hierarchy
- is stored.
-
- \snippet streambookmarks/xbelwriter.h 0
-
- \section1 XbelWriter Class Implementation
-
- The \c XbelWriter constructor accepts a \a treeWidget to initialize within
- its definition. We enable \l{QXmlStreamWriter}'s auto-formatting property
- to ensure line-breaks and indentations are added automatically to empty
- sections between elements, increasing readability as the data is split into
- several lines.
-
- \snippet streambookmarks/xbelwriter.cpp 0
-
- The \c writeFile() function accepts a QIODevice object and sets it using
- \c setDevice(). This function then writes the document type
- definition(DTD), the start element, the version, and \c{treeWidget}'s
- top-level items.
-
- \snippet streambookmarks/xbelwriter.cpp 1
-
- The \c writeItem() function accepts a QTreeWidgetItem object and writes it
- to the stream, depending on its \c tagName, which can either be a "folder",
- "bookmark", or "separator".
-
- \snippet streambookmarks/xbelwriter.cpp 2
-
- \section1 XbelReader Class Definition
-
- The \c XbelReader contains a private instance of QXmlStreamReader, the
- companion class to QXmlStreamWriter. \c XbelReader also contains a
- reference to the QTreeWidget that is used to group the bookmarks according
- to their hierarchy.
-
- \snippet streambookmarks/xbelreader.h 0
-
- \section1 XbelReader Class Implementation
-
- The \c XbelReader constructor accepts a QTreeWidget to initialize the
- \c treeWidget within its definition. A QStyle object is used to set
- \c{treeWidget}'s style property. The \c folderIcon is set to QIcon::Normal
- mode where the pixmap is only displayed when the user is not interacting
- with the icon. The QStyle::SP_DirClosedIcon, QStyle::SP_DirOpenIcon, and
- QStyle::SP_FileIcon correspond to standard pixmaps that follow the style
- of your GUI.
-
- \snippet streambookmarks/xbelreader.cpp 0
-
- The \c read() function accepts a QIODevice and sets it using
- \l{QXmlStreamReader::}{setDevice()}. The actual process of reading only
- takes place if the file is a valid XBEL 1.0 file. Note that the XML input
- needs to be well-formed to be accepted by QXmlStreamReader. Otherwise, the
- \l{QXmlStreamReader::}{raiseError()} function is used to display an error
- message. Since the XBEL reader is only concerned with reading XML elements,
- it makes extensive use of the \l{QXmlStreamReader::}{readNextStartElement()}
- convenience function.
-
- \snippet streambookmarks/xbelreader.cpp 1
-
- The \c errorString() function is used if an error occurred, in order to
- obtain a description of the error complete with line and column number
- information.
-
- \snippet streambookmarks/xbelreader.cpp 2
-
- The \c readXBEL() function reads the name of a startElement and calls
- the appropriate function to read it, depending on whether if its a
- "folder", "bookmark" or "separator". Otherwise, it calls
- \l{QXmlStreamReader::}{skipCurrentElement()}. The Q_ASSERT() macro is used
- to provide a pre-condition for the function.
-
- \snippet streambookmarks/xbelreader.cpp 3
-
- The \c readTitle() function reads the bookmark's title.
-
- \snippet streambookmarks/xbelreader.cpp 4
-
- 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 streambookmarks/xbelreader.cpp 5
-
- \section1 MainWindow Class Definition
-
- The \c MainWindow class is a subclass of QMainWindow, with a
- \c File menu and a \c Help menu.
-
- \snippet streambookmarks/mainwindow.h 0
-
- \section1 MainWindow Class Implementation
-
- The \c MainWindow constructor instantiates the QTreeWidget object, \c
- treeWidget and sets its header with a QStringList object, \c labels.
- The constructor also invokes \c createActions() and \c createMenus()
- to set up the menus and their corresponding actions. The \c statusBar()
- is used to display the message "Ready" and the window's size is fixed
- to 480x320 pixels.
-
- \snippet streambookmarks/mainwindow.cpp 0
-
- The \c open() function enables the user to open an XBEL file using
- QFileDialog::getOpenFileName(). A warning message is displayed along
- with the \c fileName and \c errorString if the file cannot be read or
- if there is a parse error.
-
- \snippet streambookmarks/mainwindow.cpp 1
-
- The \c saveAs() function displays a QFileDialog, prompting the user for
- a \c fileName using QFileDialog::getSaveFileName(). Similar to the
- \c open() function, this function also displays a warning message if
- the file cannot be written to.
-
- \snippet streambookmarks/mainwindow.cpp 2
-
- The \c about() function displays a QMessageBox with a brief description
- of the example.
-
- \snippet streambookmarks/mainwindow.cpp 3
-
- In order to implement the \c open(), \c saveAs(), \c exit(), \c about()
- and \c aboutQt() functions, we connect them to QAction objects and
- add them to the \c fileMenu and \c helpMenu. The connections are as shown
- below:
-
- \snippet streambookmarks/mainwindow.cpp 5
-
- The \c createMenus() function creates the \c fileMenu and \c helpMenu
- and adds the QAction objects to them in order to create the menu shown
- in the screenshot below:
-
- \table
- \row
- \li \inlineimage xmlstreamexample-filemenu.png
- \li \inlineimage xmlstreamexample-helpmenu.png
- \endtable
-
- \snippet streambookmarks/mainwindow.cpp 5
-
- \section1 \c{main()} Function
-
- The \c main() function instantiates \c MainWindow and invokes the \c show()
- function.
-
- \snippet streambookmarks/main.cpp 0
-
- See the \l{http://pyxml.sourceforge.net/topics/xbel/}
- {XML Bookmark Exchange Language Resource Page} for more information
- about XBEL files.
-*/
diff --git a/examples/xml/streambookmarks/jennifer.xbel b/examples/xml/streambookmarks/jennifer.xbel
deleted file mode 100644
index 2501c118af..0000000000
--- a/examples/xml/streambookmarks/jennifer.xbel
+++ /dev/null
@@ -1,69 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE xbel>
-<xbel version="1.0">
- <folder folded="no">
- <title>Qt Resources</title>
- <bookmark href="http://qt.io/">
- <title>Qt home page</title>
- </bookmark>
- <bookmark href="https://www.qt.io/partners/">
- <title>Qt Partners</title>
- </bookmark>
- <bookmark href="https://www.qt.io/qt-training/">
- <title>Training</title>
- </bookmark>
- <bookmark href="http://doc.qt.io/">
- <title>Qt 5 documentation</title>
- </bookmark>
- <bookmark href="http://qt-project.org/faq/">
- <title>Frequently Asked Questions</title>
- </bookmark>
- <folder folded="yes">
- <title>Community Resources</title>
- <bookmark href="http://www.qtcentre.org/content/">
- <title>Qt Centre</title>
- </bookmark>
- <bookmark href="http://www.qtforum.org/">
- <title>QtForum.org</title>
- </bookmark>
- <bookmark href="http://digitalfanatics.org/projects/qt_tutorial/">
- <title>The Independent Qt Tutorial</title>
- </bookmark>
- <bookmark href="http://www.qtforum.de/">
- <title>German Qt Forum</title>
- </bookmark>
- <bookmark href="http://www.korone.net/">
- <title>Korean Qt Community Site</title>
- </bookmark>
- <bookmark href="http://prog.org.ru/">
- <title>Russian Qt Forum</title>
- </bookmark>
- </folder>
- </folder>
- <folder folded="no">
- <title>Online Dictionaries</title>
- <bookmark href="http://www.dictionary.com/">
- <title>Dictionary.com</title>
- </bookmark>
- <bookmark href="http://www.m-w.com/">
- <title>Merriam-Webster Online</title>
- </bookmark>
- <bookmark href="http://dictionary.cambridge.org/">
- <title>Cambridge Dictionaries Online</title>
- </bookmark>
- <bookmark href="http://www.onelook.com/">
- <title>OneLook Dictionary Search</title>
- </bookmark>
- <separator/>
- <bookmark href="http://dict.tu-chemnitz.de/">
- <title>TU Chemnitz German-English Dictionary</title>
- </bookmark>
- <separator/>
- <bookmark href="http://atilf.atilf.fr/tlf.htm">
- <title>Trésor de la Langue Française informatisé</title>
- </bookmark>
- <bookmark href="http://dictionnaires.atilf.fr/dictionnaires/ACADEMIE/">
- <title>Dictionnaire de l'Académie Française</title>
- </bookmark>
- </folder>
-</xbel>
diff --git a/examples/xml/streambookmarks/main.cpp b/examples/xml/streambookmarks/main.cpp
deleted file mode 100644
index 23a36183f7..0000000000
--- a/examples/xml/streambookmarks/main.cpp
+++ /dev/null
@@ -1,64 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QApplication>
-
-#include "mainwindow.h"
-
-//! [0]
-int main(int argc, char *argv[])
-{
- QApplication app(argc, argv);
- MainWindow mainWin;
- mainWin.show();
- mainWin.open();
- return app.exec();
-}
-//! [0]
diff --git a/examples/xml/streambookmarks/mainwindow.cpp b/examples/xml/streambookmarks/mainwindow.cpp
deleted file mode 100644
index d0e7bf30c9..0000000000
--- a/examples/xml/streambookmarks/mainwindow.cpp
+++ /dev/null
@@ -1,189 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtWidgets>
-
-#include "mainwindow.h"
-#include "xbelreader.h"
-#include "xbelwriter.h"
-
-//! [0]
-MainWindow::MainWindow()
-{
- QStringList labels;
- labels << tr("Title") << tr("Location");
-
- treeWidget = new QTreeWidget;
- treeWidget->header()->setSectionResizeMode(QHeaderView::Stretch);
- treeWidget->setHeaderLabels(labels);
-#if !defined(QT_NO_CONTEXTMENU) && !defined(QT_NO_CLIPBOARD)
- treeWidget->setContextMenuPolicy(Qt::CustomContextMenu);
- connect(treeWidget, &QWidget::customContextMenuRequested,
- this, &MainWindow::onCustomContextMenuRequested);
-#endif
- setCentralWidget(treeWidget);
-
- createMenus();
-
- statusBar()->showMessage(tr("Ready"));
-
- setWindowTitle(tr("QXmlStream Bookmarks"));
- const QSize availableSize = screen()->availableGeometry().size();
- resize(availableSize.width() / 2, availableSize.height() / 3);
-}
-//! [0]
-
-#if !defined(QT_NO_CONTEXTMENU) && !defined(QT_NO_CLIPBOARD)
-void MainWindow::onCustomContextMenuRequested(const QPoint &pos)
-{
- const QTreeWidgetItem *item = treeWidget->itemAt(pos);
- if (!item)
- return;
- const QString url = item->text(1);
- QMenu contextMenu;
- QAction *copyAction = contextMenu.addAction(tr("Copy Link to Clipboard"));
- QAction *openAction = contextMenu.addAction(tr("Open"));
- QAction *action = contextMenu.exec(treeWidget->viewport()->mapToGlobal(pos));
- if (action == copyAction)
- QGuiApplication::clipboard()->setText(url);
- else if (action == openAction)
- QDesktopServices::openUrl(QUrl(url));
-}
-#endif // !QT_NO_CONTEXTMENU && !QT_NO_CLIPBOARD
-
-//! [1]
-void MainWindow::open()
-{
- QString fileName =
- QFileDialog::getOpenFileName(this, tr("Open Bookmark File"),
- QDir::currentPath(),
- tr("XBEL Files (*.xbel *.xml)"));
- if (fileName.isEmpty())
- return;
-
- treeWidget->clear();
-
-
- QFile file(fileName);
- if (!file.open(QFile::ReadOnly | QFile::Text)) {
- QMessageBox::warning(this, tr("QXmlStream Bookmarks"),
- tr("Cannot read file %1:\n%2.")
- .arg(QDir::toNativeSeparators(fileName),
- file.errorString()));
- return;
- }
-
- XbelReader reader(treeWidget);
- if (!reader.read(&file)) {
- QMessageBox::warning(this, tr("QXmlStream Bookmarks"),
- tr("Parse error in file %1:\n\n%2")
- .arg(QDir::toNativeSeparators(fileName),
- reader.errorString()));
- } else {
- statusBar()->showMessage(tr("File loaded"), 2000);
- }
-
-}
-//! [1]
-
-//! [2]
-void MainWindow::saveAs()
-{
- QString fileName =
- QFileDialog::getSaveFileName(this, tr("Save Bookmark File"),
- QDir::currentPath(),
- tr("XBEL Files (*.xbel *.xml)"));
- if (fileName.isEmpty())
- return;
-
- QFile file(fileName);
- if (!file.open(QFile::WriteOnly | QFile::Text)) {
- QMessageBox::warning(this, tr("QXmlStream Bookmarks"),
- tr("Cannot write file %1:\n%2.")
- .arg(QDir::toNativeSeparators(fileName),
- file.errorString()));
- return;
- }
-
- XbelWriter writer(treeWidget);
- if (writer.writeFile(&file))
- statusBar()->showMessage(tr("File saved"), 2000);
-}
-//! [2]
-
-//! [3]
-void MainWindow::about()
-{
- QMessageBox::about(this, tr("About QXmlStream Bookmarks"),
- tr("The <b>QXmlStream Bookmarks</b> example demonstrates how to use Qt's "
- "QXmlStream classes to read and write XML documents."));
-}
-//! [3]
-
-//! [5]
-void MainWindow::createMenus()
-{
- QMenu *fileMenu = menuBar()->addMenu(tr("&File"));
- QAction *openAct = fileMenu->addAction(tr("&Open..."), this, &MainWindow::open);
- openAct->setShortcuts(QKeySequence::Open);
-
- QAction *saveAsAct = fileMenu->addAction(tr("&Save As..."), this, &MainWindow::saveAs);
- saveAsAct->setShortcuts(QKeySequence::SaveAs);
-
- QAction *exitAct = fileMenu->addAction(tr("E&xit"), this, &QWidget::close);
- exitAct->setShortcuts(QKeySequence::Quit);
-
- menuBar()->addSeparator();
-
- QMenu *helpMenu = menuBar()->addMenu(tr("&Help"));
- helpMenu->addAction(tr("&About"), this, &MainWindow::about);
- helpMenu->addAction(tr("About &Qt"), qApp, &QCoreApplication::quit);
-}
-//! [5]
diff --git a/examples/xml/streambookmarks/mainwindow.h b/examples/xml/streambookmarks/mainwindow.h
deleted file mode 100644
index fbdc1e0c62..0000000000
--- a/examples/xml/streambookmarks/mainwindow.h
+++ /dev/null
@@ -1,82 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef MAINWINDOW_H
-#define MAINWINDOW_H
-
-#include <QMainWindow>
-
-QT_BEGIN_NAMESPACE
-class QTreeWidget;
-QT_END_NAMESPACE
-
-//! [0]
-class MainWindow : public QMainWindow
-{
- Q_OBJECT
-
-public:
- MainWindow();
-
-public slots:
- void open();
- void saveAs();
- void about();
-#if !defined(QT_NO_CONTEXTMENU) && !defined(QT_NO_CLIPBOARD)
- void onCustomContextMenuRequested(const QPoint &pos);
-#endif
-private:
- void createMenus();
-
- QTreeWidget *treeWidget;
-};
-//! [0]
-
-#endif
diff --git a/examples/xml/streambookmarks/streambookmarks.pro b/examples/xml/streambookmarks/streambookmarks.pro
deleted file mode 100644
index 8c2fc3fa19..0000000000
--- a/examples/xml/streambookmarks/streambookmarks.pro
+++ /dev/null
@@ -1,15 +0,0 @@
-HEADERS = mainwindow.h \
- xbelreader.h \
- xbelwriter.h
-SOURCES = main.cpp \
- mainwindow.cpp \
- xbelreader.cpp \
- xbelwriter.cpp
-QT += xml widgets
-requires(qtConfig(filedialog))
-
-EXAMPLE_FILES = frank.xbel jennifer.xbel
-
-# install
-target.path = $$[QT_INSTALL_EXAMPLES]/xml/streambookmarks
-INSTALLS += target
diff --git a/examples/xml/streambookmarks/xbelreader.cpp b/examples/xml/streambookmarks/xbelreader.cpp
deleted file mode 100644
index cdaa247e46..0000000000
--- a/examples/xml/streambookmarks/xbelreader.cpp
+++ /dev/null
@@ -1,187 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtWidgets>
-
-#include "xbelreader.h"
-
-//! [0]
-XbelReader::XbelReader(QTreeWidget *treeWidget)
- : treeWidget(treeWidget)
-{
- QStyle *style = treeWidget->style();
-
- folderIcon.addPixmap(style->standardPixmap(QStyle::SP_DirClosedIcon),
- QIcon::Normal, QIcon::Off);
- folderIcon.addPixmap(style->standardPixmap(QStyle::SP_DirOpenIcon),
- QIcon::Normal, QIcon::On);
- bookmarkIcon.addPixmap(style->standardPixmap(QStyle::SP_FileIcon));
-}
-//! [0]
-
-//! [1]
-bool XbelReader::read(QIODevice *device)
-{
- xml.setDevice(device);
-
- if (xml.readNextStartElement()) {
- if (xml.name() == QLatin1String("xbel")
- && xml.attributes().value(versionAttribute()) == QLatin1String("1.0")) {
- readXBEL();
- } else {
- xml.raiseError(QObject::tr("The file is not an XBEL version 1.0 file."));
- }
- }
-
- return !xml.error();
-}
-//! [1]
-
-//! [2]
-QString XbelReader::errorString() const
-{
- return QObject::tr("%1\nLine %2, column %3")
- .arg(xml.errorString())
- .arg(xml.lineNumber())
- .arg(xml.columnNumber());
-}
-//! [2]
-
-//! [3]
-void XbelReader::readXBEL()
-{
- Q_ASSERT(xml.isStartElement() && xml.name() == QLatin1String("xbel"));
-
- while (xml.readNextStartElement()) {
- if (xml.name() == QLatin1String("folder"))
- readFolder(0);
- else if (xml.name() == QLatin1String("bookmark"))
- readBookmark(0);
- else if (xml.name() == QLatin1String("separator"))
- readSeparator(0);
- else
- xml.skipCurrentElement();
- }
-}
-//! [3]
-
-//! [4]
-void XbelReader::readTitle(QTreeWidgetItem *item)
-{
- Q_ASSERT(xml.isStartElement() && xml.name() == QLatin1String("title"));
-
- QString title = xml.readElementText();
- item->setText(0, title);
-}
-//! [4]
-
-//! [5]
-void XbelReader::readSeparator(QTreeWidgetItem *item)
-{
- Q_ASSERT(xml.isStartElement() && xml.name() == QLatin1String("separator"));
-
- QTreeWidgetItem *separator = createChildItem(item);
- separator->setFlags(item->flags() & ~Qt::ItemIsSelectable);
- separator->setText(0, QString(30, u'\xB7'));
- xml.skipCurrentElement();
-}
-//! [5]
-
-void XbelReader::readFolder(QTreeWidgetItem *item)
-{
- Q_ASSERT(xml.isStartElement() && xml.name() == QLatin1String("folder"));
-
- QTreeWidgetItem *folder = createChildItem(item);
- bool folded = (xml.attributes().value(foldedAttribute()) != QLatin1String("no"));
- folder->setExpanded(!folded);
-
- while (xml.readNextStartElement()) {
- if (xml.name() == QLatin1String("title"))
- readTitle(folder);
- else if (xml.name() == QLatin1String("folder"))
- readFolder(folder);
- else if (xml.name() == QLatin1String("bookmark"))
- readBookmark(folder);
- else if (xml.name() == QLatin1String("separator"))
- readSeparator(folder);
- else
- xml.skipCurrentElement();
- }
-}
-
-void XbelReader::readBookmark(QTreeWidgetItem *item)
-{
- Q_ASSERT(xml.isStartElement() && xml.name() == QLatin1String("bookmark"));
-
- QTreeWidgetItem *bookmark = createChildItem(item);
- bookmark->setFlags(bookmark->flags() | Qt::ItemIsEditable);
- bookmark->setIcon(0, bookmarkIcon);
- bookmark->setText(0, QObject::tr("Unknown title"));
- bookmark->setText(1, xml.attributes().value(hrefAttribute()).toString());
-
- while (xml.readNextStartElement()) {
- if (xml.name() == QLatin1String("title"))
- readTitle(bookmark);
- else
- xml.skipCurrentElement();
- }
-}
-
-QTreeWidgetItem *XbelReader::createChildItem(QTreeWidgetItem *item)
-{
- QTreeWidgetItem *childItem;
- if (item) {
- childItem = new QTreeWidgetItem(item);
- } else {
- childItem = new QTreeWidgetItem(treeWidget);
- }
- childItem->setData(0, Qt::UserRole, xml.name().toString());
- return childItem;
-}
diff --git a/examples/xml/streambookmarks/xbelreader.h b/examples/xml/streambookmarks/xbelreader.h
deleted file mode 100644
index fd486a430f..0000000000
--- a/examples/xml/streambookmarks/xbelreader.h
+++ /dev/null
@@ -1,97 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef XBELREADER_H
-#define XBELREADER_H
-
-#include <QIcon>
-#include <QXmlStreamReader>
-
-QT_BEGIN_NAMESPACE
-class QTreeWidget;
-class QTreeWidgetItem;
-QT_END_NAMESPACE
-
-//! [0]
-class XbelReader
-{
-public:
-//! [1]
- XbelReader(QTreeWidget *treeWidget);
-//! [1]
-
- bool read(QIODevice *device);
-
- QString errorString() const;
-
- static inline QString versionAttribute() { return QStringLiteral("version"); }
- static inline QString hrefAttribute() { return QStringLiteral("href"); }
- static inline QString foldedAttribute() { return QStringLiteral("folded"); }
-
-private:
-//! [2]
- void readXBEL();
- void readTitle(QTreeWidgetItem *item);
- void readSeparator(QTreeWidgetItem *item);
- void readFolder(QTreeWidgetItem *item);
- void readBookmark(QTreeWidgetItem *item);
-
- QTreeWidgetItem *createChildItem(QTreeWidgetItem *item);
-
- QXmlStreamReader xml;
- QTreeWidget *treeWidget;
-//! [2]
-
- QIcon folderIcon;
- QIcon bookmarkIcon;
-};
-//! [0]
-
-#endif
diff --git a/examples/xml/streambookmarks/xbelwriter.cpp b/examples/xml/streambookmarks/xbelwriter.cpp
deleted file mode 100644
index 7cc16494e2..0000000000
--- a/examples/xml/streambookmarks/xbelwriter.cpp
+++ /dev/null
@@ -1,107 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtWidgets>
-
-#include "xbelwriter.h"
-#include "xbelreader.h"
-
-static inline QString yesValue() { return QStringLiteral("yes"); }
-static inline QString noValue() { return QStringLiteral("no"); }
-static inline QString titleElement() { return QStringLiteral("title"); }
-
-//! [0]
-XbelWriter::XbelWriter(const QTreeWidget *treeWidget)
- : treeWidget(treeWidget)
-{
- xml.setAutoFormatting(true);
-}
-//! [0]
-
-//! [1]
-bool XbelWriter::writeFile(QIODevice *device)
-{
- xml.setDevice(device);
-
- xml.writeStartDocument();
- xml.writeDTD(QStringLiteral("<!DOCTYPE xbel>"));
- xml.writeStartElement(QStringLiteral("xbel"));
- xml.writeAttribute(XbelReader::versionAttribute(), QStringLiteral("1.0"));
- for (int i = 0; i < treeWidget->topLevelItemCount(); ++i)
- writeItem(treeWidget->topLevelItem(i));
-
- xml.writeEndDocument();
- return true;
-}
-//! [1]
-
-//! [2]
-void XbelWriter::writeItem(const QTreeWidgetItem *item)
-{
- QString tagName = item->data(0, Qt::UserRole).toString();
- if (tagName == QLatin1String("folder")) {
- bool folded = !item->isExpanded();
- xml.writeStartElement(tagName);
- xml.writeAttribute(XbelReader::foldedAttribute(), folded ? yesValue() : noValue());
- xml.writeTextElement(titleElement(), item->text(0));
- for (int i = 0; i < item->childCount(); ++i)
- writeItem(item->child(i));
- xml.writeEndElement();
- } else if (tagName == QLatin1String("bookmark")) {
- xml.writeStartElement(tagName);
- if (!item->text(1).isEmpty())
- xml.writeAttribute(XbelReader::hrefAttribute(), item->text(1));
- xml.writeTextElement(titleElement(), item->text(0));
- xml.writeEndElement();
- } else if (tagName == QLatin1String("separator")) {
- xml.writeEmptyElement(tagName);
- }
-}
-//! [2]
diff --git a/examples/xml/streambookmarks/xbelwriter.h b/examples/xml/streambookmarks/xbelwriter.h
deleted file mode 100644
index 465d8f0dc4..0000000000
--- a/examples/xml/streambookmarks/xbelwriter.h
+++ /dev/null
@@ -1,75 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef XBELWRITER_H
-#define XBELWRITER_H
-
-#include <QXmlStreamWriter>
-
-QT_BEGIN_NAMESPACE
-class QTreeWidget;
-class QTreeWidgetItem;
-QT_END_NAMESPACE
-
-//! [0]
-class XbelWriter
-{
-public:
- explicit XbelWriter(const QTreeWidget *treeWidget);
- bool writeFile(QIODevice *device);
-
-private:
- void writeItem(const QTreeWidgetItem *item);
- QXmlStreamWriter xml;
- const QTreeWidget *treeWidget;
-};
-//! [0]
-
-#endif