Don't show qml only projects under C++ examples

Filter out all examples that are missing a .pro file. Afterwards
remove empty categories.
This commit is contained in:
Kai Koehne
2010-08-23 15:55:50 +02:00
parent 091287da29
commit 56f735425a

View File

@@ -157,6 +157,10 @@ void GettingStartedWelcomePageWidget::updateCppExamples(const QString &examplePa
QString fileName = examplePath + relativeProPath; QString fileName = examplePath + relativeProPath;
if (!QFile::exists(fileName)) if (!QFile::exists(fileName))
fileName = sourcePath + QLatin1String("/examples") + relativeProPath; fileName = sourcePath + QLatin1String("/examples") + relativeProPath;
if (!QFile::exists(fileName)) {
continue; // might be .qmlproject
}
QString dirName1 = dirName; QString dirName1 = dirName;
dirName1.replace(slash, QLatin1Char('-')); dirName1.replace(slash, QLatin1Char('-'));
QString helpPath = QLatin1String("qthelp://com.trolltech.qt/qdoc/") + QString helpPath = QLatin1String("qthelp://com.trolltech.qt/qdoc/") +
@@ -178,6 +182,15 @@ void GettingStartedWelcomePageWidget::updateCppExamples(const QString &examplePa
break; break;
} }
} }
// Remove empty categories
foreach (QAction *action, menu->actions()) {
if (QMenu *subMenu = action->menu()) {
if (subMenu->isEmpty()) {
menu->removeAction(action);
}
}
}
} }
void GettingStartedWelcomePageWidget::updateQmlExamples(const QString &examplePath, void GettingStartedWelcomePageWidget::updateQmlExamples(const QString &examplePath,