diff --git a/src/tools/qdoc/cppcodemarker.cpp b/src/tools/qdoc/cppcodemarker.cpp
index 60c7142229..d3cb111873 100644
--- a/src/tools/qdoc/cppcodemarker.cpp
+++ b/src/tools/qdoc/cppcodemarker.cpp
@@ -403,6 +403,9 @@ QString CppCodeMarker::markedUpFullName(const Node *node, const Node *relative)
QString CppCodeMarker::markedUpEnumValue(const QString &enumValue, const Node *relative)
{
+ if (relative->type() != Node::Enum)
+ return enumValue;
+
const Node *node = relative->parent();
QString fullName;
while (node->parent()) {
diff --git a/src/tools/qdoc/doc/qdoc-manual-markupcmds.qdoc b/src/tools/qdoc/doc/qdoc-manual-markupcmds.qdoc
index 435e243014..c04cdeca2b 100644
--- a/src/tools/qdoc/doc/qdoc-manual-markupcmds.qdoc
+++ b/src/tools/qdoc/doc/qdoc-manual-markupcmds.qdoc
@@ -2543,6 +2543,13 @@
file or namespace documentation. See the \l {enum-command}
{\\enum} documentation for an example.
+ \note Since Qt 5.4, \\value command can also be used outside the
+ \l {enum-command} {\\enum} topic. In this case, QDoc renders a
+ two-column table listing the constant name (taken as-is from the
+ first argument) and its description. This can be used, for
+ example, in \l {qmlproperty-command}{\\qmlproperty} topic for
+ documenting acceptable values for a QML enumeration property.
+
See also \l {enum-command} {\\enum} and \l {omitvalue-command} {\\omitvalue}.
\target omitvalue-command
diff --git a/src/tools/qdoc/doc/qdoc-manual-topiccmds.qdoc b/src/tools/qdoc/doc/qdoc-manual-topiccmds.qdoc
index b9667b7758..b50a343a22 100644
--- a/src/tools/qdoc/doc/qdoc-manual-topiccmds.qdoc
+++ b/src/tools/qdoc/doc/qdoc-manual-topiccmds.qdoc
@@ -1315,6 +1315,10 @@
\l {http://qt-project.org/doc/qt-4.7/qml-translate.html} {Translate}
element.
+ If the QML property is of enumeration type, or it holds a bit-wise
+ combination of flags, the \l{value-command}{\\value} command can
+ be used to document the acceptable values.
+
\target qmlsignal-command
\section1 \\qmlsignal
diff --git a/src/tools/qdoc/htmlgenerator.cpp b/src/tools/qdoc/htmlgenerator.cpp
index 46c90205fe..7a19e3c027 100644
--- a/src/tools/qdoc/htmlgenerator.cpp
+++ b/src/tools/qdoc/htmlgenerator.cpp
@@ -854,21 +854,24 @@ int HtmlGenerator::generateAtom(const Atom *atom, const Node *relative, CodeMark
out() << "
\n";
}
else if (atom->string() == ATOM_LIST_VALUE) {
+ out() << "";
threeColumnEnumValueTable_ = isThreeColumnEnumValueTable(atom);
if (threeColumnEnumValueTable_) {
- out() << "";
if (++numTableRows_ % 2 == 1)
out() << "";
else
out() << "
";
- out() << "| Constant | "
- << "Value | "
- << "Description |
\n";
+ out() << "Constant | ";
+
+ // If not in \enum topic, skip the value column
+ if (relative->type() == Node::Enum)
+ out() << "Value | ";
+
+ out() << "Description | \n";
}
else {
- out() << ""
- << "| Constant | Value |
\n";
+ out() << "| Constant | Value |
\n";
}
}
else {
@@ -903,19 +906,18 @@ int HtmlGenerator::generateAtom(const Atom *atom, const Node *relative, CodeMark
// ### Trenton
QString t= protectEnc(plainCode(marker->markedUpEnumValue(atom->next()->string(),relative)));
- out() << "| " << t << " | ";
+ out() << " |
| " << t << "";
- QString itemValue;
if (relative->type() == Node::Enum) {
+ out() << " | ";
const EnumNode *enume = static_cast(relative);
- itemValue = enume->itemValue(atom->next()->string());
+ QString itemValue = enume->itemValue(atom->next()->string());
+
+ if (itemValue.isEmpty())
+ out() << '?';
+ else
+ out() << "" << protectEnc(itemValue) << "";
}
-
- if (itemValue.isEmpty())
- out() << '?';
- else
- out() << "" << protectEnc(itemValue) << "";
-
skipAhead = 1;
}
break;
|