Commit a41876cd authored by Daniel Molkentin's avatar Daniel Molkentin
Browse files

Do not add a menu if the examples cannot be found.

This is not only a waste of ressources, but breaks a check later on
which tries to load the QML examples from Creators ressource path
if no QML capable Qt version is found (included with Creator packages)

Reviewed-by: dt
parent ec0d44fc
examples/declarative/
\ No newline at end of file
/home/danimo/dev/qt-4.7/examples/
\ No newline at end of file
......@@ -175,8 +175,6 @@ void GettingStartedWelcomePageWidget::updateQmlExamples(const QString &examplePa
const QString &sourcePath)
{
ui->qmlExamplesButton->setText(tr("Choose an example..."));
QMenu *menu = new QMenu(ui->qmlExamplesButton);
ui->qmlExamplesButton->setMenu(menu);
QStringList roots;
roots << (examplePath + QLatin1String("/declarative"))
......@@ -197,14 +195,20 @@ void GettingStartedWelcomePageWidget::updateQmlExamples(const QString &examplePa
exampleProjects.insert(fileName, exampleProject);
}
}
QMapIterator<QString, QString> it(exampleProjects);
while (it.hasNext()) {
it.next();
QAction *exampleAction = menu->addAction(it.key());
connect(exampleAction, SIGNAL(triggered()), SLOT(slotOpenExample()));
exampleAction->setProperty(ExamplePathPropertyName, it.value());
// FIXME once we have help for QML examples
// exampleAction->setProperty(HelpPathPropertyName, helpPath);
if (!exampleProjects.isEmpty()) {
QMenu *menu = new QMenu(ui->qmlExamplesButton);
ui->qmlExamplesButton->setMenu(menu);
QMapIterator<QString, QString> it(exampleProjects);
while (it.hasNext()) {
it.next();
QAction *exampleAction = menu->addAction(it.key());
connect(exampleAction, SIGNAL(triggered()), SLOT(slotOpenExample()));
exampleAction->setProperty(ExamplePathPropertyName, it.value());
// FIXME once we have help for QML examples
// exampleAction->setProperty(HelpPathPropertyName, helpPath);
}
}
ui->qmlExamplesButton->setEnabled(!exampleProjects.isEmpty());
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment