Fix compilation with older OSG / Qt
This commit is contained in:
parent
5e04aab318
commit
b309b8a7ac
2 changed files with 24 additions and 1 deletions
|
@ -16,6 +16,7 @@
|
||||||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
|
||||||
#include <osg/DeleteHandler>
|
#include <osg/DeleteHandler>
|
||||||
|
#include <osg/Version>
|
||||||
#include "GraphicsWindowQt5.hxx"
|
#include "GraphicsWindowQt5.hxx"
|
||||||
#include <osgViewer/ViewerBase>
|
#include <osgViewer/ViewerBase>
|
||||||
#include <QInputEvent>
|
#include <QInputEvent>
|
||||||
|
@ -174,6 +175,14 @@ GLWindow::~GLWindow()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if QT_VERSION < 0x050500
|
||||||
|
void GLWindow::requestUpdate()
|
||||||
|
{
|
||||||
|
// mimic Qt 5.5's requestUpdate method
|
||||||
|
QTimer::singleShot(0, this, &QWindow::update);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
bool GLWindow::event( QEvent* event )
|
bool GLWindow::event( QEvent* event )
|
||||||
{
|
{
|
||||||
if (event->type() == QEvent::WindowStateChange) {
|
if (event->type() == QEvent::WindowStateChange) {
|
||||||
|
@ -191,6 +200,12 @@ bool GLWindow::event( QEvent* event )
|
||||||
if (_gw->_viewer.lock(v)) {
|
if (_gw->_viewer.lock(v)) {
|
||||||
v->frame();
|
v->frame();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// see discussion of QWindow::requestUpdate to see
|
||||||
|
// why this is good behaviour
|
||||||
|
if (_gw->_continousUpdate) {
|
||||||
|
requestUpdate();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (event->type() == QEvent::Close) {
|
else if (event->type() == QEvent::Close) {
|
||||||
// spin an 'are you sure'? dialog here
|
// spin an 'are you sure'? dialog here
|
||||||
|
@ -387,8 +402,10 @@ bool GraphicsWindowQt5::init( Qt::WindowFlags f )
|
||||||
getState()->setGraphicsContext(this);
|
getState()->setGraphicsContext(this);
|
||||||
getState()->setContextID( osg::GraphicsContext::createNewContextID() );
|
getState()->setContextID( osg::GraphicsContext::createNewContextID() );
|
||||||
|
|
||||||
|
#if (OPENSCENEGRAPH_MAJOR_VERSION == 3) && (OPENSCENEGRAPH_MINOR_VERSION >= 4)
|
||||||
// make sure the event queue has the correct window rectangle size and input range
|
// make sure the event queue has the correct window rectangle size and input range
|
||||||
getEventQueue()->syncWindowRectangleWithGraphicsContext();
|
getEventQueue()->syncWindowRectangleWithGraphicsContext();
|
||||||
|
#endif
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -597,8 +614,11 @@ bool GraphicsWindowQt5::realizeImplementation()
|
||||||
_window->show();
|
_window->show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if (OPENSCENEGRAPH_MAJOR_VERSION == 3) && (OPENSCENEGRAPH_MINOR_VERSION >= 4)
|
||||||
|
// make sure the event queue has the correct window rectangle size and input range
|
||||||
getEventQueue()->syncWindowRectangleWithGraphicsContext();
|
getEventQueue()->syncWindowRectangleWithGraphicsContext();
|
||||||
|
#endif
|
||||||
|
|
||||||
_realized = true;
|
_realized = true;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -71,6 +71,9 @@ public:
|
||||||
virtual void mouseMoveEvent( QMouseEvent* event );
|
virtual void mouseMoveEvent( QMouseEvent* event );
|
||||||
virtual void wheelEvent( QWheelEvent* event );
|
virtual void wheelEvent( QWheelEvent* event );
|
||||||
|
|
||||||
|
#if QT_VERSION < 0x050500
|
||||||
|
void requestUpdate();
|
||||||
|
#endif
|
||||||
signals:
|
signals:
|
||||||
void beforeRendering();
|
void beforeRendering();
|
||||||
void afterRendering();
|
void afterRendering();
|
||||||
|
|
Loading…
Add table
Reference in a new issue