Made the view a sublcass of QDeclarativeView
authorLuciano Montanaro <mikelima@cirulla.net>
Fri, 15 Jul 2011 10:30:46 +0000 (12:30 +0200)
committerLuciano Montanaro <mikelima@cirulla.net>
Tue, 27 Dec 2011 22:16:43 +0000 (23:16 +0100)
application/view.cpp
application/view.h

index 7dd2611..e1a9e06 100644 (file)
@@ -1,5 +1,6 @@
 #include "view.h"
 #include <QDeclarativeView>
+#include <QDeclarativeEngine>
 #include <QDebug>
 #include <QDir>
 #include <QFile>
@@ -28,13 +29,13 @@ static QString trueFilePath(QString path)
 }
 
 View::View(QWidget *parent) :
-    QWidget(parent),
-    m_view(new QDeclarativeView(this))
+    QDeclarativeView(parent)
 {
     showFullScreen();
 
     // This does not seem ot work in harmattan. As a workaround, change dir to
     // the qml dir, then load the file.
     // m_view->setSource(QUrl::fromLocalFile("qml:main.qml"));
-    m_view->setSource(QUrl::fromLocalFile(trueFilePath("qml:main.qml")));
+    qDebug() << "import path list:" << engine()->importPathList();
+    setSource(QUrl::fromLocalFile(trueFilePath("qml:main.qml")));
 }
index 17870c6..5266e27 100644 (file)
@@ -1,11 +1,9 @@
 #ifndef QP_VIEW_H
 #define QP_VIEW_H
 
-#include <QWidget>
+#include <QDeclarativeView>
 
-class QDeclarativeView;
-
-class View : public QWidget
+class View : public QDeclarativeView
 {
     Q_OBJECT
 public:
@@ -16,7 +14,6 @@ signals:
 public slots:
 
 private:
-    QDeclarativeView *m_view;
 };
 
 #endif // QP_VIEW_H