[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [kmines/viranch/qtquick] src: Move declarative view initialization stuff
From:       Viranch Mehta <viranch.mehta () gmail ! com>
Date:       2013-04-21 18:53:54
Message-ID: 20130421185354.8E492A603D () git ! kde ! org
[Download RAW message or body]

Git commit 3a8374a02317625dc23ad6c05225d03c3d1a7bff by Viranch Mehta.
Committed on 21/04/2013 at 20:12.
Pushed by viranch into branch 'viranch/qtquick'.

Move declarative view initialization stuff
(setSource etc) to separate function, which
is called after theme provider is set so as
to suppress the QML "provider undefined" errors

M  +4    -0    src/canvaswidget.cpp
M  +1    -0    src/canvaswidget.h
M  +1    -0    src/mainwindow.cpp

http://commits.kde.org/kmines/3a8374a02317625dc23ad6c05225d03c3d1a7bff

diff --git a/src/canvaswidget.cpp b/src/canvaswidget.cpp
index 288325c..707ef2d 100644
--- a/src/canvaswidget.cpp
+++ b/src/canvaswidget.cpp
@@ -24,6 +24,10 @@
 CanvasWidget::CanvasWidget(QWidget *parent) :
     KgDeclarativeView(parent)
 {
+}
+
+void CanvasWidget::init()
+{
     QString path = KStandardDirs::locate("appdata", "qml/main.qml");
     setSource(QUrl::fromLocalFile(path));
 
diff --git a/src/canvaswidget.h b/src/canvaswidget.h
index ed54a76..e3dccd1 100644
--- a/src/canvaswidget.h
+++ b/src/canvaswidget.h
@@ -25,6 +25,7 @@ class CanvasWidget : public KgDeclarativeView
     Q_OBJECT
 public:
     CanvasWidget(QWidget *parent=0);
+    void init();
     void setGamePaused(bool paused);
     void startNewGame(int rows, int cols, int numMines);
 
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp
index b21ea8e..80fff4d 100644
--- a/src/mainwindow.cpp
+++ b/src/mainwindow.cpp
@@ -97,6 +97,7 @@ KMinesMainWindow::KMinesMainWindow() :
     m_canvas(new CanvasWidget(this))
 {
     m_provider->setDeclarativeEngine("themeProvider", m_canvas->engine());
+    m_canvas->init();
 
     connect(m_canvas, SIGNAL(minesCountChanged(int,int)), SLOT(onMinesCountChanged(int,int)));
     connect(m_canvas, SIGNAL(gameOver(bool)), SLOT(onGameOver(bool)));
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic