Help: Register at least one set of documentation per major Qt version

The default configuration only registers documentation files only once,
from the highest registered Qt version. This made sense within the Qt 5
series, since Qt documentation for the higher version included all items
from the lower versions.

With Qt 6 this changes - some API was removed in Qt 6. To make sure that
documentation of all Qt 5 API is still available, we have to register
the newest available documentation for Qt 5 and Qt 6, not only of Qt 6
(the overall newest available documentation).

Expands 3dfa188182

Change-Id: I8b2984b0be11dcc823ef4a206800c84887b632ca
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
This commit is contained in:
Eike Ziller
2020-11-19 12:49:29 +01:00
parent f697a0d46c
commit 1dcb7e5550

View File

@@ -502,14 +502,18 @@ static QList<std::pair<Path, FileName>> documentationFiles(BaseQtVersion *v)
static QStringList documentationFiles(const QList<BaseQtVersion *> &vs, bool highestOnly = false) static QStringList documentationFiles(const QList<BaseQtVersion *> &vs, bool highestOnly = false)
{ {
QSet<QString> includedFileNames; // if highestOnly is true, register each file only once per major Qt version, even if
// multiple minor or patch releases of that major version are installed
QHash<int, QSet<QString>> includedFileNames; // major Qt version -> names
QSet<QString> filePaths; QSet<QString> filePaths;
const QList<BaseQtVersion *> versions = highestOnly ? QtVersionManager::sortVersions(vs) : vs; const QList<BaseQtVersion *> versions = highestOnly ? QtVersionManager::sortVersions(vs) : vs;
for (BaseQtVersion *v : versions) { for (BaseQtVersion *v : versions) {
const int majorVersion = v->qtVersion().majorVersion;
QSet<QString> &majorVersionFileNames = includedFileNames[majorVersion];
for (const std::pair<Path, FileName> &file : documentationFiles(v)) { for (const std::pair<Path, FileName> &file : documentationFiles(v)) {
if (!highestOnly || !includedFileNames.contains(file.second)) { if (!highestOnly || !majorVersionFileNames.contains(file.second)) {
filePaths.insert(file.first + file.second); filePaths.insert(file.first + file.second);
includedFileNames.insert(file.second); majorVersionFileNames.insert(file.second);
} }
} }
} }