qdoc: attaching type of attached properties was missing

This bug was probably intoroduced when the QmlPropertyGroup
became a first class Node type. Otherwise, there is no way
to explain how it worked at all. But now qdoc includes the
attaching type.

Some debugging code was also cleaned up.

Task-number: QTBUG-35559
Change-Id: I478efb7f4356d51015af9f33c893958d4b4ae301
Reviewed-by: Topi Reiniö <topi.reinio@digia.com>
This commit is contained in:
Martin Smith 2014-04-24 14:02:42 +02:00 committed by The Qt Project
parent 0ccbe33a04
commit 761265ef64
6 changed files with 28 additions and 23 deletions

View File

@ -102,15 +102,16 @@ bool Generator::redirectDocumentationToDevNull_ = false;
Generator::Passes Generator::qdocPass_ = Both;
bool Generator::useOutputSubdirs_ = true;
void Generator::setDebugFlag(bool b)
void Generator::startDebugging(const QString& message)
{
#if 0
if (b)
qDebug() << "DEBUG: Setting debug flag.";
else
qDebug() << "DEBUG: Clearing debug flag.";
#endif
debugging_ = b;
debugging_ = true;
qDebug() << "START DEBUGGING:" << message;
}
void Generator::stopDebugging(const QString& message)
{
debugging_ = false;
qDebug() << "STOP DEBUGGING:" << message;
}
/*!

View File

@ -93,7 +93,8 @@ public:
static void writeOutFileNames();
static void augmentImageDirs(QSet<QString>& moreImageDirs);
static void debug(const QString& message);
static void setDebugFlag(bool b);
static void startDebugging(const QString& message);
static void stopDebugging(const QString& message);
static bool debugging() { return debugging_; }
static bool noLinkErrors() { return noLinkErrors_; }
static bool autolinkErrors() { return autolinkErrors_; }

View File

@ -302,11 +302,7 @@ int HtmlGenerator::generateAtom(const Atom *atom, const Node *relative, CodeMark
{
int skipAhead = 0;
static bool in_para = false;
#if 0
if (Generator::debugging()) {
atom->dump();
}
#endif
switch (atom->type()) {
case Atom::AbstractLeft:
if (relative)
@ -320,7 +316,6 @@ int HtmlGenerator::generateAtom(const Atom *atom, const Node *relative, CodeMark
if (!inLink_ && !inContents_ && !inSectionHeading_) {
const Node *node = 0;
QString link = getLink(atom, relative, &node);
QDocDatabase::debug = false;
if (!link.isEmpty()) {
beginLink(link, node, relative);
generateLink(atom, marker);

View File

@ -490,7 +490,6 @@ static void processQdocconfFile(const QString &fileName)
CodeParser *codeParser = CodeParser::parserForSourceFile(s.key());
if (codeParser) {
++parsed;
//Generator::setDebugFlag(true);
Generator::debug(QString("Parsing " + s.key()));
codeParser->parseSourceFile(config.location(), s.key());
usedParsers.insert(codeParser);
@ -498,7 +497,6 @@ static void processQdocconfFile(const QString &fileName)
++s;
}
Generator::debug(QString("Parsing done."));
//Generator::setDebugFlag(false);
foreach (CodeParser *codeParser, usedParsers)
codeParser->doneParsingSourceFiles();
@ -654,7 +652,7 @@ int main(int argc, char **argv)
autolinkErrors = true;
}
else if (opt == "-debug") {
Generator::setDebugFlag(true);
Generator::startDebugging(QString("command line"));
}
else if (opt == "-prepare") {
Generator::setQDocPass(Generator::Prepare);

View File

@ -2336,6 +2336,16 @@ PropertyNode* QmlPropertyNode::findCorrespondingCppProperty()
return 0;
}
/*!
This returns the name of the owning QML type.
*/
QString QmlPropertyNode::element() const
{
if (parent()->isQmlPropertyGroup())
return parent()->element();
return parent()->name();
}
/*! \class NameCollisionNode
An instance of this node is inserted in the tree

View File

@ -247,6 +247,7 @@ public:
virtual Node* disambiguate(Type , SubType ) { return this; }
virtual bool wasSeen() const { return false; }
virtual void appendGroupName(const QString& ) { }
virtual QString element() const { return QString(); }
bool isIndexNode() const { return indexNodeFlag_; }
Type type() const { return nodeType_; }
virtual SubType subType() const { return NoSubType; }
@ -658,7 +659,7 @@ public:
virtual QString idNumber();
virtual bool isQmlPropertyGroup() const { return true; }
const QString& element() const { return parent()->name(); }
virtual QString element() const { return parent()->name(); }
private:
int idNumber_;
@ -697,8 +698,7 @@ public:
virtual QString qmlModuleName() const { return parent()->qmlModuleName(); }
virtual QString qmlModuleVersion() const { return parent()->qmlModuleVersion(); }
virtual QString qmlModuleIdentifier() const { return parent()->qmlModuleIdentifier(); }
const QString& element() const { return static_cast<QmlPropertyGroupNode*>(parent())->element(); }
virtual QString element() const;
private:
PropertyNode* findCorrespondingCppProperty();
@ -858,7 +858,7 @@ public:
QStringList reconstructParams(bool values = false) const;
QString signature(bool values = false) const;
const QString& element() const { return parent()->name(); }
virtual QString element() const { return parent()->name(); }
virtual bool isAttached() const { return attached_; }
virtual bool isQmlNode() const {
return ((type() == QmlSignal) ||