diff options
author | Liang Qi <liang.qi@qt.io> | 2019-07-02 09:14:50 +0200 |
---|---|---|
committer | Liang Qi <liang.qi@qt.io> | 2019-07-03 10:14:25 +0200 |
commit | e0d5c6f2b5147ce793a07d862d93d66837f4a925 (patch) | |
tree | 15d95b6e1e1356a1855844739ddc09d75928fd0d | |
parent | 725e7cabea0fb47f8890268a83ccdcf99722b328 (diff) | |
parent | 717a5e3eb8636488376580ae4bcf1959d4b30d6b (diff) | |
download | qttools-e0d5c6f2b5147ce793a07d862d93d66837f4a925.tar.gz |
Merge "Merge remote-tracking branch 'origin/5.13.0' into 5.13"
-rw-r--r-- | dist/changes-5.13.0 | 37 | ||||
-rw-r--r-- | src/qdoc/clangcodeparser.cpp | 111 | ||||
-rw-r--r-- | src/qdoc/htmlgenerator.cpp | 36 | ||||
-rw-r--r-- | src/qdoc/htmlgenerator.h | 2 | ||||
-rw-r--r-- | src/qdoc/node.cpp | 7 | ||||
-rw-r--r-- | src/qdoc/node.h | 1 | ||||
-rw-r--r-- | src/qdoc/sections.cpp | 15 |
7 files changed, 131 insertions, 78 deletions
diff --git a/dist/changes-5.13.0 b/dist/changes-5.13.0 new file mode 100644 index 000000000..2859e9260 --- /dev/null +++ b/dist/changes-5.13.0 @@ -0,0 +1,37 @@ +Qt 5.13 introduces many new features and improvements as well as bugfixes +over the 5.12.x series. 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. + +**************************************************************************** +* Designer * +**************************************************************************** + + - Added a filter line edit to the object inspector. + +**************************************************************************** +* lupdate * +**************************************************************************** + + - lupdate will now generate an error if it is asked to update a .ts file + with translations, but without a target language. This is to ensure that + plural translations are not destroyed. + +**************************************************************************** +* qdoc * +**************************************************************************** + + - [QTBUG-73058] qdoc now uses #! as a snippet marker in .cmake, + CMakeLists.txt files. diff --git a/src/qdoc/clangcodeparser.cpp b/src/qdoc/clangcodeparser.cpp index 4eaab69d7..9c4105992 100644 --- a/src/qdoc/clangcodeparser.cpp +++ b/src/qdoc/clangcodeparser.cpp @@ -1022,19 +1022,24 @@ void ClangCodeParser::initializeParser(const Config &config) version_ = config.getString(CONFIG_VERSION); const auto args = config.getStringList(CONFIG_INCLUDEPATHS); QStringList squeezedArgs; - int i = 0; - while (i < args.size()) { - if (args.at(i) != QLatin1String("-I")) { - if (args.at(i).startsWith(QLatin1String("-I"))) - squeezedArgs << args.at(i); - else - squeezedArgs << QLatin1String("-I") + args.at(i); - } - i++; + for (const auto &p : args) { + if (p.startsWith(QLatin1String("-I"))) + squeezedArgs << p.mid(2).trimmed(); + else + squeezedArgs << p; } + // Remove empty paths and duplicates + squeezedArgs.removeAll({}); + squeezedArgs.removeDuplicates(); includePaths_.resize(squeezedArgs.size()); std::transform(squeezedArgs.begin(), squeezedArgs.end(), includePaths_.begin(), - [](const QString &s) { return s.toUtf8(); }); + [](const QString &s) { + QByteArray path(s.toUtf8()); + QFileInfo fi(QDir::current(), s); + if (fi.exists()) + path = fi.canonicalFilePath().toUtf8(); + return path.prepend("-I"); + }); CppCodeParser::initializeParser(config); pchFileDir_.reset(nullptr); allHeaders_.clear(); @@ -1194,14 +1199,6 @@ bool ClangCodeParser::getMoreArgs() moreArgs_ = includePaths_; } - // Canonicalize include paths - for (int i = 0; i < moreArgs_.size(); ++i) { - if (!moreArgs_.at(i).startsWith("-")) { - QFileInfo fi(QDir::current(), moreArgs_[i]); - if (fi.exists()) - moreArgs_[i] = fi.canonicalFilePath().toLatin1(); - } - } return guessedIncludePaths; } @@ -1220,44 +1217,56 @@ void ClangCodeParser::buildPCH() QByteArray header; QByteArray privateHeaderDir; Location::logToStdErrAlways("Build & visit PCH for " + moduleHeader()); - // Find the path to the module's header (e.g. QtGui/QtGui) to be used - // as pre-compiled header - for (const auto &p : qAsConst(includePaths_)) { - if (p.endsWith(module)) { - QByteArray candidate = p + "/" + module; - if (QFile::exists(QString::fromUtf8(candidate))) { - header = candidate; + // A predicate for std::find_if() to locate a path to the module's header + // (e.g. QtGui/QtGui) to be used as pre-compiled header + struct FindPredicate { + enum SearchType { Any, Module, Private }; + QByteArray &candidate_; + const QByteArray &module_; + SearchType type_; + FindPredicate(QByteArray &candidate, const QByteArray &module, SearchType type = Any) + : candidate_(candidate), module_(module), type_(type) {} + + bool operator()(const QByteArray &p) const { + if (type_ != Any && !p.endsWith(module_)) + return false; + candidate_ = p + "/"; + switch (type_) { + case Any: + case Module: + candidate_.append(module_); break; - } - } - } - if (header.isEmpty()) { - for (const auto &p : qAsConst(includePaths_)) { - QByteArray candidate = p + "/" + module; - if (QFile::exists(QString::fromUtf8(candidate))) { - header = candidate; + case Private: + candidate_.append("private"); break; - } - } - } - // Find the path to the module's private header directory (e.g. - // include/QtGui/5.8.0/QtGui/private) to use for including all - // the private headers in the PCH. - for (const auto &p : qAsConst(includePaths_)) { - if (p.endsWith(module)) { - QByteArray candidate = p + "/private"; - if (QFile::exists(QString::fromUtf8(candidate))) { - privateHeaderDir = candidate; + default: break; } + if (p.startsWith("-I")) + candidate_ = candidate_.mid(2); + return QFile::exists(QString::fromUtf8(candidate_)); } - } - if (header.isEmpty()) { - QByteArray installDocDir = Config::installDir.toUtf8(); - const QByteArray candidate = installDocDir + "/../include/" + module + "/" + module; - if (QFile::exists(QString::fromUtf8(candidate))) - header = candidate; - } + }; + + // First, search for an include path that contains the module name, then any path + QByteArray candidate; + auto it = std::find_if(includePaths_.begin(), + includePaths_.end(), + FindPredicate(candidate, module, FindPredicate::Module)); + if (it == includePaths_.end()) + it = std::find_if(includePaths_.begin(), + includePaths_.end(), + FindPredicate(candidate, module, FindPredicate::Any)); + if (it != includePaths_.end()) + header = candidate; + + // Find the path to module's private headers - currently unused + it = std::find_if(includePaths_.begin(), + includePaths_.end(), + FindPredicate(candidate, module, FindPredicate::Private)); + if (it != includePaths_.end()) + privateHeaderDir = candidate; + if (header.isEmpty()) { qWarning() << "(qdoc) Could not find the module header in include paths for module" << module << " (include paths: "<< includePaths_ << ")"; diff --git a/src/qdoc/htmlgenerator.cpp b/src/qdoc/htmlgenerator.cpp index a359aefb1..c5f5b47dd 100644 --- a/src/qdoc/htmlgenerator.cpp +++ b/src/qdoc/htmlgenerator.cpp @@ -1728,7 +1728,7 @@ void HtmlGenerator::generateQmlTypePage(QmlTypeNode* qcn, CodeMarker* marker) out() << "<a name=\"" << ref << "\"></a>" << divNavTop << '\n'; out() << "<h2 id=\"" << ref << "\">" << protectEnc(s->title()) << "</h2>\n"; - generateQmlSummary(*s, qcn, marker); + generateQmlSummary(s->members(), qcn, marker); } ++s; } @@ -1794,7 +1794,7 @@ void HtmlGenerator::generateQmlBasicTypePage(QmlBasicTypeNode* qbtn, CodeMarker* out() << "<a name=\"" << ref << "\"></a>" << divNavTop << '\n'; out() << "<h2 id=\"" << ref << "\">" << protectEnc(s->title()) << "</h2>\n"; - generateQmlSummary(*s, qbtn, marker); + generateQmlSummary(s->members(), qbtn, marker); } ++s; } @@ -2866,7 +2866,7 @@ QString HtmlGenerator::generateObsoleteQmlMembersFile(const Sections §ions, out() << "<a name=\"" << ref << "\"></a>" << divNavTop << '\n'; out() << "<h2 id=\"" << ref << "\">" << protectEnc(summary_spv.at(i)->title()) << "</h2>\n"; - generateQmlSummary(*(summary_spv.at(i)), aggregate, marker); + generateQmlSummary(summary_spv.at(i)->obsoleteMembers(), aggregate, marker); } for (int i = 0; i < details_spv.size(); ++i) { @@ -4243,17 +4243,17 @@ void HtmlGenerator::endLink() } /*! - Generates the summary for the \a section. Only used for + Generates the summary list for the \a members. Only used for sections of QML element documentation. */ -void HtmlGenerator::generateQmlSummary(const Section& section, +void HtmlGenerator::generateQmlSummary(const NodeVector &members, const Node *relative, CodeMarker *marker) { - if (!section.members().isEmpty()) { + if (!members.isEmpty()) { out() << "<ul>\n"; - NodeVector::const_iterator m = section.members().constBegin(); - while (m != section.members().constEnd()) { + NodeVector::const_iterator m = members.constBegin(); + while (m != members.constEnd()) { out() << "<li class=\"fn\">"; generateQmlItem(*m, relative, marker, true); if ((*m)->isPropertyGroup()) { @@ -4304,19 +4304,21 @@ void HtmlGenerator::generateDetailedQmlMember(Node *node, QString qmlItemFooter("</table></div>\n</div>"); out() << "<div class=\"qmlitem\">"; - QString nodeRef = refForNode(node); + QString nodeRef; if (node->isPropertyGroup()) { const SharedCommentNode* scn = static_cast<const SharedCommentNode*>(node); QVector<Node*>::ConstIterator p = scn->collective().constBegin(); out() << "<div class=\"qmlproto\">"; out() << "<div class=\"table\"><table class=\"qmlname\">"; - - QString heading = scn->name() + " group"; - out() << "<tr valign=\"top\" class=\"even\" id=\"" << nodeRef << "\">"; - out() << "<th class=\"centerAlign\"><p>"; - out() << "<a name=\"" + nodeRef + "\"></a>"; - out() << "<b>" << heading << "</b>"; - out() << "</p></th></tr>"; + if (!scn->name().isEmpty()) { + nodeRef = refForNode(scn); + QString heading = scn->name() + " group"; + out() << "<tr valign=\"top\" class=\"even\" id=\"" << nodeRef << "\">"; + out() << "<th class=\"centerAlign\"><p>"; + out() << "<a name=\"" + nodeRef + "\"></a>"; + out() << "<b>" << heading << "</b>"; + out() << "</p></th></tr>"; + } while (p != scn->collective().constEnd()) { if ((*p)->isQmlProperty() || (*p)->isJsProperty()) { qpn = static_cast<QmlPropertyNode*>(*p); @@ -4360,7 +4362,7 @@ void HtmlGenerator::generateDetailedQmlMember(Node *node, out() << "<div class=\"fngroup\">\n"; out() << qmlItemHeader; for (const auto m : collective) { - if (m->isFunction(Node::CPP) || m->isFunction(Node::JS)) { + if (m->isFunction(Node::QML) || m->isFunction(Node::JS)) { out() << qmlItemStart.arg(nodeRef, "tblQmlFuncNode", refForNode(m)); generateSynopsis(m, relative, marker, Section::Details, false); out() << qmlItemEnd; diff --git a/src/qdoc/htmlgenerator.h b/src/qdoc/htmlgenerator.h index 3dba71a56..0c897483b 100644 --- a/src/qdoc/htmlgenerator.h +++ b/src/qdoc/htmlgenerator.h @@ -153,7 +153,7 @@ private: const Node *relative, CodeMarker *marker, Section::Status = Section::Active); - void generateQmlSummary(const Section& section, + void generateQmlSummary(const NodeVector &members, const Node *relative, CodeMarker *marker); void generateQmlItem(const Node *node, diff --git a/src/qdoc/node.cpp b/src/qdoc/node.cpp index d418190a3..5081f4370 100644 --- a/src/qdoc/node.cpp +++ b/src/qdoc/node.cpp @@ -1901,6 +1901,13 @@ HeaderNode::HeaderNode(Aggregate* parent, const QString& name) : Aggregate(Heade Aggregate::addIncludeFile(name); } +bool HeaderNode::docMustBeGenerated() const +{ + if (!hasDoc() || isInternal() || isDontDocument()) + return false; + return true; +} + /*! \class PageNode */ diff --git a/src/qdoc/node.h b/src/qdoc/node.h index 168ff79a4..5d5a90ab0 100644 --- a/src/qdoc/node.h +++ b/src/qdoc/node.h @@ -651,6 +651,7 @@ class HeaderNode : public Aggregate public: HeaderNode(Aggregate* parent, const QString& name); virtual ~HeaderNode() { } + bool docMustBeGenerated() const override; bool isFirstClassAggregate() const override { return true; } bool isRelatableType() const override { return true; } QString title() const override { return (title_.isEmpty() ? name() : title_); } diff --git a/src/qdoc/sections.cpp b/src/qdoc/sections.cpp index 452be566a..e0324b347 100644 --- a/src/qdoc/sections.cpp +++ b/src/qdoc/sections.cpp @@ -870,7 +870,7 @@ void Sections::distributeQmlNodeInDetailsVector(SectionVector &dv, Node *n) dv[QmlMethods].insert(fn); } } else if (n->isSharedCommentNode() && n->hasDoc()) { - dv[QmlMethods].insert(n); // incorrect? + dv[n->isPropertyGroup() ? QmlProperties : QmlMethods].insert(n); } } @@ -901,14 +901,11 @@ void Sections::distributeQmlNodeInSummaryVector(SectionVector &sv, Node *n) } } else if (n->isSharedCommentNode()) { SharedCommentNode *scn = static_cast<SharedCommentNode*>(n); - if (scn->isPropertyGroup()) { - if (scn->name().isEmpty()) { - foreach (Node *n, scn->collective()) { - sv[QmlProperties].insert(n); - } - } else { - sv[QmlProperties].insert(scn); - } + if (scn->name().isEmpty()) { + for (auto child : scn->collective()) + sv[child->isFunction(Node::QML) ? QmlMethods : QmlProperties].insert(child); + } else { + sv[QmlProperties].insert(scn); } } } |