diff options
author | Bea Lam <bea.lam@nokia.com> | 2009-10-16 06:02:56 (GMT) |
---|---|---|
committer | Bea Lam <bea.lam@nokia.com> | 2009-10-16 06:02:56 (GMT) |
commit | b5702e57ff6ab2e6fda63d760198ea417d312e89 (patch) | |
tree | 2055fc09b9e04849968ea56145539d4ebf9550cf /tools/qmlviewer/qmlviewer.cpp | |
parent | fb5d5ce1cd1e2714343c3e26338601aa5dd79a54 (diff) | |
download | Qt-b5702e57ff6ab2e6fda63d760198ea417d312e89.zip Qt-b5702e57ff6ab2e6fda63d760198ea417d312e89.tar.gz Qt-b5702e57ff6ab2e6fda63d760198ea417d312e89.tar.bz2 |
Don't try to open non-qml files.
Diffstat (limited to 'tools/qmlviewer/qmlviewer.cpp')
-rw-r--r-- | tools/qmlviewer/qmlviewer.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/tools/qmlviewer/qmlviewer.cpp b/tools/qmlviewer/qmlviewer.cpp index 07b68ea..a8034cf 100644 --- a/tools/qmlviewer/qmlviewer.cpp +++ b/tools/qmlviewer/qmlviewer.cpp @@ -630,6 +630,11 @@ void QmlViewer::openQml(const QString& fileName) QUrl url(fileName); QFileInfo fi(fileName); if (fi.exists()) { + if (fi.suffix().toLower() != QLatin1String("qml")) { + qWarning() << "qmlviewer cannot open non-QML file" << fileName; + return; + } + url = QUrl::fromLocalFile(fi.absoluteFilePath()); QmlContext *ctxt = canvas->rootContext(); QDir dir(fi.path()+"/dummydata", "*.qml"); @@ -658,6 +663,9 @@ void QmlViewer::openQml(const QString& fileName) dummyData->setParent(this); } } + } else { + qWarning() << "qmlviewer cannot find file:" << fileName; + return; } canvas->setUrl(url); |