Qt5NodeInstanceServer: Avoid using sender()

Amends b4db8a2d84

Change-Id: I9dc446d376bce9d91eb9d7a753003e0d92e10889
Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
This commit is contained in:
Jarek Kobus
2023-12-13 23:33:35 +01:00
parent 0f2a69408b
commit 2f4fa0b62d
2 changed files with 5 additions and 14 deletions

View File

@@ -268,22 +268,15 @@ void Qt5NodeInstanceServer::setPipelineCacheConfig([[maybe_unused]] QQuickWindow
#ifdef USE_SHADER_CACHE
QtQuick3DEditorHelpers::ShaderCache::setAutomaticDiskCache(false);
auto wa = QQuick3DSceneManager::getOrSetWindowAttachment(*w);
connect(wa, &QQuick3DWindowAttachment::renderContextInterfaceChanged,
this, &Qt5NodeInstanceServer::handleRciSet);
connect(wa, &QQuick3DWindowAttachment::renderContextInterfaceChanged, this, [this, wa] {
auto context = wa->rci().get();
if (context && context->shaderCache())
context->shaderCache()->persistentShaderBakingCache().load(m_shaderCacheFile);
});
#endif
#endif
}
void Qt5NodeInstanceServer::handleRciSet()
{
#ifdef USE_SHADER_CACHE
auto wa = qobject_cast<QQuick3DWindowAttachment *>(sender());
auto context = wa ? wa->rci().get() : nullptr;
if (context && context->shaderCache())
context->shaderCache()->persistentShaderBakingCache().load(m_shaderCacheFile);
#endif
}
bool Qt5NodeInstanceServer::initRhi([[maybe_unused]] RenderViewData &viewData)
{
if (!viewData.renderControl) {

View File

@@ -77,8 +77,6 @@ protected:
virtual QImage grabRenderControl(RenderViewData &viewData);
private:
void handleRciSet();
RenderViewData m_viewData;
QByteArray m_pipelineCacheData;
QString m_pipelineCacheLocation;