diff options
author | Daniel Molkentin <daniel.molkentin@nokia.com> | 2010-05-31 11:04:00 +0200 |
---|---|---|
committer | hjk <qtc-committer@nokia.com> | 2010-06-01 11:18:14 +0200 |
commit | 721dbde25ae7a5a394ef1af4754eb7904ead636c (patch) | |
tree | b6a98a561c412c16ac3acb4f69cf765c501fc5b3 | |
parent | 9ecbfcd3cbe15c71bd7567620fe3eb4353c3d080 (diff) |
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
(cherry picked from commit a41876cd4105869e3a830523d7172f1804f285c9)
l--------- | share/qtcreator/declarative | 1 | ||||
l--------- | share/qtcreator/examples | 1 | ||||
-rw-r--r-- | src/plugins/qt4projectmanager/gettingstartedwelcomepagewidget.cpp | 24 |
3 files changed, 16 insertions, 10 deletions
diff --git a/share/qtcreator/declarative b/share/qtcreator/declarative new file mode 120000 index 0000000000..286404c10d --- /dev/null +++ b/share/qtcreator/declarative @@ -0,0 +1 @@ +examples/declarative/
\ No newline at end of file diff --git a/share/qtcreator/examples b/share/qtcreator/examples new file mode 120000 index 0000000000..d5679a7d34 --- /dev/null +++ b/share/qtcreator/examples @@ -0,0 +1 @@ +/home/danimo/dev/qt-4.7/examples/
\ No newline at end of file diff --git a/src/plugins/qt4projectmanager/gettingstartedwelcomepagewidget.cpp b/src/plugins/qt4projectmanager/gettingstartedwelcomepagewidget.cpp index 58a25be523..a8a74ddff9 100644 --- a/src/plugins/qt4projectmanager/gettingstartedwelcomepagewidget.cpp +++ b/src/plugins/qt4projectmanager/gettingstartedwelcomepagewidget.cpp @@ -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()); |