Skip to content

Commit 330da82

Browse files
author
Martin Smith
committed
qdoc: Instantiator::objectAt now appear in docs
There was a bug in bool CppCodeParser::splitQmlMethodArg(), which has now been fixed. The bug occurred when there was a "::" in the return type. Change-Id: Id31ed0d4a03d84e76fb69403441a3491ec884ddc Task-number: QTBUG-47438 Reviewed-by: Topi Reiniö <[email protected]> Reviewed-by: Andrew Knight <[email protected]>
1 parent 8c5ce68 commit 330da82

File tree

1 file changed

+24
-25
lines changed

1 file changed

+24
-25
lines changed

src/tools/qdoc/cppcodeparser.cpp

+24-25
Original file line numberDiff line numberDiff line change
@@ -687,10 +687,10 @@ bool CppCodeParser::splitQmlPropertyArg(const QString& arg,
687687
<type> <QML-type>::<name>(<param>, <param>, ...)
688688
<type> <QML-module>::<QML-type>::<name>(<param>, <param>, ...)
689689
690-
This function splits the argument into one of those two
691-
forms, sets \a module, \a qmlTypeName, and \a name, and returns
692-
true. If the argument doesn't match either form, an error
693-
message is emitted and false is returned.
690+
This function splits the \a{arg}ument into one of those
691+
two forms, sets \a type, \a module, and \a qmlTypeName,
692+
and returns true. If the argument doesn't match either
693+
form, an error message is emitted and false is returned.
694694
695695
\note The two QML types \e{Component} and \e{QtObject} never
696696
have a module qualifier.
@@ -700,30 +700,29 @@ bool CppCodeParser::splitQmlMethodArg(const QString& arg,
700700
QString& module,
701701
QString& qmlTypeName)
702702
{
703-
QStringList colonSplit(arg.split("::"));
703+
QString name;
704+
int leftParen = arg.indexOf(QChar('('));
705+
if (leftParen > 0)
706+
name = arg.left(leftParen);
707+
else
708+
name = arg;
709+
int firstBlank = name.indexOf(QChar(' '));
710+
if (firstBlank > 0) {
711+
type = name.left(firstBlank);
712+
name = name.right(name.length() - firstBlank - 1);
713+
}
714+
else
715+
type.clear();
716+
717+
QStringList colonSplit(name.split("::"));
704718
if (colonSplit.size() > 1) {
705-
QStringList blankSplit = colonSplit[0].split(QLatin1Char(' '));
706-
if (blankSplit.size() > 1) {
707-
type = blankSplit[0];
708-
if (colonSplit.size() > 2) {
709-
module = blankSplit[1];
710-
qmlTypeName = colonSplit[1];
711-
}
712-
else {
713-
module.clear();
714-
qmlTypeName = blankSplit[1];
715-
}
719+
if (colonSplit.size() > 2) {
720+
module = colonSplit[0];
721+
qmlTypeName = colonSplit[1];
716722
}
717723
else {
718-
type.clear();
719-
if (colonSplit.size() > 2) {
720-
module = colonSplit[0];
721-
qmlTypeName = colonSplit[1];
722-
}
723-
else {
724-
module.clear();
725-
qmlTypeName = colonSplit[0];
726-
}
724+
module.clear();
725+
qmlTypeName = colonSplit[0];
727726
}
728727
return true;
729728
}

0 commit comments

Comments
 (0)