Tidy up file browsing in video examples
* Use QStandardPaths to determine the initial folder displayed when the file browser is launched * Persist folder between file browser invocations Change-Id: I5b86dd3d304c3f33802f3189716e1d360774198d Reviewed-by: Jonas Rabbe <jonas.rabbe@nokia.com>
This commit is contained in:
committed by
Qt by Nokia
parent
87ec3461c1
commit
b6f54c8833
@@ -39,8 +39,10 @@
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include <QtCore/QStandardPaths>
|
||||
#include <QtCore/QString>
|
||||
#include <QtCore/QStringList>
|
||||
#include <QtDeclarative/QDeclarativeContext>
|
||||
#include <QtGui/QGuiApplication>
|
||||
#include <QtQuick/QQuickItem>
|
||||
#include "qmlapplicationviewer.h"
|
||||
@@ -124,6 +126,12 @@ int main(int argc, char *argv[])
|
||||
rootObject, SLOT(qmlFramePainted()));
|
||||
#endif
|
||||
|
||||
QString videoPath;
|
||||
const QStringList moviesLocation = QStandardPaths::standardLocations(QStandardPaths::MoviesLocation);
|
||||
if (!moviesLocation.isEmpty())
|
||||
videoPath = moviesLocation.first();
|
||||
viewer.rootContext()->setContextProperty("videoPath", videoPath);
|
||||
|
||||
QMetaObject::invokeMethod(rootObject, "init");
|
||||
|
||||
viewer.showExpanded();
|
||||
|
||||
Reference in New Issue
Block a user