[vlmc-devel] Timeline: Clear when MainWorkflow is cleared

Yikai Lu git at videolan.org
Mon Aug 22 04:19:25 CEST 2016


vlmc | branch: master | Yikai Lu <luyikei.qmltu at gmail.com> | Sun Aug 21 21:19:02 2016 -0500| [4bcd3d1d94431505a204165ef5f2bb3f9cd4ada4] | committer: Yikai Lu

Timeline: Clear when MainWorkflow is cleared

> https://code.videolan.org/videolan/vlmc/commit/4bcd3d1d94431505a204165ef5f2bb3f9cd4ada4
---

 src/Gui/timeline/Timeline.cpp | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/src/Gui/timeline/Timeline.cpp b/src/Gui/timeline/Timeline.cpp
index 62b4f68..94da912 100644
--- a/src/Gui/timeline/Timeline.cpp
+++ b/src/Gui/timeline/Timeline.cpp
@@ -49,6 +49,13 @@ Timeline::Timeline( MainWindow* parent )
     m_view->rootContext()->setContextProperty( QStringLiteral( "mainwindow" ), parent );
     m_view->rootContext()->setContextProperty( QStringLiteral( "workflow" ), Core::instance()->workflow() );
     m_view->setSource( QUrl( QStringLiteral( "qrc:/QML/main.qml" ) ) );
+
+    connect( Core::instance()->workflow(), &MainWorkflow::cleared, this, [this]()
+    {
+        m_view->setSource( QUrl() );
+        m_view->engine()->clearComponentCache();
+        m_view->setSource( QUrl( QStringLiteral( "qrc:/QML/main.qml" ) ) );
+    } );
 }
 
 Timeline::~Timeline()



More information about the Vlmc-devel mailing list