Doc: Added \qtvariable command to QDoc.
Specifies the QT variable needed in the .pro file. The argument of the command is the qmake QT variable. To use, add "\qtvariable <value>" to a QDoc comment which contains the \module command. QDoc will then associate the class with the QT variable. Only supported for C++ classes at the moment. Part of work done for QTBUG-32172 Task-number: QTBUG-32172 Change-Id: Ia8eea30fcfc771191c23a5f5994a48732959ea49 Reviewed-by: Martin Smith <martin.smith@digia.com>
This commit is contained in:
parent
0ace311213
commit
e4f99e0285
@ -65,6 +65,7 @@ QT_BEGIN_NAMESPACE
|
|||||||
#define COMMAND_PAGEKEYWORDS Doc::alias(QLatin1String("pagekeywords"))
|
#define COMMAND_PAGEKEYWORDS Doc::alias(QLatin1String("pagekeywords"))
|
||||||
#define COMMAND_PRELIMINARY Doc::alias(QLatin1String("preliminary"))
|
#define COMMAND_PRELIMINARY Doc::alias(QLatin1String("preliminary"))
|
||||||
#define COMMAND_INPUBLICGROUP Doc::alias(QLatin1String("inpublicgroup"))
|
#define COMMAND_INPUBLICGROUP Doc::alias(QLatin1String("inpublicgroup"))
|
||||||
|
#define COMMAND_QTVARIABLE Doc::alias(QLatin1String("qtvariable"))
|
||||||
#define COMMAND_REENTRANT Doc::alias(QLatin1String("reentrant"))
|
#define COMMAND_REENTRANT Doc::alias(QLatin1String("reentrant"))
|
||||||
#define COMMAND_SINCE Doc::alias(QLatin1String("since"))
|
#define COMMAND_SINCE Doc::alias(QLatin1String("since"))
|
||||||
#define COMMAND_SUBTITLE Doc::alias(QLatin1String("subtitle"))
|
#define COMMAND_SUBTITLE Doc::alias(QLatin1String("subtitle"))
|
||||||
@ -218,6 +219,7 @@ const QSet<QString>& CodeParser::commonMetaCommands()
|
|||||||
<< COMMAND_PAGEKEYWORDS
|
<< COMMAND_PAGEKEYWORDS
|
||||||
<< COMMAND_PRELIMINARY
|
<< COMMAND_PRELIMINARY
|
||||||
<< COMMAND_INPUBLICGROUP
|
<< COMMAND_INPUBLICGROUP
|
||||||
|
<< COMMAND_QTVARIABLE
|
||||||
<< COMMAND_REENTRANT
|
<< COMMAND_REENTRANT
|
||||||
<< COMMAND_SINCE
|
<< COMMAND_SINCE
|
||||||
<< COMMAND_SUBTITLE
|
<< COMMAND_SUBTITLE
|
||||||
@ -321,6 +323,15 @@ void CodeParser::processCommonMetaCommand(const Location& location,
|
|||||||
else
|
else
|
||||||
location.warning(tr("Ignored '\\%1'").arg(COMMAND_TITLE));
|
location.warning(tr("Ignored '\\%1'").arg(COMMAND_TITLE));
|
||||||
}
|
}
|
||||||
|
else if (command == COMMAND_QTVARIABLE) {
|
||||||
|
if (node->subType() == Node::Module) {
|
||||||
|
DocNode *dn = static_cast<DocNode *>(node);
|
||||||
|
dn->setQtVariable(arg.first);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
location.warning(tr("Command '\\%1' found outside of '\\module'. It can only be used within a module page.")
|
||||||
|
.arg(COMMAND_QTVARIABLE));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
@ -241,6 +241,7 @@ protected:
|
|||||||
#define COMMAND_LICENSENAME Doc::alias("licensename")
|
#define COMMAND_LICENSENAME Doc::alias("licensename")
|
||||||
#define COMMAND_LICENSEDESCRIPTION Doc::alias("licensedescription")
|
#define COMMAND_LICENSEDESCRIPTION Doc::alias("licensedescription")
|
||||||
#define COMMAND_RELEASEDATE Doc::alias("releasedate")
|
#define COMMAND_RELEASEDATE Doc::alias("releasedate")
|
||||||
|
#define COMMAND_QTVARIABLE Doc::alias("qtvariable")
|
||||||
|
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
|
@ -1835,11 +1835,12 @@ void HtmlGenerator::generateRequisites(InnerNode *inner, CodeMarker *marker)
|
|||||||
QMap<QString, Text> requisites;
|
QMap<QString, Text> requisites;
|
||||||
Text text;
|
Text text;
|
||||||
|
|
||||||
const QString headerText = "Header:";
|
const QString headerText = "Header";
|
||||||
const QString sinceText = "Since:";
|
const QString sinceText = "Since";
|
||||||
const QString inheritedBytext = "Inherited By:";
|
const QString inheritedBytext = "Inherited By";
|
||||||
const QString inheritsText = "Inherits:";
|
const QString inheritsText = "Inherits";
|
||||||
const QString instantiatedByText = "Instantiated By:";
|
const QString instantiatedByText = "Instantiated By";
|
||||||
|
const QString qtVariableText = "qmake";
|
||||||
|
|
||||||
//add the includes to the map
|
//add the includes to the map
|
||||||
if (!inner->includes().isEmpty()) {
|
if (!inner->includes().isEmpty()) {
|
||||||
@ -1856,6 +1857,7 @@ void HtmlGenerator::generateRequisites(InnerNode *inner, CodeMarker *marker)
|
|||||||
//The order of the requisites matter
|
//The order of the requisites matter
|
||||||
QStringList requisiteorder;
|
QStringList requisiteorder;
|
||||||
requisiteorder << headerText
|
requisiteorder << headerText
|
||||||
|
<< qtVariableText
|
||||||
<< sinceText
|
<< sinceText
|
||||||
<< instantiatedByText
|
<< instantiatedByText
|
||||||
<< inheritsText
|
<< inheritsText
|
||||||
@ -1932,6 +1934,16 @@ void HtmlGenerator::generateRequisites(InnerNode *inner, CodeMarker *marker)
|
|||||||
requisites.insert(inheritedBytext, text);
|
requisites.insert(inheritedBytext, text);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//add the QT variable to the map
|
||||||
|
DocNode * moduleNode = qdb_->findModule(classe->moduleName());
|
||||||
|
if (moduleNode || !moduleNode->qtVariable().isEmpty()) {
|
||||||
|
text.clear();
|
||||||
|
text << Atom(Atom::FormattingLeft, ATOM_FORMATTING_TELETYPE)
|
||||||
|
<< "QT += " + moduleNode->qtVariable()
|
||||||
|
<< Atom(Atom::FormattingRight, ATOM_FORMATTING_TELETYPE);
|
||||||
|
requisites.insert(qtVariableText, text);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!requisites.isEmpty()) {
|
if (!requisites.isEmpty()) {
|
||||||
@ -1944,7 +1956,7 @@ void HtmlGenerator::generateRequisites(InnerNode *inner, CodeMarker *marker)
|
|||||||
if (requisites.contains(*i)) {
|
if (requisites.contains(*i)) {
|
||||||
out() << "<tr>"
|
out() << "<tr>"
|
||||||
<< "<td class=\"memItemLeft rightAlign topAlign\"> "
|
<< "<td class=\"memItemLeft rightAlign topAlign\"> "
|
||||||
<< *i
|
<< *i << ":"
|
||||||
<< "</td><td class=\"memItemRight bottomAlign\"> ";
|
<< "</td><td class=\"memItemRight bottomAlign\"> ";
|
||||||
|
|
||||||
if (*i == headerText)
|
if (*i == headerText)
|
||||||
|
@ -455,7 +455,7 @@ public:
|
|||||||
virtual bool isClass() const { return true; }
|
virtual bool isClass() const { return true; }
|
||||||
virtual bool isWrapper() const { return wrapper_; }
|
virtual bool isWrapper() const { return wrapper_; }
|
||||||
virtual QString obsoleteLink() const { return obsoleteLink_; }
|
virtual QString obsoleteLink() const { return obsoleteLink_; }
|
||||||
virtual void setObsoleteLink(const QString& t) { obsoleteLink_ = t; };
|
virtual void setObsoleteLink(const QString& t) { obsoleteLink_ = t; }
|
||||||
virtual void setWrapper() { wrapper_ = true; }
|
virtual void setWrapper() { wrapper_ = true; }
|
||||||
|
|
||||||
void addBaseClass(Access access,
|
void addBaseClass(Access access,
|
||||||
@ -497,9 +497,11 @@ public:
|
|||||||
PageType ptype);
|
PageType ptype);
|
||||||
virtual ~DocNode() { }
|
virtual ~DocNode() { }
|
||||||
|
|
||||||
|
void setQtVariable(const QString &variable) { qtVariable_ = variable; }
|
||||||
void setTitle(const QString &title) { title_ = title; }
|
void setTitle(const QString &title) { title_ = title; }
|
||||||
void setSubTitle(const QString &subTitle) { subtitle_ = subTitle; }
|
void setSubTitle(const QString &subTitle) { subtitle_ = subTitle; }
|
||||||
|
|
||||||
|
QString qtVariable() const { return qtVariable_; }
|
||||||
SubType subType() const { return nodeSubtype_; }
|
SubType subType() const { return nodeSubtype_; }
|
||||||
virtual QString title() const;
|
virtual QString title() const;
|
||||||
virtual QString fullTitle() const;
|
virtual QString fullTitle() const;
|
||||||
@ -513,6 +515,9 @@ protected:
|
|||||||
SubType nodeSubtype_;
|
SubType nodeSubtype_;
|
||||||
QString title_;
|
QString title_;
|
||||||
QString subtitle_;
|
QString subtitle_;
|
||||||
|
|
||||||
|
private:
|
||||||
|
QString qtVariable_;
|
||||||
};
|
};
|
||||||
|
|
||||||
class NameCollisionNode : public DocNode
|
class NameCollisionNode : public DocNode
|
||||||
|
Loading…
Reference in New Issue
Block a user