Skip to content

Commit 07c092e

Browse files
shiboken6/Documentation: Fix warnings about non-existing class reference files
Only add top level classes to the file list, unless the module uses flat documentation mode. Amends a8b0954. Pick-to: 6.8 Task-number: PYSIDE-1106 Change-Id: I0d89980f896177b7d5ce162c32067eb38a52401b Reviewed-by: Shyamnath Premnadh <[email protected]>
1 parent 918cd72 commit 07c092e

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

sources/shiboken6/generator/qtdoc/qtdocgenerator.cpp

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ struct DocClassEntry
5959
QString name;
6060
QString fullName;
6161
QString file;
62+
bool nested = false;
6263
};
6364

6465
static bool classEntryLessThan(const DocClassEntry &e1, const DocClassEntry &e2)
@@ -255,7 +256,7 @@ static void readExtraDoc(const QFileInfo &fi,
255256
auto dot = name.lastIndexOf(u'.');
256257
if (dot != -1)
257258
name.remove(0, dot + 1);
258-
docPackage->classPages.append({name, fullClassName, newFileName});
259+
docPackage->classPages.append({name, fullClassName, newFileName, false});
259260
}
260261
extraTocEntries->append(fileNameToTocEntry(newFileName));
261262
}
@@ -468,8 +469,9 @@ void QtDocGenerator::generateClassRecursion(TextStream &s, const QString &target
468469

469470
qCDebug(lcShibokenDoc, "Generating Documentation for %s", qPrintable(metaClass->fullName()));
470471

472+
const bool nested = metaClass->enclosingClass() != nullptr;
471473
m_packages[metaClass->package()].classPages.append({metaClass->name(), metaClass->fullName(),
472-
fileNameForContext(classContext)});
474+
fileNameForContext(classContext), nested});
473475

474476
doGenerateClass(s, targetDir, metaClass);
475477

@@ -1242,6 +1244,10 @@ void QtDocGenerator::writeModuleDocumentation()
12421244
QtXmlToSphinxImages parsedImages;
12431245
TextStream& s = output.stream;
12441246

1247+
TypeSystemTypeEntryCPtr typeSystemEntry = typeDb->findTypeSystemType(it.key());
1248+
Q_ASSERT(typeSystemEntry);
1249+
const auto docMode = typeSystemEntry->docMode();
1250+
12451251
const QString &title = it.key();
12461252
s << ".. module:: " << title << "\n\n" << headline(title, '*');
12471253

@@ -1281,8 +1287,10 @@ void QtDocGenerator::writeModuleDocumentation()
12811287
<< ":maxdepth: 1\n\n";
12821288
if (hasGlobals)
12831289
s << globalsPage << '\n';
1284-
for (const auto &e : std::as_const(docPackage.classPages))
1285-
s << e.file << '\n';
1290+
for (const auto &e : std::as_const(docPackage.classPages)) {
1291+
if (!e.nested || docMode == TypeSystem::DocMode::Flat)
1292+
s << e.file << '\n';
1293+
}
12861294
s << "\n\n" << outdent << outdent << headline("Detailed Description");
12871295

12881296
// module doc is always wrong and C++istic, so go straight to the extra directory!
@@ -1324,10 +1332,7 @@ void QtDocGenerator::writeModuleDocumentation()
13241332
<< moduleDocumentation.qmlTypesUrl << ">`_\n\n";
13251333
}
13261334

1327-
TypeSystemTypeEntryCPtr typeSystemEntry = typeDb->findTypeSystemType(it.key());
1328-
Q_ASSERT(typeSystemEntry);
1329-
writeFancyToc(s, "List of Classes", classEntryListToToc(docPackage.classPages,
1330-
typeSystemEntry->docMode()),
1335+
writeFancyToc(s, "List of Classes", classEntryListToToc(docPackage.classPages, docMode),
13311336
"class"_L1);
13321337
writeFancyToc(s, "List of Decorators", fileListToToc(docPackage.decoratorPages),
13331338
"deco"_L1);

0 commit comments

Comments
 (0)