Skip to content
Snippets Groups Projects
Commit 3529e880 authored by Fatih Uzunoğlu's avatar Fatih Uzunoğlu Committed by Jean-Baptiste Kempf
Browse files

qt: decouple scene graph and CompositorDirectComposition

parent 31923d31
No related branches found
No related tags found
Loading
Pipeline #467160 passed with warnings with stage
in 43 minutes and 18 seconds
......@@ -231,17 +231,9 @@ bool CompositorDirectComposition::makeMainInterface(MainCtx* mainCtx)
&QQuickWindow::frameSwapped, // At this stage, we can be sure that QRhi and QRhiSwapChain are valid.
this,
&CompositorDirectComposition::setup,
static_cast<Qt::ConnectionType>(Qt::SingleShotConnection | Qt::DirectConnection));
Qt::SingleShotConnection);
connect(quickViewPtr,
&QQuickWindow::sceneGraphInvalidated,
this,
[this]() {
m_videoVisual.Reset();
delete m_acrylicSurface.data();
m_rootVisual.Reset();
},
Qt::DirectConnection);
m_quickView->installEventFilter(this);
bool appropriateGraphicsApi = true;
......@@ -391,4 +383,28 @@ QQuickItem * CompositorDirectComposition::activeFocusItem() const /* override */
return m_quickView->activeFocusItem();
}
bool CompositorDirectComposition::eventFilter(QObject *watched, QEvent *event)
{
switch (event->type())
{
case QEvent::PlatformSurface:
if (watched == m_quickView.get() &&
static_cast<QPlatformSurfaceEvent *>(event)->surfaceEventType() == QPlatformSurfaceEvent::SurfaceAboutToBeDestroyed)
{
m_videoVisual.Reset();
delete m_acrylicSurface.data();
// Just in case root visual deletes its children
// when it is deleted: (Qt's UI visual should be
// deleted by Qt itself)
m_rootVisual->RemoveVisual(m_uiVisual);
m_rootVisual.Reset();
}
break;
default:
break;
}
return QObject::eventFilter(watched, event);
}
}
......@@ -65,6 +65,8 @@ public:
QQuickItem * activeFocusItem() const override;
bool eventFilter(QObject *watched, QEvent *event) override;
private slots:
void onSurfacePositionChanged(const QPointF& position) override;
void onSurfaceSizeChanged(const QSizeF& size) override;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment