diff --git a/src/Viewer/GraphicsWindowQt5.cpp b/src/Viewer/GraphicsWindowQt5.cpp index f52f81383..7f7a501ae 100644 --- a/src/Viewer/GraphicsWindowQt5.cpp +++ b/src/Viewer/GraphicsWindowQt5.cpp @@ -29,6 +29,7 @@ #include #include #include +#include #include
@@ -179,7 +180,7 @@ GLWindow::~GLWindow() void GLWindow::requestUpdate() { // mimic Qt 5.5's requestUpdate method - QTimer::singleShot(0, this, &QWindow::update); + QTimer::singleShot(0, this, &GLWindow::processUpdateEvent); } #endif @@ -195,17 +196,7 @@ bool GLWindow::event( QEvent* event ) } else if (event->type() == QEvent::UpdateRequest) { - qWarning() << "Got update request"; - osg::ref_ptr v; - if (_gw->_viewer.lock(v)) { - v->frame(); - } - - // see discussion of QWindow::requestUpdate to see - // why this is good behaviour - if (_gw->_continousUpdate) { - requestUpdate(); - } + processUpdateEvent(); } else if (event->type() == QEvent::Close) { // spin an 'are you sure'? dialog here @@ -217,6 +208,21 @@ bool GLWindow::event( QEvent* event ) return QWindow::event( event ); } +void GLWindow::processUpdateEvent() +{ + osg::ref_ptr v; + if (_gw->_viewer.lock(v)) { + v->frame(); + } + + // see discussion of QWindow::requestUpdate to see + // why this is good behaviour + if (_gw->_continousUpdate) { + requestUpdate(); + } + +} + void GLWindow::setKeyboardModifiers( QInputEvent* event ) { int modkey = event->modifiers() & (Qt::ShiftModifier | Qt::ControlModifier | Qt::AltModifier); @@ -730,7 +736,6 @@ void GraphicsWindowQt5::viewerChanged(osgViewer::ViewerBase*) void GraphicsWindowQt5::requestRedraw() { _window->requestUpdate(); - GraphicsWindow::requestRedraw(); } void GraphicsWindowQt5::requestContinuousUpdate(bool needed) diff --git a/src/Viewer/GraphicsWindowQt5.hxx b/src/Viewer/GraphicsWindowQt5.hxx index c2f16b52b..180a9f90b 100644 --- a/src/Viewer/GraphicsWindowQt5.hxx +++ b/src/Viewer/GraphicsWindowQt5.hxx @@ -82,6 +82,8 @@ signals: private slots: void onScreenChanged(); + void processUpdateEvent(); + protected: void syncGeometryWithOSG();