diff options
author | Mike Krus <mike.krus@kdab.com> | 2020-06-29 15:31:03 +0100 |
---|---|---|
committer | Mike Krus <mike.krus@kdab.com> | 2020-06-30 17:27:15 +0100 |
commit | 644d060d9ad4366bc1a7e8635c13dbd713791870 (patch) | |
tree | 5ff58e31edb2495c3650f6c16a7bef94f5ed5d28 /src/render/frontend/qrenderaspect.cpp | |
parent | 4a2ca889fa67a364c83e83ab931d0df0d41188e6 (diff) | |
download | qt3d-644d060d9ad4366bc1a7e8635c13dbd713791870.tar.gz |
Render aspect: Dispatch events directly
Events now delivered directly to the input aspect which dispatches
them appropriately. The picking job still accumulates events within
a frame.
However, this opens the door to synchronous picking and event
propagation control later on.
Change-Id: Ic525bdce4e3d30455558fce9e385331364e49026
Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
Diffstat (limited to 'src/render/frontend/qrenderaspect.cpp')
-rw-r--r-- | src/render/frontend/qrenderaspect.cpp | 31 |
1 files changed, 24 insertions, 7 deletions
diff --git a/src/render/frontend/qrenderaspect.cpp b/src/render/frontend/qrenderaspect.cpp index d22edafa7..c0db60eca 100644 --- a/src/render/frontend/qrenderaspect.cpp +++ b/src/render/frontend/qrenderaspect.cpp @@ -305,7 +305,7 @@ QRenderAspectPrivate::QRenderAspectPrivate(QRenderAspect::SubmissionType submiss , m_syncLoadingJobs(CreateSynchronizerJobPtr([] {}, Render::JobTypes::SyncLoadingJobs)) , m_pickBoundingVolumeJob(Render::PickBoundingVolumeJobPtr::create()) , m_rayCastingJob(Render::RayCastingJobPtr::create()) - , m_pickEventFilter(new Render::PickEventFilter()) + , m_pickEventFilter(new Render::PickEventFilter(this)) , m_submissionType(submissionType) { m_instances.append(this); @@ -900,10 +900,6 @@ QVector<QAspectJobPtr> QRenderAspectPrivate::createPreRendererJobs() const if (!m_renderer) return {}; - const auto frameMouseEvents = m_pickEventFilter->pendingMouseEvents(); - const auto frameKeyEvents = m_pickEventFilter->pendingKeyEvents(); - m_renderer->setPendingEvents(frameMouseEvents, frameKeyEvents); - auto jobs = m_renderer->preRenderingJobs(); // Set values on picking jobs @@ -911,8 +907,6 @@ QVector<QAspectJobPtr> QRenderAspectPrivate::createPreRendererJobs() const if (renderSetting != nullptr) { m_pickBoundingVolumeJob->setRenderSettings(renderSetting); m_pickBoundingVolumeJob->setFrameGraphRoot(m_renderer->frameGraphRoot()); - m_pickBoundingVolumeJob->setMouseEvents(frameMouseEvents); - m_pickBoundingVolumeJob->setKeyEvents(frameKeyEvents); m_rayCastingJob->setRenderSettings(renderSetting); m_rayCastingJob->setFrameGraphRoot(m_renderer->frameGraphRoot()); @@ -955,6 +949,29 @@ Render::AbstractRenderer *QRenderAspectPrivate::loadRendererPlugin() return nullptr; } +bool QRenderAspectPrivate::processMouseEvent(QObject *obj, QMouseEvent *event) +{ + Render::RenderSettings *renderSetting = m_renderer->settings(); + if (!renderSetting) + return false; + + if (m_renderer->processMouseEvent(obj, event)) + return true; + m_pickBoundingVolumeJob->processMouseEvent(obj, event); + + return false; +} + +bool QRenderAspectPrivate::processKeyEvent(QObject *obj, QKeyEvent *event) +{ + Q_UNUSED(obj); + + if (m_renderer->processKeyEvent(obj, event)) + return true; + + return false; +} + void QRenderAspectPrivate::loadRenderPlugin(const QString &pluginName) { Q_Q(QRenderAspect); |