summaryrefslogtreecommitdiffstats
path: root/src/extras/defaults/qt3dwindow.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/extras/defaults/qt3dwindow.cpp')
-rw-r--r--src/extras/defaults/qt3dwindow.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/extras/defaults/qt3dwindow.cpp b/src/extras/defaults/qt3dwindow.cpp
index 7091628ba..2df4716dd 100644
--- a/src/extras/defaults/qt3dwindow.cpp
+++ b/src/extras/defaults/qt3dwindow.cpp
@@ -62,6 +62,8 @@
#include <Qt3DRender/qcamera.h>
#include <QtGui/qopenglcontext.h>
+#include <QEvent>
+
static void initResources()
{
#ifdef QT_STATIC
@@ -227,6 +229,7 @@ void Qt3DWindow::showEvent(QShowEvent *e)
QWindow::showEvent(e);
}
+
/*!
Resets the aspect ratio of the 3D window.
*/
@@ -236,6 +239,20 @@ void Qt3DWindow::resizeEvent(QResizeEvent *)
d->m_defaultCamera->setAspectRatio(float(width()) / float(height()));
}
+/*!
+ \reimp
+
+ Requests renderer to redraw if we are using OnDemand render policy.
+*/
+bool Qt3DWindow::event(QEvent *e)
+{
+ Q_D(Qt3DWindow);
+ const bool needsRedraw = (e->type() == QEvent::Expose || e->type() == QEvent::UpdateRequest);
+ if (needsRedraw && d->m_renderSettings->renderPolicy() == Qt3DRender::QRenderSettings::OnDemand)
+ d->m_renderSettings->sendCommand(QLatin1Literal("InvalidateFrame"));
+ return QWindow::event(e);
+}
+
} // Qt3DExtras
QT_END_NAMESPACE