From d15309edeed53da021d058218e4c739e5903d8fd Mon Sep 17 00:00:00 2001 From: Topi Reinio Date: Wed, 16 Jul 2014 14:35:00 +0200 Subject: qdoc: Support use of \value command outside \enum topic. Even though qdoc accepts the \value command(s) anywhere in the documentation and generates tables for them, the produced output was invalid for documentation topics other than \enum. This change fixes the issue by not trying to resolve the enumeration values and removing the 'Value' column for generated tables when the \value command is used outside c++ enum documentation topic. This enables, for example, the use of the \value command for documenting acceptable values for QML enumeration properties, without having to use custom lists or tables. Task-number: QTBUG-35019 Change-Id: I597b2f9d7d03d4ab72f276752ddf53e1c405313c Reviewed-by: Jerome Pasion Reviewed-by: Martin Smith --- src/tools/qdoc/htmlgenerator.cpp | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) (limited to 'src/tools/qdoc/htmlgenerator.cpp') 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() << "" - << "" - << "\n"; + out() << ""; + + // If not in \enum topic, skip the value column + if (relative->type() == Node::Enum) + out() << ""; + + out() << "\n"; } else { - out() << "
ConstantValueDescription
ConstantValueDescription
" - << "\n"; + out() << "\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() << "
ConstantValue
ConstantValue
" << t << ""; + out() << "
" << t << ""; - QString itemValue; if (relative->type() == Node::Enum) { + out() << ""; const EnumNode *enume = static_cast(relative); - itemValue = enume->itemValue(atom->next()->string()); - } - - if (itemValue.isEmpty()) - out() << '?'; - else - out() << "" << protectEnc(itemValue) << ""; + QString itemValue = enume->itemValue(atom->next()->string()); + if (itemValue.isEmpty()) + out() << '?'; + else + out() << "" << protectEnc(itemValue) << ""; + } skipAhead = 1; } break; -- cgit v1.2.3