diff options
-rw-r--r-- | examples/multimedia/video/qmlvideo/main.cpp | 9 | ||||
-rw-r--r-- | examples/multimedia/video/qmlvideo/qml/qmlvideo/FileBrowser.qml | 5 |
2 files changed, 9 insertions, 5 deletions
diff --git a/examples/multimedia/video/qmlvideo/main.cpp b/examples/multimedia/video/qmlvideo/main.cpp index e595e4fc8..1a9c52391 100644 --- a/examples/multimedia/video/qmlvideo/main.cpp +++ b/examples/multimedia/video/qmlvideo/main.cpp @@ -127,10 +127,13 @@ int main(int argc, char *argv[]) rootObject, SLOT(qmlFramePainted())); #endif - QString videoPath; + QUrl videoPath; const QStringList moviesLocation = QStandardPaths::standardLocations(QStandardPaths::MoviesLocation); - if (!moviesLocation.isEmpty()) - videoPath = moviesLocation.first(); + if (moviesLocation.isEmpty()) { + QUrl appPath(QString("file:///%1").arg(app.applicationDirPath())); + videoPath = appPath.resolved(QUrl("./")); + } else + videoPath = QString("file:///%1").arg(moviesLocation.first()); viewer.rootContext()->setContextProperty("videoPath", videoPath); QMetaObject::invokeMethod(rootObject, "init"); diff --git a/examples/multimedia/video/qmlvideo/qml/qmlvideo/FileBrowser.qml b/examples/multimedia/video/qmlvideo/qml/qmlvideo/FileBrowser.qml index 48b538bba..d0e69424d 100644 --- a/examples/multimedia/video/qmlvideo/qml/qmlvideo/FileBrowser.qml +++ b/examples/multimedia/video/qmlvideo/qml/qmlvideo/FileBrowser.qml @@ -100,10 +100,11 @@ Rectangle { Rectangle { id: wrapper function launch() { + var path = "file:///" + filePath; if (folders.isFolder(index)) - down(filePath); + down(path); else - fileBrowser.selectFile(filePath) + fileBrowser.selectFile(path) } width: root.width height: 52 |