[vlmc-devel] Timeline: Pass MainWindow to QQuickView::rootContext()
Yikai Lu
git at videolan.org
Sat Jul 16 17:24:25 CEST 2016
vlmc | branch: master | Yikai Lu <luyikei.qmltu at gmail.com> | Sun Jul 17 00:11:55 2016 +0900| [8645f642c58848663dbacbeceeed525aef213fd8] | committer: Yikai Lu
Timeline: Pass MainWindow to QQuickView::rootContext()
> https://code.videolan.org/videolan/vlmc/commit/8645f642c58848663dbacbeceeed525aef213fd8
---
src/Gui/timeline/Timeline.cpp | 4 +++-
src/Gui/timeline/Timeline.h | 3 ++-
2 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/src/Gui/timeline/Timeline.cpp b/src/Gui/timeline/Timeline.cpp
index c0a9e9f..8a66370 100644
--- a/src/Gui/timeline/Timeline.cpp
+++ b/src/Gui/timeline/Timeline.cpp
@@ -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" ) ) );
}
diff --git a/src/Gui/timeline/Timeline.h b/src/Gui/timeline/Timeline.h
index 0b7e56f..fdcee15 100644
--- a/src/Gui/timeline/Timeline.h
+++ b/src/Gui/timeline/Timeline.h
@@ -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();
More information about the Vlmc-devel
mailing list