summaryrefslogtreecommitdiff
path: root/examples/xmlpatterns
diff options
context:
space:
mode:
authorLeena Miettinen <riitta-leena.miettinen@digia.com>2014-10-17 15:55:53 +0200
committerLeena Miettinen <riitta-leena.miettinen@theqtcompany.com>2015-01-05 16:59:36 +0100
commit060cc3c47062a35e8127413ece57573d1aca067f (patch)
treef470e22b330ae41026949b3491a1f5e241564139 /examples/xmlpatterns
parent64dcf54e06556f951dff277feb9a9b6aa7767cf8 (diff)
downloadqtxmlpatterns-060cc3c47062a35e8127413ece57573d1aca067f.tar.gz
Doc: fix issues to display examples in Qt Creatorv5.4.15.4.1
- Add \brief commands to example docs to show descriptions - Add an examples page with the \group command - Link to the examples page from the module index page - Edit the .qdocconf file - Edit the .gitignore file to allow pushing changes to examples - Add a generic thumbnail image for C++ Code Analyzer example Change-Id: I1a313ae26664ce9fc50ef8962f0facd57dea546b Reviewed-by: Martin Smith <martin.smith@digia.com> Reviewed-by: Jerome Pasion <jerome.pasion@digia.com>
Diffstat (limited to 'examples/xmlpatterns')
-rw-r--r--examples/xmlpatterns/filetree/doc/src/filetree.qdoc44
-rw-r--r--examples/xmlpatterns/recipes/doc/src/recipes.qdoc19
-rw-r--r--examples/xmlpatterns/schema/doc/src/schema.qdoc19
-rw-r--r--examples/xmlpatterns/xquery/doc/src/globalVariables.qdoc29
4 files changed, 59 insertions, 52 deletions
diff --git a/examples/xmlpatterns/filetree/doc/src/filetree.qdoc b/examples/xmlpatterns/filetree/doc/src/filetree.qdoc
index 1093d56..218bf47 100644
--- a/examples/xmlpatterns/filetree/doc/src/filetree.qdoc
+++ b/examples/xmlpatterns/filetree/doc/src/filetree.qdoc
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the documentation of the Qt Toolkit.
@@ -26,9 +26,11 @@
****************************************************************************/
/*!
- \example xmlpatterns/filetree
+ \example filetree
\title File System Example
\ingroup xmlpattern_examples
+ \brief Using Qt XML Patterns for querying non-XML data that is modeled to
+ look like XML.
This example shows how to use Qt XML Patterns for querying non-XML
data that is modeled to look like XML.
@@ -69,7 +71,7 @@
\c{main.cpp} (\c{Q_INIT_RESOURCE(queries);}). It lists the XQuery
files (\c{.xq}) that can be selected in the combobox.
- \quotefromfile xmlpatterns/filetree/queries.qrc
+ \quotefromfile filetree/queries.qrc
\printuntil
To add your own queries to the example's combobox, store your
@@ -104,12 +106,12 @@
QSimpleXmlNodeModel. When you implement your own custom node model,
you must provide implementations for these callback functions:
- \snippet xmlpatterns/filetree/filetree.h 0
- \snippet xmlpatterns/filetree/filetree.h 1
+ \snippet filetree/filetree.h 0
+ \snippet filetree/filetree.h 1
The \c{FileTree} class declares four data members:
- \snippet xmlpatterns/filetree/filetree.h 2
+ \snippet filetree/filetree.h 2
The QVector \c{m_fileInfos} will contain the node model. Each
QFileInfo in the vector will represent a file or a directory in the
@@ -141,7 +143,7 @@
types:
\target Node_Type
- \snippet xmlpatterns/filetree/filetree.h 4
+ \snippet filetree/filetree.h 4
\c{Directory} and \c{File} will represent the XML element nodes for
directories and files respectively, and the other enum values will
@@ -150,7 +152,7 @@
initializes \c{m_names} with an appropriate QXmlName for each
element and attribute type:
- \snippet xmlpatterns/filetree/filetree.cpp 2
+ \snippet filetree/filetree.cpp 2
Note that the constructor does \e{not} pre-build the entire node
model. Instead, the node model is built \e{incrementally} as the
@@ -176,7 +178,7 @@
a QFileInfo, the class uses the private function \c{toNodeIndex()}:
\target main toNodeIndex
- \snippet xmlpatterns/filetree/filetree.cpp 1
+ \snippet filetree/filetree.cpp 1
It searches the \c{m_fileInfos} vector for a QFileInfo that matches
\c{fileInfo}. If a match is found, its array index is passed to
@@ -211,12 +213,12 @@
type directly from the QFileInfo:
\target toNodeIndex of convenience
- \snippet xmlpatterns/filetree/filetree.cpp 0
+ \snippet filetree/filetree.cpp 0
Note that the auxiliary vector \c{m_names} is accessed using the
\l{Node_Type} {node type}, for example:
- \snippet xmlpatterns/filetree/filetree.cpp 3
+ \snippet filetree/filetree.cpp 3
Most of the virtual functions in the callback interface are as
simple as the ones described so far, but the callback function used
@@ -253,7 +255,7 @@
each \l{QAbstractXmlNodeModel::SimpleAxis} {axis}.
\target next node on axis
- \snippet xmlpatterns/filetree/filetree.cpp 4
+ \snippet filetree/filetree.cpp 4
The first thing this function does is call \l{to file info}
{toFileInfo()} to get the QFileInfo of the context node. The use of
@@ -262,7 +264,7 @@
in \c{m_fileInfos}.
\target to file info
- \snippet xmlpatterns/filetree/filetree.cpp 6
+ \snippet filetree/filetree.cpp 6
The \l{QAbstractXmlNodeModel::Parent} {Parent} case looks up the
context node's parent by constructing a QFileInfo from the context
@@ -294,7 +296,7 @@
sibling to the node model, if it isn't in the model yet.
\target nextSibling helper
- \snippet xmlpatterns/filetree/filetree.cpp 5
+ \snippet filetree/filetree.cpp 5
\section2 The UI Class: MainWindow
@@ -302,7 +304,7 @@
QMainWindow and the Ui_MainWindow base class generated by
\l{Qt Designer Manual} {Qt Designer}.
- \snippet xmlpatterns/filetree/mainwindow.h 0
+ \snippet filetree/mainwindow.h 0
It contains the custom node model (\c{m_fileTree}) and an instance
of QXmlNodeModelIndex (\c{m_fileNode}) used for holding the node
@@ -318,13 +320,13 @@
be loaded into the custom node model. Choosing a directory signals
the \c{on_actionOpenDirectory_triggered()} slot:
- \snippet xmlpatterns/filetree/mainwindow.cpp 1
+ \snippet filetree/mainwindow.cpp 1
The slot function simply calls the private function
\c{loadDirectory()} with the path of the chosen directory:
\target the standard code pattern
- \snippet xmlpatterns/filetree/mainwindow.cpp 4
+ \snippet filetree/mainwindow.cpp 4
\c{loadDirectory()} demonstrates a standard code pattern for using
Qt XML Patterns programatically. First it gets the node model index
@@ -361,12 +363,12 @@
right. Choosing an XQuery signals the
\c{on_queryBox_currentIndexChanged()} slot:
- \snippet xmlpatterns/filetree/mainwindow.cpp 2
+ \snippet filetree/mainwindow.cpp 2
The slot function opens and loads the query file and then calls the
private function \c{evaluateResult()} to run the query:
- \snippet xmlpatterns/filetree/mainwindow.cpp 3
+ \snippet filetree/mainwindow.cpp 3
\c{evaluateResult()} is a second example of the same code pattern
shown in \l{the standard code pattern} {loadDirectory()}. In this
@@ -388,8 +390,8 @@
\c{FileTree} class, we can strip the running of \c{wholeTree.xq} out
of \l{the standard code pattern} {MainWindow::loadDirectory()}:
- \snippet xmlpatterns/filetree/mainwindow.cpp 5
- \snippet xmlpatterns/filetree/mainwindow.cpp 6
+ \snippet filetree/mainwindow.cpp 5
+ \snippet filetree/mainwindow.cpp 6
Note, however, that \c{FileTree} doesn't have the capability of
deleting all or part of the node model. The node model, once built,
diff --git a/examples/xmlpatterns/recipes/doc/src/recipes.qdoc b/examples/xmlpatterns/recipes/doc/src/recipes.qdoc
index 3e8b396..e989359 100644
--- a/examples/xmlpatterns/recipes/doc/src/recipes.qdoc
+++ b/examples/xmlpatterns/recipes/doc/src/recipes.qdoc
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the documentation of the Qt Toolkit.
@@ -26,9 +26,10 @@
****************************************************************************/
/*!
- \example xmlpatterns/recipes
+ \example recipes
\title Recipes Example
\ingroup xmlpattern_examples
+ \brief Using Qt XML Patterns to query XML data loaded from a file.
The Recipes example shows how to use Qt XML Patterns to query XML data
loaded from a file.
@@ -67,7 +68,7 @@
\c{main.cpp} (\c{Q_INIT_RESOURCE(recipes);}). It lists the XQuery
files (\c{.xq}) that can be selected in the combobox.
- \quotefromfile xmlpatterns/recipes/recipes.qrc
+ \quotefromfile recipes/recipes.qrc
\printuntil
To add your own queries to the example's combobox, store your
@@ -80,7 +81,7 @@
QApplication. Then it creates an instance of the UI class, shows it,
and starts the Qt event loop:
- \snippet xmlpatterns/recipes/main.cpp 0
+ \snippet recipes/main.cpp 0
\section2 The UI Class: QueryMainWindow
@@ -88,7 +89,7 @@
QMainWindow and the class generated by \l{Qt Designer Manual} {Qt
Designer}:
- \snippet xmlpatterns/recipes/querymainwindow.h 0
+ \snippet recipes/querymainwindow.h 0
The constructor finds the window's \l{QComboBox} {combo box} child
widget and connects its \l{QComboBox::currentIndexChanged()}
@@ -98,7 +99,7 @@
viewer} . Finally, it finds the XQuery files (\c{.xq}) and adds each
one to the \l{QComboBox} {combo box} menu.
- \snippet xmlpatterns/recipes/querymainwindow.cpp 0
+ \snippet recipes/querymainwindow.cpp 0
The work is done in the \l{displayQuery() slot} {displayQuery()}
slot and the \l{evaluate() function} {evaluate()} function it
@@ -107,7 +108,7 @@
function} {evaluate()}.
\target displayQuery() slot
- \snippet xmlpatterns/recipes/querymainwindow.cpp 1
+ \snippet recipes/querymainwindow.cpp 1
\l{evaluate() function} {evaluate()} demonstrates the standard
Qt XML Patterns usage pattern. First, an instance of QXmlQuery is
@@ -125,7 +126,7 @@
called to ensure that the XQuery was correctly parsed.
\target evaluate() function
- \snippet xmlpatterns/recipes/querymainwindow.cpp 2
+ \snippet recipes/querymainwindow.cpp 2
If the XQuery is valid, an instance of QXmlFormatter is created to
format the query result as XML into a QBuffer. To evaluate the
@@ -137,7 +138,7 @@
\note Each XQuery \c{.xq} file must declare the \c{$inputDocument}
variable to represent the \c cookbook.xml document:
- \code
+ \badcode
(: All ingredients for Mushroom Soup. :)
declare variable $inputDocument external;
diff --git a/examples/xmlpatterns/schema/doc/src/schema.qdoc b/examples/xmlpatterns/schema/doc/src/schema.qdoc
index b628bca..63c8418 100644
--- a/examples/xmlpatterns/schema/doc/src/schema.qdoc
+++ b/examples/xmlpatterns/schema/doc/src/schema.qdoc
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the documentation of the Qt Toolkit.
@@ -26,9 +26,10 @@
****************************************************************************/
/*!
- \example xmlpatterns/schema
+ \example schema
\title XML Schema Validation Example
\ingroup xmlpattern_examples
+ \brief Using Qt XML Patterns to validate XML with a W3C XML Schema.
The XML Schema Validation example shows how to use Qt XML Patterns to
validate XML with a W3C XML Schema.
@@ -69,7 +70,7 @@
QApplication. Then it creates an instance of the mainwindow class, shows it,
and starts the Qt event loop:
- \snippet xmlpatterns/schema/main.cpp 0
+ \snippet schema/main.cpp 0
\section2 The UI Class: MainWindow
@@ -77,7 +78,7 @@
QMainWindow and the class generated by \l{Qt Designer Manual} {Qt
Designer}:
- \snippet xmlpatterns/schema/mainwindow.h 0
+ \snippet schema/mainwindow.h 0
The constructor fills the schema and instance \l{QComboBox} selections with the predefined
schemas and instances and connects their \l{QComboBox::currentIndexChanged()} {currentIndexChanged()}
@@ -88,20 +89,20 @@
The call to \c{schemaSelected(0)} and \c{instanceSelected(0)} will trigger the validation
of the initial Contact Schema example.
- \snippet xmlpatterns/schema/mainwindow.cpp 0
+ \snippet schema/mainwindow.cpp 0
In the \c{schemaSelected()} slot the content of the instance \l{QComboBox} {selection}
is adapted to the selected schema and the corresponding schema is loaded from the
\l{The Qt Resource System} {resource file} and displayed in the schema \l{QTextBrowser} {viewer}.
At the end of the method a revalidation is triggered.
- \snippet xmlpatterns/schema/mainwindow.cpp 1
+ \snippet schema/mainwindow.cpp 1
In the \c{instanceSelected()} slot the selected instance is loaded from the
\l{The Qt Resource System} {resource file} and loaded into the instance \l{QTextEdit} {editor}
an the revalidation is triggered again.
- \snippet xmlpatterns/schema/mainwindow.cpp 2
+ \snippet schema/mainwindow.cpp 2
The \c{validate()} slot does the actual work in this example.
At first it stores the content of the schema \l{QTextBrowser} {viewer} and the
@@ -110,7 +111,7 @@
\l{QAbstractMessageHandler} {QAbstractMessageHandler} and is a convenience
class to store error messages from the XmlPatterns system.
- \snippet xmlpatterns/schema/mainwindow.cpp 4
+ \snippet schema/mainwindow.cpp 4
After the \l{QXmlSchema} {QXmlSchema} is instanciated and the message handler set
on it, the \l{QXmlSchema::load()} {load()} method is called with the schema data as argument.
@@ -126,5 +127,5 @@
The rest of the code does only some fancy coloring and eyecandy.
- \snippet xmlpatterns/schema/mainwindow.cpp 3
+ \snippet schema/mainwindow.cpp 3
*/
diff --git a/examples/xmlpatterns/xquery/doc/src/globalVariables.qdoc b/examples/xmlpatterns/xquery/doc/src/globalVariables.qdoc
index bc5011c..a11a972 100644
--- a/examples/xmlpatterns/xquery/doc/src/globalVariables.qdoc
+++ b/examples/xmlpatterns/xquery/doc/src/globalVariables.qdoc
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the documentation of the Qt Toolkit.
@@ -26,10 +26,13 @@
****************************************************************************/
/*!
- \example xmlpatterns/xquery
+ \example xquery
\title C++ Source Code Analyzer Example
\ingroup xmlpattern_examples
+ \brief Using XQuery and the \c xmlpatterns command line utility to
+ query C++ source code.
+
This example uses XQuery and the \c xmlpatterns command line utility to
query C++ source code.
@@ -68,7 +71,7 @@
Consider the declarations in this hypothetical C++ application:
- \snippet xmlpatterns/xquery/globalVariables/globals.cpp 0
+ \snippet xquery/globalVariables/globals.cpp 0
\section3 The XML description of the C++ application
@@ -76,7 +79,7 @@
\l{http://public.kitware.com/GCC_XML/HTML/Index.html} {GCC-XML}
produces this XML description:
- \quotefromfile xmlpatterns/xquery/globalVariables/globals.gccxml
+ \quotefromfile xquery/globalVariables/globals.gccxml
\printuntil
\section3 The XQuery for finding global variables
@@ -85,7 +88,7 @@
description. Here is our XQuery source. We walk through it in
\l{XQuery Code Walk-Through}.
- \quotefromfile xmlpatterns/xquery/globalVariables/reportGlobals.xq
+ \quotefromfile xquery/globalVariables/reportGlobals.xq
\printuntil
\section3 Running the XQuery
@@ -93,7 +96,7 @@
To run the XQuery using the \c xmlpatterns command line utility,
enter the following command:
- \code
+ \badcode
xmlpatterns reportGlobals.xq -param fileToOpen=globals.gccxml -output globals.html
\endcode
@@ -128,7 +131,7 @@
\c{examples/xmlpatterns/xquery/globalVariables/reportGlobals.xq}
It begins with two variable declarations that begin the XQuery:
- \quotefromfile xmlpatterns/xquery/globalVariables/reportGlobals.xq
+ \quotefromfile xquery/globalVariables/reportGlobals.xq
\skipto declare variable
\printto (:
@@ -149,7 +152,7 @@
instructions for displaying the text, and then the \c{<body>}
element.
- \quotefromfile xmlpatterns/xquery/globalVariables/reportGlobals.xq
+ \quotefromfile xquery/globalVariables/reportGlobals.xq
\skipto <html xmlns
\printuntil
@@ -158,7 +161,7 @@
the two \c{return} clauses separated by the \e {comma operator}
about halfway down:
- \quotefromfile xmlpatterns/xquery/globalVariables/reportGlobals.xq
+ \quotefromfile xquery/globalVariables/reportGlobals.xq
\skipto declare function local:report()
\printuntil };
@@ -172,7 +175,7 @@
Here is the html generated for the \c{<body>} element. Compare
it with the XQuery code above:
- \quotefromfile xmlpatterns/xquery/globalVariables/globals.html
+ \quotefromfile xquery/globalVariables/globals.html
\skipto <body>
\printuntil </body>
@@ -181,21 +184,21 @@
returns true if the variable has a complex type. The variable can
be mutable or const.
- \quotefromfile xmlpatterns/xquery/globalVariables/reportGlobals.xq
+ \quotefromfile xquery/globalVariables/reportGlobals.xq
\skipto declare function local:isComplexType
\printuntil };
\c{isPrimitive()} returns true if the variable has a primitive
type. The variable must be mutable.
- \quotefromfile xmlpatterns/xquery/globalVariables/reportGlobals.xq
+ \quotefromfile xquery/globalVariables/reportGlobals.xq
\skipto declare function local:isPrimitive
\printuntil };
\c{location()} returns a text constructed from the variable's file
and line number attributes.
- \quotefromfile xmlpatterns/xquery/globalVariables/reportGlobals.xq
+ \quotefromfile xquery/globalVariables/reportGlobals.xq
\skipto declare function local:location
\printuntil };