Commit 8645f642 authored by luyikei's avatar luyikei

Timeline: Pass MainWindow to QQuickView::rootContext()

parent 19b23b0f
......@@ -24,19 +24,21 @@
#include "Main/Core.h"
#include "Workflow/MainWorkflow.h"
#include "Gui/MainWindow.h"
#include <QtQuick/QQuickView>
#include <QtQml/QQmlContext>
#include <QUrl>
Timeline* Timeline::m_instance = nullptr;
Timeline::Timeline( QWidget *parent )
Timeline::Timeline( MainWindow* parent )
: QObject( parent )
, m_view( new QQuickView )
, m_container( QWidget::createWindowContainer( m_view, parent ) )
{
m_container->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding );
m_container->setFocusPolicy( Qt::TabFocus );
m_view->rootContext()->setContextProperty( "mainwindow", parent );
m_view->rootContext()->setContextProperty( "workflow", Core::instance()->workflow() );
m_view->setSource( QUrl( QStringLiteral( "qrc:/QML/main.qml" ) ) );
}
......
......@@ -28,6 +28,7 @@
#include "ui_Timeline.h"
#include "Workflow/Types.h"
class MainWindow;
class QQuickView;
/**
......@@ -38,7 +39,7 @@ class Timeline : public QObject
Q_OBJECT
Q_DISABLE_COPY( Timeline )
public:
explicit Timeline( QWidget *parent = 0 );
explicit Timeline( MainWindow* parent = 0 );
virtual ~Timeline();
QWidget* container();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment