summaryrefslogtreecommitdiffstats
path: root/src/tools
diff options
context:
space:
mode:
Diffstat (limited to 'src/tools')
-rw-r--r--src/tools/qdoc/config.cpp2
-rw-r--r--src/tools/qdoc/cppcodeparser.cpp49
-rw-r--r--src/tools/qdoc/cppcodeparser.h1
-rw-r--r--src/tools/qdoc/htmlgenerator.cpp6
-rw-r--r--src/tools/qdoc/puredocparser.cpp4
-rw-r--r--src/tools/qdoc/qdocdatabase.cpp52
-rw-r--r--src/tools/qdoc/qdocdatabase.h6
-rw-r--r--src/tools/qdoc/tree.cpp12
-rw-r--r--src/tools/qdoc/tree.h6
-rw-r--r--src/tools/uic/qclass_lib_map.h6
10 files changed, 93 insertions, 51 deletions
diff --git a/src/tools/qdoc/config.cpp b/src/tools/qdoc/config.cpp
index 107af96607..273cb60d7d 100644
--- a/src/tools/qdoc/config.cpp
+++ b/src/tools/qdoc/config.cpp
@@ -1089,7 +1089,7 @@ QStringList Config::getFilesHere(const QString& uncleanDir,
const QSet<QString> &excludedDirs,
const QSet<QString> &excludedFiles)
{
- QString dir = location.isEmpty() ? QDir::cleanPath(uncleanDir) : Location::canonicalRelativePath(uncleanDir);
+ QString dir = location.isEmpty() ? QDir::cleanPath(uncleanDir) : QDir(uncleanDir).canonicalPath();
QStringList result;
if (excludedDirs.contains(dir))
return result;
diff --git a/src/tools/qdoc/cppcodeparser.cpp b/src/tools/qdoc/cppcodeparser.cpp
index dc086c853d..d0f3ab3667 100644
--- a/src/tools/qdoc/cppcodeparser.cpp
+++ b/src/tools/qdoc/cppcodeparser.cpp
@@ -207,10 +207,10 @@ void CppCodeParser::parseSourceFile(const Location& location, const QString& fil
readToken();
/*
- The set of active namespaces is cleared before parsing
+ The set of open namespaces is cleared before parsing
each source file. The word "source" here means cpp file.
*/
- activeNamespaces_.clear();
+ qdb_->clearOpenNamespaces();
matchDocsAndStuff();
in.close();
@@ -323,21 +323,18 @@ Node* CppCodeParser::processTopicCommand(const Doc& doc,
doc.startLocation().warning(tr("Invalid syntax in '\\%1'").arg(COMMAND_FN));
}
else {
- if (!activeNamespaces_.isEmpty()) {
- foreach (const QString& usedNamespace_, activeNamespaces_) {
- QStringList newPath = usedNamespace_.split("::") + parentPath;
- func = qdb_->findFunctionNode(newPath, clone);
- if (func)
- break;
- }
- }
- // Search the root namespace if no match was found.
- if (func == 0)
+ func = qdb_->findNodeInOpenNamespace(parentPath, clone);
+ /*
+ Search the root namespace if no match was found.
+ */
+ if (func == 0) {
func = qdb_->findFunctionNode(parentPath, clone);
+ }
if (func == 0) {
- if (parentPath.isEmpty() && !lastPath_.isEmpty())
+ if (parentPath.isEmpty() && !lastPath_.isEmpty()) {
func = qdb_->findFunctionNode(lastPath_, clone);
+ }
if (func == 0) {
doc.location().warning(tr("Cannot find '%1' in '\\%2' %3")
.arg(clone->name() + "(...)")
@@ -426,16 +423,7 @@ Node* CppCodeParser::processTopicCommand(const Doc& doc,
C++ namespace, search for it first in all the known
C++ namespaces.
*/
- if (!activeNamespaces_.isEmpty()) {
- foreach (const QString& usedNamespace_, activeNamespaces_) {
- QStringList newPath = usedNamespace_.split("::") + path;
- node = qdb_->findNodeByNameAndType(newPath, type, subtype);
- if (node) {
- path = newPath;
- break;
- }
- }
- }
+ node = qdb_->findNodeInOpenNamespace(path, type, subtype);
/*
If the node was not found in a C++ namespace, search
@@ -458,7 +446,7 @@ Node* CppCodeParser::processTopicCommand(const Doc& doc,
if (path.size() > 1) {
path.pop_back();
QString ns = path.join("::");
- activeNamespaces_.insert(ns);
+ qdb_->insertOpenNamespace(ns);
}
}
return node;
@@ -1718,7 +1706,7 @@ bool CppCodeParser::matchUsingDecl()
/*
So far, so good. We have 'using namespace Foo;'.
*/
- activeNamespaces_.insert(name);
+ qdb_->insertOpenNamespace(name);
return true;
}
@@ -2125,13 +2113,7 @@ bool CppCodeParser::matchDocsAndStuff()
FunctionNode *func = 0;
if (matchFunctionDecl(0, &parentPath, &clone, QString(), extra)) {
- foreach (const QString& usedNamespace_, activeNamespaces_) {
- QStringList newPath = usedNamespace_.split("::") + parentPath;
- func = qdb_->findFunctionNode(newPath, clone);
- if (func) {
- break;
- }
- }
+ func = qdb_->findNodeInOpenNamespace(parentPath, clone);
if (func == 0)
func = qdb_->findFunctionNode(parentPath, clone);
@@ -2256,9 +2238,8 @@ bool CppCodeParser::makeFunctionNode(const QString& signature,
Tokenizer* outerTokenizer = tokenizer;
int outerTok = tok;
- Location loc;
QByteArray latin1 = signature.toLatin1();
- Tokenizer stringTokenizer(loc, latin1);
+ Tokenizer stringTokenizer(location(), latin1);
stringTokenizer.setParsingFnOrMacro(true);
tokenizer = &stringTokenizer;
readToken();
diff --git a/src/tools/qdoc/cppcodeparser.h b/src/tools/qdoc/cppcodeparser.h
index eae5d1e97d..957142712b 100644
--- a/src/tools/qdoc/cppcodeparser.h
+++ b/src/tools/qdoc/cppcodeparser.h
@@ -166,7 +166,6 @@ protected:
QStringList lastPath_;
QRegExp varComment;
QRegExp sep;
- QSet<QString> activeNamespaces_;
private:
QString sequentialIteratorDefinition;
diff --git a/src/tools/qdoc/htmlgenerator.cpp b/src/tools/qdoc/htmlgenerator.cpp
index 7e1467f300..3d6f04decf 100644
--- a/src/tools/qdoc/htmlgenerator.cpp
+++ b/src/tools/qdoc/htmlgenerator.cpp
@@ -1755,12 +1755,12 @@ void HtmlGenerator::generateHeader(const QString& title,
if (shortVersion.count(QChar('.')) == 2)
shortVersion.truncate(shortVersion.lastIndexOf(QChar('.')));
if (!project.isEmpty())
- shortVersion = project + QLatin1Char(' ') + shortVersion + QLatin1String(": ");
+ shortVersion = QLatin1String(" | ") + project + QLatin1Char(' ') + shortVersion;
else
- shortVersion = QLatin1String("Qt ") + shortVersion + QLatin1String(": ");
+ shortVersion = QLatin1String(" | ") + QLatin1String("Qt ") + shortVersion ;
// Generating page title
- out() << " <title>" << shortVersion << protectEnc(title) << "</title>\n";
+ out() << " <title>" << protectEnc(title) << shortVersion << "</title>\n";
// Include style sheet and script links.
out() << headerStyles;
diff --git a/src/tools/qdoc/puredocparser.cpp b/src/tools/qdoc/puredocparser.cpp
index aba17d79b1..d11ef3a3c7 100644
--- a/src/tools/qdoc/puredocparser.cpp
+++ b/src/tools/qdoc/puredocparser.cpp
@@ -101,10 +101,10 @@ void PureDocParser::parseSourceFile(const Location& location, const QString& fil
readToken();
/*
- The set of active namespaces is cleared before parsing
+ The set of open namespaces is cleared before parsing
each source file. The word "source" here means cpp file.
*/
- activeNamespaces_.clear();
+ qdb_->clearOpenNamespaces();
processQdocComments();
in.close();
diff --git a/src/tools/qdoc/qdocdatabase.cpp b/src/tools/qdoc/qdocdatabase.cpp
index 674917f6dc..7a3df4e4f2 100644
--- a/src/tools/qdoc/qdocdatabase.cpp
+++ b/src/tools/qdoc/qdocdatabase.cpp
@@ -1126,4 +1126,56 @@ QString QDocDatabase::refForAtom(const Atom* atom)
return QString();
}
+/*!
+ If there are open namespaces, search for the function node
+ having the same function name as the \a clone node in each
+ open namespace. The \a parentPath is a portion of the path
+ name provided with the function name at the point of
+ reference. \a parentPath is usually a class name. Return
+ the pointer to the function node if one is found in an
+ open namespace. Otherwise return 0.
+
+ This open namespace concept is of dubious value and might
+ be removed.
+ */
+FunctionNode* QDocDatabase::findNodeInOpenNamespace(const QStringList& parentPath,
+ const FunctionNode* clone)
+{
+ FunctionNode* fn = 0;
+ if (!openNamespaces_.isEmpty()) {
+ foreach (const QString& t, openNamespaces_) {
+ QStringList path = t.split("::") + parentPath;
+ fn = findFunctionNode(path, clone);
+ if (fn)
+ break;
+ }
+ }
+ return fn;
+}
+
+/*!
+ Find a node of the specified \a type and \a subtype that is
+ reached with the specified \a path. If such a node is found
+ in an open namespace, prefix \a path with the name of the
+ open namespace and "::" and return a pointer to the node.
+ Othewrwise return 0.
+ */
+Node* QDocDatabase::findNodeInOpenNamespace(QStringList& path,
+ Node::Type type,
+ Node::SubType subtype)
+{
+ Node* n = 0;
+ if (!openNamespaces_.isEmpty()) {
+ foreach (const QString& t, openNamespaces_) {
+ QStringList p = t.split("::") + path;
+ n = findNodeByNameAndType(p, type, subtype);
+ if (n) {
+ path = p;
+ break;
+ }
+ }
+ }
+ return n;
+}
+
QT_END_NAMESPACE
diff --git a/src/tools/qdoc/qdocdatabase.h b/src/tools/qdoc/qdocdatabase.h
index d97fb3809a..d88160ee56 100644
--- a/src/tools/qdoc/qdocdatabase.h
+++ b/src/tools/qdoc/qdocdatabase.h
@@ -196,6 +196,11 @@ class QDocDatabase
Generator* g,
bool generateInternalNodes = false);
+ void clearOpenNamespaces() { openNamespaces_.clear(); }
+ void insertOpenNamespace(const QString& path) { openNamespaces_.insert(path); }
+ FunctionNode* findNodeInOpenNamespace(const QStringList& parentPath, const FunctionNode* clone);
+ Node* findNodeInOpenNamespace(QStringList& path, Node::Type type, Node::SubType subtype);
+
/* debugging functions */
void printModules() const;
void printQmlModules() const;
@@ -240,6 +245,7 @@ class QDocDatabase
TextToNodeMap legaleseTexts_;
DocNodeMultiMap docNodesByTitle_;
TargetRecMultiMap targetRecMultiMap_;
+ QSet<QString> openNamespaces_;
};
QT_END_NAMESPACE
diff --git a/src/tools/qdoc/tree.cpp b/src/tools/qdoc/tree.cpp
index 1efab11a92..553c569ae9 100644
--- a/src/tools/qdoc/tree.cpp
+++ b/src/tools/qdoc/tree.cpp
@@ -367,7 +367,11 @@ const FunctionNode* Tree::findFunctionNode(const QStringList& parentPath,
const Node* relative,
int findFlags) const
{
- const Node* parent = findNode(parentPath, relative, findFlags);
+ const Node* parent = findNamespaceNode(parentPath);
+ if (parent == 0)
+ parent = findClassNode(parentPath, 0);
+ if (parent == 0)
+ parent = findNode(parentPath, relative, findFlags);
if (parent == 0 || !parent->isInnerNode())
return 0;
return ((InnerNode*)parent)->findFunctionNode(clone);
@@ -658,7 +662,7 @@ Node* Tree::findNodeRecursive(const QStringList& path,
Node* start,
Node::Type type,
Node::SubType subtype,
- bool acceptCollision)
+ bool acceptCollision) const
{
if (!start || path.isEmpty())
return 0; // no place to start, or nothing to search for.
@@ -736,7 +740,7 @@ EnumNode* Tree::findEnumNode(const QStringList& path, Node* start)
at the root of the tree. Only a C++ class node named \a path is
acceptible. If one is not found, 0 is returned.
*/
-ClassNode* Tree::findClassNode(const QStringList& path, Node* start)
+ClassNode* Tree::findClassNode(const QStringList& path, Node* start) const
{
if (!start)
start = const_cast<NamespaceNode*>(root());
@@ -748,7 +752,7 @@ ClassNode* Tree::findClassNode(const QStringList& path, Node* start)
the root of the tree. Only a Namespace node named \a path
is acceptible. If one is not found, 0 is returned.
*/
-NamespaceNode* Tree::findNamespaceNode(const QStringList& path)
+NamespaceNode* Tree::findNamespaceNode(const QStringList& path) const
{
Node* start = const_cast<NamespaceNode*>(root());
return static_cast<NamespaceNode*>(findNodeRecursive(path, 0, start, Node::Namespace, Node::NoSubType));
diff --git a/src/tools/qdoc/tree.h b/src/tools/qdoc/tree.h
index 67cd3a9752..e44b8d7d12 100644
--- a/src/tools/qdoc/tree.h
+++ b/src/tools/qdoc/tree.h
@@ -82,9 +82,9 @@ class Tree
~Tree();
EnumNode* findEnumNode(const QStringList& path, Node* start = 0);
- ClassNode* findClassNode(const QStringList& path, Node* start = 0);
+ ClassNode* findClassNode(const QStringList& path, Node* start = 0) const;
QmlClassNode* findQmlTypeNode(const QStringList& path);
- NamespaceNode* findNamespaceNode(const QStringList& path);
+ NamespaceNode* findNamespaceNode(const QStringList& path) const;
DocNode* findQmlModuleNode(const QStringList& path, Node* start = 0);
Node* findNodeByNameAndType(const QStringList& path,
@@ -98,7 +98,7 @@ class Tree
Node* start,
Node::Type type,
Node::SubType subtype,
- bool acceptCollision = false);
+ bool acceptCollision = false) const;
const Node* findNode(const QStringList &path,
const Node* relative = 0,
diff --git a/src/tools/uic/qclass_lib_map.h b/src/tools/uic/qclass_lib_map.h
index 6859cd0cd4..cedefb801a 100644
--- a/src/tools/uic/qclass_lib_map.h
+++ b/src/tools/uic/qclass_lib_map.h
@@ -587,8 +587,8 @@ QT_CLASS_LIB(QFontDialog, QtWidgets, qfontdialog.h)
QT_CLASS_LIB(QInputDialog, QtWidgets, qinputdialog.h)
QT_CLASS_LIB(QMessageBox, QtWidgets, qmessagebox.h)
QT_CLASS_LIB(QPageSetupDialog, QtWidgets, qpagesetupdialog.h)
-QT_CLASS_LIB(QPrintDialog, QtWidgets, qprintdialog.h)
-QT_CLASS_LIB(QPrintPreviewDialog, QtWidgets, qprintpreviewdialog.h)
+QT_CLASS_LIB(QPrintDialog, QtPrintSupport, qprintdialog.h)
+QT_CLASS_LIB(QPrintPreviewDialog, QtPrintSupport, qprintpreviewdialog.h)
QT_CLASS_LIB(QProgressDialog, QtWidgets, qprogressdialog.h)
QT_CLASS_LIB(QWizard, QtWidgets, qwizard.h)
QT_CLASS_LIB(QWizardPage, QtWidgets, qwizard.h)
@@ -944,7 +944,7 @@ QT_CLASS_LIB(QMenuBar, QtWidgets, qmenubar.h)
QT_CLASS_LIB(QMenuItem, QtWidgets, qmenudata.h)
QT_CLASS_LIB(QPlainTextEdit, QtWidgets, qplaintextedit.h)
QT_CLASS_LIB(QPlainTextDocumentLayout, QtWidgets, qplaintextedit.h)
-QT_CLASS_LIB(QPrintPreviewWidget, QtWidgets, qprintpreviewwidget.h)
+QT_CLASS_LIB(QPrintPreviewWidget, QtPrintSupport, qprintpreviewwidget.h)
QT_CLASS_LIB(QProgressBar, QtWidgets, qprogressbar.h)
QT_CLASS_LIB(QPushButton, QtWidgets, qpushbutton.h)
QT_CLASS_LIB(QRadioButton, QtWidgets, qradiobutton.h)