2 #include <QDeclarativeView>
7 // search Paths seem to be broken in Harmattan?
9 static QString trueFilePath(QString path)
11 qDebug() << "searching for" << path;
12 QString searchPathName = path.section(':', 0, 0);
13 qDebug() << "path is" << searchPathName;
14 QString fileName = path.section(':', 1, 1);
15 qDebug() << "filename is" << fileName;
16 QStringList dirs = QDir::searchPaths(searchPathName);
17 foreach(QString dir, dirs) {
18 qDebug() << "searching in" << dir;
20 QString absoluteFileName = current.absoluteFilePath(fileName);
21 if (current.exists(fileName)) {
22 qDebug() << "found " << fileName << "in path" << absoluteFileName;
23 return absoluteFileName;
26 qDebug() << "file not found";
30 View::View(QWidget *parent) :
32 m_view(new QDeclarativeView(this))
36 // This does not seem ot work in harmattan. As a workaround, change dir to
37 // the qml dir, then load the file.
38 // m_view->setSource(QUrl::fromLocalFile("qml:main.qml"));
39 m_view->setSource(QUrl::fromLocalFile(trueFilePath("qml:main.qml")));