Different work-around for Qt < 5.5
This commit is contained in:
parent
96df6689e6
commit
aaddfdcea7
2 changed files with 20 additions and 13 deletions
|
@ -29,6 +29,7 @@
|
||||||
#include <QAbstractEventDispatcher>
|
#include <QAbstractEventDispatcher>
|
||||||
#include <QOpenGLContext>
|
#include <QOpenGLContext>
|
||||||
#include <QSurfaceFormat>
|
#include <QSurfaceFormat>
|
||||||
|
#include <QTimer>
|
||||||
|
|
||||||
#include <Main/fg_props.hxx>
|
#include <Main/fg_props.hxx>
|
||||||
|
|
||||||
|
@ -179,7 +180,7 @@ GLWindow::~GLWindow()
|
||||||
void GLWindow::requestUpdate()
|
void GLWindow::requestUpdate()
|
||||||
{
|
{
|
||||||
// mimic Qt 5.5's requestUpdate method
|
// mimic Qt 5.5's requestUpdate method
|
||||||
QTimer::singleShot(0, this, &QWindow::update);
|
QTimer::singleShot(0, this, &GLWindow::processUpdateEvent);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -195,17 +196,7 @@ bool GLWindow::event( QEvent* event )
|
||||||
}
|
}
|
||||||
else if (event->type() == QEvent::UpdateRequest)
|
else if (event->type() == QEvent::UpdateRequest)
|
||||||
{
|
{
|
||||||
qWarning() << "Got update request";
|
processUpdateEvent();
|
||||||
osg::ref_ptr<osgViewer::ViewerBase> v;
|
|
||||||
if (_gw->_viewer.lock(v)) {
|
|
||||||
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
|
||||||
|
@ -217,6 +208,21 @@ bool GLWindow::event( QEvent* event )
|
||||||
return QWindow::event( event );
|
return QWindow::event( event );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GLWindow::processUpdateEvent()
|
||||||
|
{
|
||||||
|
osg::ref_ptr<osgViewer::ViewerBase> 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 )
|
void GLWindow::setKeyboardModifiers( QInputEvent* event )
|
||||||
{
|
{
|
||||||
int modkey = event->modifiers() & (Qt::ShiftModifier | Qt::ControlModifier | Qt::AltModifier);
|
int modkey = event->modifiers() & (Qt::ShiftModifier | Qt::ControlModifier | Qt::AltModifier);
|
||||||
|
@ -730,7 +736,6 @@ void GraphicsWindowQt5::viewerChanged(osgViewer::ViewerBase*)
|
||||||
void GraphicsWindowQt5::requestRedraw()
|
void GraphicsWindowQt5::requestRedraw()
|
||||||
{
|
{
|
||||||
_window->requestUpdate();
|
_window->requestUpdate();
|
||||||
GraphicsWindow::requestRedraw();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GraphicsWindowQt5::requestContinuousUpdate(bool needed)
|
void GraphicsWindowQt5::requestContinuousUpdate(bool needed)
|
||||||
|
|
|
@ -82,6 +82,8 @@ signals:
|
||||||
private slots:
|
private slots:
|
||||||
void onScreenChanged();
|
void onScreenChanged();
|
||||||
|
|
||||||
|
void processUpdateEvent();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void syncGeometryWithOSG();
|
void syncGeometryWithOSG();
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue