summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2019-09-26 14:32:20 +0200
committerTopi Reiniƶ <topi.reinio@qt.io>2019-09-27 10:05:55 +0000
commitdcd5df5823d61e3ad479f259dfd4a25d67a54e4a (patch)
treee9f47da9963fbc60dba4a46eccf21c425c6f4bef
parent0407495a027b8e662c773eafb50ab66fd4638962 (diff)
parentc8e79294237260d735324663932a676d8084efcb (diff)
downloadqttools-dcd5df5823d61e3ad479f259dfd4a25d67a54e4a.tar.gz
Merge remote-tracking branch 'origin/5.13' into 5.14
Change-Id: I5c06b3e0177fcccd988620ab269f75632689a54c
-rw-r--r--dist/changes-5.12.537
-rw-r--r--dist/changes-5.13.129
-rw-r--r--src/designer/src/lib/sdk/propertysheet.qdoc29
-rw-r--r--src/distancefieldgenerator/mainwindow.cpp21
-rw-r--r--src/linguist/lupdate/qdeclarative.cpp4
-rw-r--r--src/qdoc/cppcodemarker.cpp9
-rw-r--r--src/qdoc/generator.cpp126
-rw-r--r--src/qdoc/generator.h14
-rw-r--r--src/qdoc/helpprojectwriter.cpp8
-rw-r--r--src/qdoc/htmlgenerator.cpp2
-rw-r--r--src/qdoc/node.cpp8
-rw-r--r--src/qdoc/qdocindexfiles.cpp8
-rw-r--r--src/qdoc/webxmlgenerator.cpp175
-rw-r--r--src/qdoc/webxmlgenerator.h5
14 files changed, 367 insertions, 108 deletions
diff --git a/dist/changes-5.12.5 b/dist/changes-5.12.5
new file mode 100644
index 000000000..379f39064
--- /dev/null
+++ b/dist/changes-5.12.5
@@ -0,0 +1,37 @@
+Qt 5.12.5 is a bug-fix release. It maintains both forward and backward
+compatibility (source and binary) with Qt 5.12.0 through 5.12.4.
+
+For more details, refer to the online documentation included in this
+distribution. The documentation is also available online:
+
+https://doc.qt.io/qt-5/index.html
+
+The Qt version 5.12 series is binary compatible with the 5.11.x series.
+Applications compiled for 5.11 will continue to run with 5.12.
+
+Some of the changes listed in this file include issue tracking numbers
+corresponding to tasks in the Qt Bug Tracker:
+
+https://bugreports.qt.io/
+
+Each of these identifiers can be entered in the bug tracker to obtain more
+information about a particular change.
+
+****************************************************************************
+* distancefieldgenerator *
+****************************************************************************
+
+ - [QTBUG-76188] Fixed bug where the tool would fail for valid fonts with
+ the message "end of cmap table reached when parsing subtable".
+ - [QTBUG-76528] Fixed a bug where the generated textures might exceed the
+ maximum height.
+ - [QTBUG-76188][QTBUG-76528] Fixed possible crash when generating large
+ number of glyphs with a small texture size.
+ - [QTBUG-77501] Fixed broken text rendering when generating large glyph
+ sets.
+
+****************************************************************************
+* Qt Help *
+****************************************************************************
+
+ - [QDS-779] Fixed possible application freeze when using QtHelp module.
diff --git a/dist/changes-5.13.1 b/dist/changes-5.13.1
new file mode 100644
index 000000000..557d7021f
--- /dev/null
+++ b/dist/changes-5.13.1
@@ -0,0 +1,29 @@
+Qt 5.13.1 is a bug-fix release. It maintains both forward and backward
+compatibility (source and binary) with Qt 5.13.0.
+
+For more details, refer to the online documentation included in this
+distribution. The documentation is also available online:
+
+https://doc.qt.io/qt-5/index.html
+
+The Qt version 5.13 series is binary compatible with the 5.12.x series.
+Applications compiled for 5.12 will continue to run with 5.13.
+
+Some of the changes listed in this file include issue tracking numbers
+corresponding to tasks in the Qt Bug Tracker:
+
+https://bugreports.qt.io/
+
+Each of these identifiers can be entered in the bug tracker to obtain more
+information about a particular change.
+
+****************************************************************************
+* distancefieldgenerator *
+****************************************************************************
+
+ - [QTBUG-76188] Fixed bug where the tool would fail for valid fonts with
+ the message "end of cmap table reached when parsing subtable".
+ - [QTBUG-76528] Fixed a bug where the generated textures might exceed the
+ maximum height.
+ - [QTBUG-76188][QTBUG-76528] Fixed possible crash when generating large
+ number of glyphs with a small texture size.
diff --git a/src/designer/src/lib/sdk/propertysheet.qdoc b/src/designer/src/lib/sdk/propertysheet.qdoc
index 4e0ccddf2..e5ab420f4 100644
--- a/src/designer/src/lib/sdk/propertysheet.qdoc
+++ b/src/designer/src/lib/sdk/propertysheet.qdoc
@@ -68,17 +68,24 @@
also provides an interface for creating custom property sheet
extensions.
- \warning \QD uses the QDesignerPropertySheetExtension to feed its
- property editor. Whenever a widget is selected in its workspace,
- \QD will query for the widget's property sheet extension. If the
- selected widget has an implemented property sheet extension, this
- extension will override the default property sheet.
-
- \warning The data types used by the property sheet for some properties
- are opaque custom QVariant types containing additional information
- instead of plain Qt data types.
- For example, this is the case for enumerations, flags,
- icons, pixmaps and strings.
+ Keep the following limitations in mind:
+
+ \list
+ \li \QD uses the QDesignerPropertySheetExtension to feed its
+ property editor. Whenever a widget is selected in its workspace,
+ \QD will query for the widget's property sheet extension. If the
+ selected widget has an implemented property sheet extension, this
+ extension will override the default property sheet.
+
+ \li The data types used by the property sheet for some properties
+ are opaque custom QVariant types containing additional information
+ instead of plain Qt data types. For example, this is the case for
+ enumerations, flags, icons, pixmaps and strings.
+
+ \li \QD's property editor has no implementation for handling
+ Q_PROPERTY types for custom types that have been declared
+ with Q_DECLARE_METATYPE().
+ \endlist
To create a property sheet extension, your extension class must
inherit from both QObject and
diff --git a/src/distancefieldgenerator/mainwindow.cpp b/src/distancefieldgenerator/mainwindow.cpp
index ee4475ada..6bc793ede 100644
--- a/src/distancefieldgenerator/mainwindow.cpp
+++ b/src/distancefieldgenerator/mainwindow.cpp
@@ -693,18 +693,25 @@ void MainWindow::updateUnicodeRanges()
this,
&MainWindow::updateSelection);
+ QItemSelection selectedItems;
+
for (int i = 0; i < ui->lwUnicodeRanges->count(); ++i) {
QListWidgetItem *item = ui->lwUnicodeRanges->item(i);
- DistanceFieldModel::UnicodeRange unicodeRange = item->data(Qt::UserRole).value<DistanceFieldModel::UnicodeRange>();
- QList<glyph_t> glyphIndexes = m_model->glyphIndexesForUnicodeRange(unicodeRange);
- for (glyph_t glyphIndex : glyphIndexes) {
- QModelIndex index = m_model->index(glyphIndex);
- ui->lvGlyphs->selectionModel()->select(index, item->isSelected()
- ? QItemSelectionModel::Select
- : QItemSelectionModel::Deselect);
+ if (item->isSelected()) {
+ DistanceFieldModel::UnicodeRange unicodeRange = item->data(Qt::UserRole).value<DistanceFieldModel::UnicodeRange>();
+ QList<glyph_t> glyphIndexes = m_model->glyphIndexesForUnicodeRange(unicodeRange);
+
+ for (glyph_t glyphIndex : glyphIndexes) {
+ QModelIndex index = m_model->index(glyphIndex);
+ selectedItems.select(index, index);
+ }
}
}
+ ui->lvGlyphs->selectionModel()->clearSelection();
+ if (!selectedItems.isEmpty())
+ ui->lvGlyphs->selectionModel()->select(selectedItems, QItemSelectionModel::Select);
+
connect(ui->lvGlyphs->selectionModel(),
&QItemSelectionModel::selectionChanged,
this,
diff --git a/src/linguist/lupdate/qdeclarative.cpp b/src/linguist/lupdate/qdeclarative.cpp
index 216bc8329..7a453aa32 100644
--- a/src/linguist/lupdate/qdeclarative.cpp
+++ b/src/linguist/lupdate/qdeclarative.cpp
@@ -108,6 +108,10 @@ protected:
yyMsg(identLineNo) << qPrintable(LU::tr("%1() requires at least one argument.\n").arg(name));
return;
}
+ if (AST::cast<AST::TemplateLiteral *>(node->arguments->expression)) {
+ yyMsg(identLineNo) << qPrintable(LU::tr("%1() cannot be used with template literals. Ignoring\n").arg(name));
+ return;
+ }
QString source;
if (!createString(node->arguments->expression, &source))
diff --git a/src/qdoc/cppcodemarker.cpp b/src/qdoc/cppcodemarker.cpp
index 325130399..26a43794d 100644
--- a/src/qdoc/cppcodemarker.cpp
+++ b/src/qdoc/cppcodemarker.cpp
@@ -133,8 +133,13 @@ QString CppCodeMarker::markedUpSynopsis(const Node *node,
name = "<@name>" + name + "</@name>";
if (style == Section::Details) {
- if (!node->parent()->name().isEmpty() && !node->parent()->isHeader() &&
- !node->isProperty() && !node->isQmlNode() && !node->isJsNode())
+ if (!node->isRelatedNonmember() &&
+ !node->isProxyNode() &&
+ !node->parent()->name().isEmpty() &&
+ !node->parent()->isHeader() &&
+ !node->isProperty() &&
+ !node->isQmlNode() &&
+ !node->isJsNode())
name.prepend(taggedNode(node->parent()) + "::");
}
diff --git a/src/qdoc/generator.cpp b/src/qdoc/generator.cpp
index 3a2fc802d..4e412e162 100644
--- a/src/qdoc/generator.cpp
+++ b/src/qdoc/generator.cpp
@@ -428,9 +428,13 @@ QString Generator::fileBase(const Node *node) const
/*!
Constructs an href link from an example file name, which
- is a path to the example file.
+ is a path to the example file. If \a fileExtension is
+ empty (default value), retrieve the file extension from
+ the generator.
*/
-QString Generator::linkForExampleFile(const QString &path, const Node *parent)
+QString Generator::linkForExampleFile(const QString &path,
+ const Node *parent,
+ const QString &fileExt)
{
QString link = path;
QString modPrefix(parent->physicalModuleName());
@@ -441,11 +445,31 @@ QString Generator::linkForExampleFile(const QString &path, const Node *parent)
QString res;
transmogrify(link, res);
res.append(QLatin1Char('.'));
- res.append(fileExtension());
+ res.append(fileExt);
+ if (fileExt.isEmpty())
+ res.append(fileExtension());
return res;
}
/*!
+ Helper function to construct a title for a file or image page
+ included in an example.
+*/
+QString Generator::exampleFileTitle(const ExampleNode *relative,
+ const QString &fileName)
+{
+ QString suffix;
+ if (relative->files().contains(fileName))
+ suffix = QLatin1String(" Example File");
+ else if (relative->images().contains(fileName))
+ suffix = QLatin1String(" Image File");
+ else
+ return suffix;
+
+ return fileName.mid(fileName.lastIndexOf(QLatin1Char('/')) + 1) + suffix;
+}
+
+/*!
If the \a node has a URL, return the URL as the file name.
Otherwise, construct the file name from the fileBase() and
either the provided \a extension or fileExtension(), and
@@ -658,6 +682,7 @@ QString Generator::fullDocumentLocation(const Node *node, bool useSubdir)
case Node::QmlType:
case Node::Page:
case Node::Group:
+ case Node::HeaderFile:
case Node::Module:
case Node::JsModule:
case Node::QmlModule:
@@ -920,62 +945,75 @@ void Generator::generateBody(const Node *node, CodeMarker *marker)
}
}
}
+ generateRequiredLinks(node, marker);
+}
+
+/*!
+ Generates either a link to the project folder for example \a node, or a list
+ of links files/images if 'url.examples config' variable is not defined.
+
+ Does nothing for non-example nodes.
+*/
+void Generator::generateRequiredLinks(const Node *node, CodeMarker *marker)
+{
+ if (!node->isExample())
+ return;
+
+ const ExampleNode *en = static_cast<const ExampleNode *>(node);
+ QString exampleUrl = config()->getString(CONFIG_URL + Config::dot + CONFIG_EXAMPLES);
- // For examples, generate either a link to the project directory
- // (if url.examples is defined), or a list of files/images.
- if (node->isExample()) {
- const ExampleNode *en = static_cast<const ExampleNode *>(node);
- QString exampleUrl = config()->getString(CONFIG_URL + Config::dot + CONFIG_EXAMPLES);
- if (!exampleUrl.isEmpty()) {
- generateLinkToExample(en, marker, exampleUrl);
- } else if (!en->noAutoList()) {
- generateFileList(en, marker, false);
- generateFileList(en, marker, true);
+ if (exampleUrl.isEmpty()) {
+ if (!en->noAutoList()) {
+ generateFileList(en, marker, false); // files
+ generateFileList(en, marker, true); // images
}
+ } else {
+ generateLinkToExample(en, marker, exampleUrl);
}
}
/*!
- Generates a link to the project folder for example node \a en.
- \a baseUrl is the base URL - path information is available in
- the example node's name() and 'examplesinstallpath' configuration
- variable.
+ Generates an external link to the project folder for example \a node.
+ The path to the example is appended to \a baseUrl string, or to a
+ specific location within the string marked with the placeholder '\1'
+ character.
*/
void Generator::generateLinkToExample(const ExampleNode *en,
CodeMarker *marker,
const QString &baseUrl)
{
- Text text;
- QString exampleUrl(baseUrl);
-
- if (!exampleUrl.contains("\1")) {
- if (!exampleUrl.endsWith("/"))
- exampleUrl += "/";
- exampleUrl += "\1";
- }
-
- // Name of the example node is the path, relative to install path
- QStringList path = QStringList()
- << config()->getString(CONFIG_EXAMPLESINSTALLPATH)
- << en->name();
- path.removeAll({});
-
- QString link;
+ QString exampleUrl(baseUrl);
+ QString link;
#ifndef QT_BOOTSTRAPPED
- link = QUrl(baseUrl).host();
+ link = QUrl(exampleUrl).host();
#endif
- if (!link.isEmpty())
- link.prepend(" @ ");
- link.prepend("Example project");
+ if (!link.isEmpty())
+ link.prepend(" @ ");
+ link.prepend("Example project");
+
+ const QLatin1Char separator('/');
+ const QLatin1Char placeholder('\1');
+ if (!exampleUrl.contains(placeholder)) {
+ if (!exampleUrl.endsWith(separator))
+ exampleUrl += separator;
+ exampleUrl += placeholder;
+ }
- text << Atom::ParaLeft
- << Atom(Atom::Link, exampleUrl.replace("\1", path.join("/")))
- << Atom(Atom::FormattingLeft, ATOM_FORMATTING_LINK)
- << Atom(Atom::String, link)
- << Atom(Atom::FormattingRight, ATOM_FORMATTING_LINK)
- << Atom::ParaRight;
+ // Construct a path to the example; <install path>/<example name>
+ QStringList path = QStringList()
+ << config()->getString(CONFIG_EXAMPLESINSTALLPATH)
+ << en->name();
+ path.removeAll({});
+
+ Text text;
+ text << Atom::ParaLeft
+ << Atom(Atom::Link, exampleUrl.replace(placeholder, path.join(separator)))
+ << Atom(Atom::FormattingLeft, ATOM_FORMATTING_LINK)
+ << Atom(Atom::String, link)
+ << Atom(Atom::FormattingRight, ATOM_FORMATTING_LINK)
+ << Atom::ParaRight;
- generateText(text, 0, marker);
+ generateText(text, 0, marker);
}
/*!
diff --git a/src/qdoc/generator.h b/src/qdoc/generator.h
index 05d54fa66..f9bb4d53b 100644
--- a/src/qdoc/generator.h
+++ b/src/qdoc/generator.h
@@ -68,8 +68,11 @@ public:
QString fullDocumentLocation(const Node *node, bool useSubdir = false);
const Config *config() { return config_; }
- QString linkForExampleFile(const QString &path, const Node *parent);
-
+ QString linkForExampleFile(const QString &path,
+ const Node *parent,
+ const QString &fileExt = QString());
+ static QString exampleFileTitle(const ExampleNode *relative,
+ const QString &fileName);
static Generator *currentGenerator() { return currentGenerator_; }
static Generator *generatorForFormat(const QString &format);
static void initialize(const Config &config);
@@ -150,10 +153,9 @@ protected:
CodeMarker *marker,
bool generate,
int &numGeneratedAtoms);
- void generateLinkToExample(const ExampleNode *en,
- CodeMarker *marker,
- const QString &baseUrl);
- void generateFileList(const ExampleNode *en, CodeMarker *marker, bool images);
+ void generateRequiredLinks(const Node *node, CodeMarker *marker);
+ void generateLinkToExample(const ExampleNode *en, CodeMarker *marker, const QString &exampleUrl);
+ virtual void generateFileList(const ExampleNode *en, CodeMarker *marker, bool images);
void generateSince(const Node *node, CodeMarker *marker);
void generateStatus(const Node *node, CodeMarker *marker);
void generatePrivateSignalNote(const Node *node, CodeMarker *marker);
diff --git a/src/qdoc/helpprojectwriter.cpp b/src/qdoc/helpprojectwriter.cpp
index 4a07f023f..3a33ce2dd 100644
--- a/src/qdoc/helpprojectwriter.cpp
+++ b/src/qdoc/helpprojectwriter.cpp
@@ -217,7 +217,10 @@ QStringList HelpProjectWriter::keywordDetails(const Node *node) const
else
details << node->name();
// "id"
- details << node->parent()->name()+"::"+node->name();
+ if (!node->isRelatedNonmember())
+ details << node->parent()->name()+"::"+node->name();
+ else
+ details << node->name();
}
else if (node->isQmlType() || node->isQmlBasicType()) {
details << node->name();
@@ -492,6 +495,9 @@ void HelpProjectWriter::generateSections(HelpProject &project, QXmlStreamWriter
QSet<const Node *> childSet;
const NodeList &children = aggregate->childNodes();
foreach (const Node *child, children) {
+ // Skip related non-members adopted by some other aggregate
+ if (child->parent() != aggregate)
+ continue;
if (child->isIndexNode() || child->isPrivate())
continue;
if (child->isTextPageNode()) {
diff --git a/src/qdoc/htmlgenerator.cpp b/src/qdoc/htmlgenerator.cpp
index 1be3d17fe..2d31a2cde 100644
--- a/src/qdoc/htmlgenerator.cpp
+++ b/src/qdoc/htmlgenerator.cpp
@@ -3965,7 +3965,7 @@ QString HtmlGenerator::linkForNode(const Node *node, const Node *relative)
}
QString link = fn;
- if ((!node->isAggregate() && !node->isCollectionNode()) || node->isPropertyGroup()) {
+ if (!node->isPageNode() || node->isPropertyGroup()) {
QString ref = refForNode(node);
if (relative && fn == fileName(relative) && ref == refForNode(relative))
return QString();
diff --git a/src/qdoc/node.cpp b/src/qdoc/node.cpp
index 5cf323e1c..c1a204c9a 100644
--- a/src/qdoc/node.cpp
+++ b/src/qdoc/node.cpp
@@ -1334,11 +1334,11 @@ QString Node::fullDocumentName() const
if (n->isTextPageNode())
break;
- // Examine the parent node if one exists.
- if (n->parent())
- n = n->parent();
- else
+ // Examine the parent if the node is a member
+ if (!n->parent() || n->isRelatedNonmember())
break;
+
+ n = n->parent();
} while (true);
// Create a name based on the type of the ancestor node.
diff --git a/src/qdoc/qdocindexfiles.cpp b/src/qdoc/qdocindexfiles.cpp
index a41904a8f..2848eaba7 100644
--- a/src/qdoc/qdocindexfiles.cpp
+++ b/src/qdoc/qdocindexfiles.cpp
@@ -1273,7 +1273,9 @@ bool QDocIndexFiles::generateIndexSection(QXmlStreamWriter &writer, Node *node,
}
}
}
- if (node->isExample()) {
+ // WebXMLGenerator - skip the nested <page> elements for example
+ // files/images, as the generator produces them separately
+ if (node->isExample() && gen_->format() != QLatin1String("WebXML")) {
const ExampleNode *en = static_cast<const ExampleNode *>(node);
foreach (const QString &file, en->files()) {
writer.writeStartElement("page");
@@ -1283,7 +1285,7 @@ bool QDocIndexFiles::generateIndexSection(QXmlStreamWriter &writer, Node *node,
writer.writeAttribute("status", "active");
writer.writeAttribute("subtype", "file");
writer.writeAttribute("title", "");
- writer.writeAttribute("fulltitle", file.mid(file.lastIndexOf('/') + 1) + " Example File");
+ writer.writeAttribute("fulltitle", Generator::exampleFileTitle(en, file));
writer.writeAttribute("subtitle", file);
writer.writeEndElement(); // page
}
@@ -1295,7 +1297,7 @@ bool QDocIndexFiles::generateIndexSection(QXmlStreamWriter &writer, Node *node,
writer.writeAttribute("status", "active");
writer.writeAttribute("subtype", "image");
writer.writeAttribute("title", "");
- writer.writeAttribute("fulltitle", file.mid(file.lastIndexOf('/') + 1) + " Image File");
+ writer.writeAttribute("fulltitle", Generator::exampleFileTitle(en, file));
writer.writeAttribute("subtitle", file);
writer.writeEndElement(); // page
}
diff --git a/src/qdoc/webxmlgenerator.cpp b/src/qdoc/webxmlgenerator.cpp
index a4a14f7b7..ba1ad8389 100644
--- a/src/qdoc/webxmlgenerator.cpp
+++ b/src/qdoc/webxmlgenerator.cpp
@@ -32,6 +32,7 @@
#include "node.h"
#include "qdocdatabase.h"
#include "separator.h"
+#include "quoter.h"
#include "tree.h"
#include <QtCore/qxmlstream.h>
@@ -65,10 +66,17 @@ QString WebXMLGenerator::fileExtension() const
return "html";
}
-int WebXMLGenerator::generateAtom(const Atom * /* atom, */,
- const Node * /* relative */,
- CodeMarker * /* marker */)
+/*!
+ Most of the output is generated by QDocIndexFiles and the append() callback.
+ Some pages produce supplementary output while being generated, and that's
+ handled here.
+*/
+int WebXMLGenerator::generateAtom(const Atom *atom,
+ const Node *relative,
+ CodeMarker *marker)
{
+ if (supplement && currentWriter)
+ addAtomElements(*currentWriter.data(), atom, relative, marker);
return 0;
}
@@ -95,27 +103,73 @@ void WebXMLGenerator::generateCppReferencePage(Aggregate *aggregate, CodeMarker
void WebXMLGenerator::generatePageNode(PageNode *pn, CodeMarker * /* marker */)
{
QByteArray data;
+ currentWriter.reset(new QXmlStreamWriter(&data));
+ currentWriter->setAutoFormatting(true);
+ beginSubPage(pn, Generator::fileName(pn, "webxml"));
+ currentWriter->writeStartDocument();
+ currentWriter->writeStartElement("WebXML");
+ currentWriter->writeStartElement("document");
+
+ generateIndexSections(*currentWriter.data(), pn);
+
+ currentWriter->writeEndElement(); // document
+ currentWriter->writeEndElement(); // WebXML
+ currentWriter->writeEndDocument();
+
+ out() << data;
+ endSubPage();
+}
+
+void WebXMLGenerator::generateExampleFilePage(const Node *en,
+ const QString &file,
+ CodeMarker * /* marker */)
+{
+ QByteArray data;
QXmlStreamWriter writer(&data);
writer.setAutoFormatting(true);
- beginSubPage(pn, Generator::fileName(pn, "webxml"));
+ beginFilePage(en, linkForExampleFile(file, en, "webxml"));
writer.writeStartDocument();
writer.writeStartElement("WebXML");
writer.writeStartElement("document");
+ writer.writeStartElement("page");
+ writer.writeAttribute("name", file);
+ writer.writeAttribute("href", linkForExampleFile(file, en));
+ QString title = exampleFileTitle(static_cast<const ExampleNode *>(en), file);
+ writer.writeAttribute("title", title);
+ writer.writeAttribute("fulltitle", title);
+ writer.writeAttribute("subtitle", file);
+ writer.writeStartElement("description");
+ QString userFriendlyFilePath; // unused
+ writer.writeAttribute("path", Doc::resolveFile(en->doc().location(),
+ file,
+ &userFriendlyFilePath));
+ writer.writeAttribute("line", "0");
+ writer.writeAttribute("column", "0");
+
+ Quoter quoter;
+ Doc::quoteFromFile(en->doc().location(), quoter, file);
+ QString code = quoter.quoteTo(en->location(), QString(), QString());
+ writer.writeTextElement("code", trimmedTrailing(code, QString(), QString()));
- generateIndexSections(writer, pn);
+ writer.writeEndElement(); // description
+ writer.writeEndElement(); // page
writer.writeEndElement(); // document
writer.writeEndElement(); // WebXML
writer.writeEndDocument();
+
out() << data;
- endSubPage();
+ endFilePage();
}
void WebXMLGenerator::generateIndexSections(QXmlStreamWriter &writer, Node *node)
{
marker_ = CodeMarker::markerForFileName(node->location().filePath());
QDocIndexFiles::qdocIndexFiles()->generateIndexSections(writer, node, this);
+ // generateIndexSections does nothing for groups, so handle them explicitly
+ if (node->isGroup())
+ QDocIndexFiles::qdocIndexFiles()->generateIndexSection(writer, node, this);
}
// Handles callbacks from QDocIndexFiles to add documentation to node
@@ -180,6 +234,17 @@ void WebXMLGenerator::append(QXmlStreamWriter &writer, Node *node)
}
writer.writeEndElement(); // see-also
}
+
+ if (node->isExample()) {
+ supplement = true;
+ generateRequiredLinks(node, marker_);
+ supplement = false;
+ } else if (node->isGroup()) {
+ CollectionNode *cn = static_cast<CollectionNode *>(node);
+ if (!cn->noAutoList())
+ generateAnnotatedList(writer, node, cn->members());
+ }
+
writer.writeEndElement(); // description
}
@@ -225,6 +290,13 @@ const Atom *WebXMLGenerator::addAtomElements(QXmlStreamWriter &writer,
bool keepQuoting = false;
switch (atom->type()) {
+ case Atom::AnnotatedList:
+ {
+ const CollectionNode* cn = qdb_->getCollectionNode(atom->string(), Node::Group);
+ if (cn)
+ generateAnnotatedList(writer, relative, cn->members());
+ }
+ break;
case Atom::AutoLink:
if (!inLink && !inSectionHeading) {
const Node *node = nullptr;
@@ -349,6 +421,26 @@ const Atom *WebXMLGenerator::addAtomElements(QXmlStreamWriter &writer,
}
break;
+ case Atom::ExampleFileLink:
+ {
+ if (!inLink) {
+ QString link = linkForExampleFile(atom->string(), relative);
+ if (!link.isEmpty())
+ startLink(writer, atom, relative, link);
+ }
+ }
+ break;
+
+ case Atom::ExampleImageLink:
+ {
+ if (!inLink) {
+ QString link = atom->string();
+ if (!link.isEmpty())
+ startLink(writer, atom, nullptr, "images/used-in-examples/" + link);
+ }
+ }
+ break;
+
case Atom::FootnoteLeft:
writer.writeStartElement("footnote");
break;
@@ -453,7 +545,7 @@ const Atom *WebXMLGenerator::addAtomElements(QXmlStreamWriter &writer,
if (!inLink) {
const Node *node = nullptr;
QString link = getLink(atom, relative, &node);
- if (node)
+ if (!link.isEmpty())
startLink(writer, atom, node, link);
}
break;
@@ -668,27 +760,41 @@ const Atom *WebXMLGenerator::addAtomElements(QXmlStreamWriter &writer,
void WebXMLGenerator::startLink(QXmlStreamWriter &writer, const Atom *atom,
const Node *node, const QString &link)
{
- QString fullName = node->fullName();
+ QString fullName = link;
+ if (node)
+ fullName = node->fullName();
if (!fullName.isEmpty() && !link.isEmpty()) {
writer.writeStartElement("link");
writer.writeAttribute("raw", atom->string());
writer.writeAttribute("href", link);
writer.writeAttribute("type", targetType(node));
- switch (node->nodeType()) {
- case Node::Enum:
- writer.writeAttribute("enum", fullName);
- break;
- case Node::Page:
- writer.writeAttribute("page", fullName);
- break;
- case Node::Property:
- {
- const PropertyNode *propertyNode = static_cast<const PropertyNode *>(node);
- if (propertyNode->getters().size() > 0)
- writer.writeAttribute("getter", propertyNode->getters().at(0)->fullName());
- }
- default:
- ;
+ if (node) {
+ switch (node->nodeType()) {
+ case Node::Enum:
+ writer.writeAttribute("enum", fullName);
+ break;
+ case Node::Example:
+ {
+ const ExampleNode *en = static_cast<const ExampleNode *>(node);
+ QString fileTitle = exampleFileTitle(en, atom->string());
+ if (!fileTitle.isEmpty()) {
+ writer.writeAttribute("page", fileTitle);
+ break;
+ }
+ }
+ // fall through
+ case Node::Page:
+ writer.writeAttribute("page", fullName);
+ break;
+ case Node::Property:
+ {
+ const PropertyNode *propertyNode = static_cast<const PropertyNode *>(node);
+ if (propertyNode->getters().size() > 0)
+ writer.writeAttribute("getter", propertyNode->getters().at(0)->fullName());
+ }
+ default:
+ ;
+ }
}
inLink = true;
}
@@ -696,6 +802,9 @@ void WebXMLGenerator::startLink(QXmlStreamWriter &writer, const Atom *atom,
QString WebXMLGenerator::targetType(const Node *node)
{
+ if (!node)
+ return "external";
+
switch (node->nodeType()) {
case Node::Namespace:
return "namespace";
@@ -704,6 +813,7 @@ QString WebXMLGenerator::targetType(const Node *node)
case Node::Union:
return "class";
case Node::Page:
+ case Node::Example:
return "page";
case Node::Enum:
return "enum";
@@ -771,13 +881,16 @@ void WebXMLGenerator::generateRelations(QXmlStreamWriter &writer, const Node *no
void WebXMLGenerator::generateAnnotatedList(QXmlStreamWriter &writer,
const Node *relative, const NodeMap &nodeMap)
{
+ generateAnnotatedList(writer, relative, nodeMap.values());
+}
+
+void WebXMLGenerator::generateAnnotatedList(QXmlStreamWriter &writer,
+ const Node *relative, const NodeList &nodeList)
+{
writer.writeStartElement("table");
writer.writeAttribute("width", "100%");
- for (NodeMap::const_iterator it = nodeMap.cbegin(),
- end = nodeMap.cend(); it != end; ++it) {
- const Node *node = it.value();
-
+ for (const auto *node : nodeList) {
writer.writeStartElement("row");
writer.writeStartElement("heading");
generateFullName(writer, node, relative);
@@ -794,10 +907,14 @@ void WebXMLGenerator::generateAnnotatedList(QXmlStreamWriter &writer,
void WebXMLGenerator::generateFullName(QXmlStreamWriter &writer,
const Node *node, const Node *relative)
{
+ QString type = targetType(node);
+ QString name = node->fullName(relative);
writer.writeStartElement("link");
writer.writeAttribute("href", fullDocumentLocation(node));
- writer.writeAttribute("type", targetType(node));
- writer.writeCharacters(node->fullName(relative));
+ writer.writeAttribute("type", type);
+ if (type == QLatin1String("page"))
+ writer.writeAttribute("page", name);
+ writer.writeCharacters(name);
writer.writeEndElement(); // link
}
diff --git a/src/qdoc/webxmlgenerator.h b/src/qdoc/webxmlgenerator.h
index b52ffb398..5e3e0e9e2 100644
--- a/src/qdoc/webxmlgenerator.h
+++ b/src/qdoc/webxmlgenerator.h
@@ -34,6 +34,7 @@
#include "htmlgenerator.h"
#include "qdocindexfiles.h"
+#include <QtCore/qscopedpointer.h>
#include <QtCore/qxmlstream.h>
QT_BEGIN_NAMESPACE
@@ -54,6 +55,7 @@ protected:
void generateCppReferencePage(Aggregate *aggregate, CodeMarker *marker) override;
void generatePageNode(PageNode *pn, CodeMarker *marker) override;
void generateDocumentation(Node *node) override;
+ void generateExampleFilePage(const Node *en, const QString &file, CodeMarker *marker) override;
QString fileExtension() const override;
virtual const Atom *addAtomElements(QXmlStreamWriter &writer, const Atom *atom,
@@ -64,6 +66,7 @@ protected:
private:
const QPair<QString,QString> anchorForNode(const Node *node);
void generateAnnotatedList(QXmlStreamWriter &writer, const Node *relative, const NodeMap &nodeMap);
+ void generateAnnotatedList(QXmlStreamWriter &writer, const Node *relative, const NodeList &nodeList);
void generateFullName(QXmlStreamWriter &writer, const Node *node,
const Node *relative);
void generateRelations(QXmlStreamWriter &writer, const Node *node);
@@ -77,6 +80,8 @@ private:
bool hasQuotingInformation;
int numTableRows;
QString quoteCommand;
+ QScopedPointer<QXmlStreamWriter> currentWriter;
+ bool supplement = false;
};
QT_END_NAMESPACE