diff options
author | Warwick Allison <warwick.allison@nokia.com> | 2009-10-26 07:36:27 (GMT) |
---|---|---|
committer | Warwick Allison <warwick.allison@nokia.com> | 2009-10-26 07:36:27 (GMT) |
commit | 8881a5b0756a8960a2fbbb5d5f476ff1d7505446 (patch) | |
tree | 9d197fc593fcdc9cc78dbf9e2905a20221b5205c /tools/qmlviewer/qmlviewer.cpp | |
parent | 883dc50950e6109d0cfb7a42e144d529076b9be3 (diff) | |
download | Qt-8881a5b0756a8960a2fbbb5d5f476ff1d7505446.zip Qt-8881a5b0756a8960a2fbbb5d5f476ff1d7505446.tar.gz Qt-8881a5b0756a8960a2fbbb5d5f476ff1d7505446.tar.bz2 |
Fix for windows paths.
(i.e. nb. "\")
Diffstat (limited to 'tools/qmlviewer/qmlviewer.cpp')
-rw-r--r-- | tools/qmlviewer/qmlviewer.cpp | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/tools/qmlviewer/qmlviewer.cpp b/tools/qmlviewer/qmlviewer.cpp index b115abb..3157377 100644 --- a/tools/qmlviewer/qmlviewer.cpp +++ b/tools/qmlviewer/qmlviewer.cpp @@ -606,7 +606,7 @@ void QmlViewer::addLibraryPath(const QString& lib) void QmlViewer::reload() { - openQml(canvas->url()); + openQml(currentFileOrUrl); } void QmlViewer::open() @@ -615,7 +615,7 @@ void QmlViewer::open() QString fileName = QFileDialog::getOpenFileName(this, tr("Open QML file"), cur, tr("QML Files (*.qml)")); if (!fileName.isEmpty()) { QFileInfo fi(fileName); - openQml(QUrl::fromLocalFile(fi.absoluteFilePath())); + openQml(fi.absoluteFilePath()); } } @@ -624,16 +624,24 @@ void QmlViewer::executeErrors() if (tester) tester->executefailure(); } -void QmlViewer::openQml(const QUrl& url) +void QmlViewer::openQml(const QString& file_or_url) { - QString fileName = url.toLocalFile(); - setWindowTitle(tr("%1 - Qt Declarative UI Viewer").arg(fileName.isEmpty() ? url.toString() : fileName)); + currentFileOrUrl = file_or_url; + + QUrl url; + QFileInfo fi(file_or_url); + if (fi.exists()) + url = QUrl::fromLocalFile(fi.absoluteFilePath()); + else + url = QUrl(file_or_url); + setWindowTitle(tr("%1 - Qt Declarative UI Viewer").arg(file_or_url)); if (!m_script.isEmpty()) tester = new QFxTester(m_script, m_scriptOptions, canvas); canvas->reset(); + QString fileName = url.toLocalFile(); if (!fileName.isEmpty()) { QFileInfo fi(fileName); if (fi.exists()) { |