Build fixes for QT4
This commit is contained in:
@@ -1,12 +1,13 @@
|
||||
SET(TARGET_SRC osgviewerQT.cpp )
|
||||
|
||||
SET(TARGET_EXTERNAL_LIBRARIES ${QT_LIBRARIES} )
|
||||
IF (QT4_FOUND)
|
||||
SET(TARGET_EXTERNAL_LIBRARIES ${QT_QTCORE_LIBRARY_RELEASE} ${QT_QTGUI_LIBRARY_RELEASE} ${QT_QTOPENGL_LIBRARY_RELEASE} )
|
||||
ADD_DEFINITIONS(-DUSE_QT4)
|
||||
ELSE(QT4_FOUND)
|
||||
SET(TARGET_EXTERNAL_LIBRARIES ${QT_LIBRARIES} )
|
||||
ENDIF(QT4_FOUND)
|
||||
|
||||
INCLUDE_DIRECTORIES(${QT_INCLUDE_DIR} )
|
||||
|
||||
IF (QT4_FOUND)
|
||||
ADD_DEFINITIONS(-DUSE_QT4)
|
||||
ENDIF(QT4_FOUND)
|
||||
|
||||
#### end var setup ###
|
||||
SETUP_EXAMPLE(osgviewerQT)
|
||||
|
||||
@@ -8,12 +8,13 @@
|
||||
|
||||
#if USE_QT4
|
||||
|
||||
#include <QtCore/QString>
|
||||
#include <QtCore/QTimer>
|
||||
#include <QtGui/QKeyEvent>
|
||||
#include <QtGui/QApplication>
|
||||
#include <QtOpenGL/QGLWidget>
|
||||
|
||||
using Qt::WFlags;
|
||||
|
||||
using Qt::WindowFlags;
|
||||
|
||||
#else
|
||||
|
||||
@@ -22,6 +23,8 @@
|
||||
#include <qgl.h>
|
||||
#include <qapplication.h>
|
||||
|
||||
#define WindowFlags WFlags
|
||||
|
||||
#endif
|
||||
|
||||
#include <iostream>
|
||||
@@ -30,7 +33,7 @@ class AdapterWidget : public QGLWidget
|
||||
{
|
||||
public:
|
||||
|
||||
AdapterWidget( QWidget * parent = 0, const char * name = 0, const QGLWidget * shareWidget = 0, WFlags f = 0 );
|
||||
AdapterWidget( QWidget * parent = 0, const char * name = 0, const QGLWidget * shareWidget = 0, WindowFlags f = 0 );
|
||||
|
||||
virtual ~AdapterWidget() {}
|
||||
|
||||
@@ -51,8 +54,12 @@ class AdapterWidget : public QGLWidget
|
||||
osg::ref_ptr<osgViewer::GraphicsWindowEmbedded> _gw;
|
||||
};
|
||||
|
||||
AdapterWidget::AdapterWidget( QWidget * parent, const char * name, const QGLWidget * shareWidget, WFlags f):
|
||||
AdapterWidget::AdapterWidget( QWidget * parent, const char * name, const QGLWidget * shareWidget, WindowFlags f):
|
||||
#if USE_QT4
|
||||
QGLWidget(parent, shareWidget, f)
|
||||
#else
|
||||
QGLWidget(parent, name, shareWidget, f)
|
||||
#endif
|
||||
{
|
||||
_gw = new osgViewer::GraphicsWindowEmbedded(0,0,width(),height());
|
||||
}
|
||||
@@ -111,7 +118,7 @@ class ViewerQT : public osgViewer::Viewer, public AdapterWidget
|
||||
{
|
||||
public:
|
||||
|
||||
ViewerQT(QWidget * parent = 0, const char * name = 0, const QGLWidget * shareWidget = 0, WFlags f = 0):
|
||||
ViewerQT(QWidget * parent = 0, const char * name = 0, const QGLWidget * shareWidget = 0, WindowFlags f = 0):
|
||||
AdapterWidget( parent, name, shareWidget, f )
|
||||
{
|
||||
getCamera()->setViewport(new osg::Viewport(0,0,width(),height()));
|
||||
@@ -136,7 +143,7 @@ class CompositeViewerQT : public osgViewer::CompositeViewer, public AdapterWidge
|
||||
{
|
||||
public:
|
||||
|
||||
CompositeViewerQT(QWidget * parent = 0, const char * name = 0, const QGLWidget * shareWidget = 0, WFlags f = 0):
|
||||
CompositeViewerQT(QWidget * parent = 0, const char * name = 0, const QGLWidget * shareWidget = 0, WindowFlags f = 0):
|
||||
AdapterWidget( parent, name, shareWidget, f )
|
||||
{
|
||||
setThreadingModel(osgViewer::CompositeViewer::SingleThreaded);
|
||||
|
||||
Reference in New Issue
Block a user