Fix file browser in qmlvideofx example.
Similar to de9092389f for qmlvideo.
Use QUrl::fromLocalFile() to get Windows drive handling
right. Emulate its behavior in QML code. Fix up() to terminate
correctly.
Task-number: QTBUG-32139
Change-Id: I36bafaa608ff054190dc76694f6254a74f3b513e
Reviewed-by: Yoann Lopes <yoann.lopes@digia.com>
This commit is contained in:
committed by
The Qt Project
parent
188b59609b
commit
c86d14a380
@@ -116,21 +116,13 @@ int main(int argc, char *argv[])
|
||||
FileReader fileReader;
|
||||
viewer.rootContext()->setContextProperty("fileReader", &fileReader);
|
||||
|
||||
QUrl appPath(QString("file://%1").arg(app.applicationDirPath()));
|
||||
QUrl imagePath;
|
||||
const QUrl appPath(QUrl::fromLocalFile(app.applicationDirPath()));
|
||||
const QStringList picturesLocation = QStandardPaths::standardLocations(QStandardPaths::PicturesLocation);
|
||||
if (picturesLocation.isEmpty())
|
||||
imagePath = appPath.resolved(QUrl("images"));
|
||||
else
|
||||
imagePath = QString("file://%1").arg(picturesLocation.first());
|
||||
const QUrl imagePath = picturesLocation.isEmpty() ? appPath : QUrl::fromLocalFile(picturesLocation.first());
|
||||
viewer.rootContext()->setContextProperty("imagePath", imagePath);
|
||||
|
||||
QUrl videoPath;
|
||||
const QStringList moviesLocation = QStandardPaths::standardLocations(QStandardPaths::MoviesLocation);
|
||||
if (moviesLocation.isEmpty())
|
||||
videoPath = appPath.resolved(QUrl("./"));
|
||||
else
|
||||
videoPath = QString("file://%1").arg(moviesLocation.first());
|
||||
const QUrl videoPath = moviesLocation.isEmpty() ? appPath : QUrl::fromLocalFile(moviesLocation.first());
|
||||
viewer.rootContext()->setContextProperty("videoPath", videoPath);
|
||||
|
||||
viewer.setTitle("qmlvideofx");
|
||||
|
||||
Reference in New Issue
Block a user