blob: 51b1595d8c46405c3e4e08637b4c64b5be2b585d [file] [log] [blame]
From fc9a41d63d821125aa1bf47e1d5f2a28e001e839 Mon Sep 17 00:00:00 2001
From: airscrat <hsq2013@163.com>
Date: Thu, 19 Apr 2018 16:51:42 +0800
Subject: [PATCH] Compatible with the new and old versions of OSG
---
CMakeLists.txt | 2 +-
include/osgQt/GraphicsWindowQt | 3 ++-
src/osgQt/GraphicsWindowQt.cpp | 2 +-
3 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 4345ea2..34dd413 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -127,7 +127,7 @@ ENDIF()
PROJECT(osgQt)
-FIND_PACKAGE(OpenSceneGraph 3.5.6 REQUIRED osgDB osgGA osgUtil osgText osgViewer osgWidget)
+FIND_PACKAGE(OpenSceneGraph 3.0.0 REQUIRED osgDB osgGA osgUtil osgText osgViewer osgWidget)
SET(OPENSCENEGRAPH_SOVERSION 145)
SET(OSG_PLUGINS osgPlugins-${OPENSCENEGRAPH_VERSION})
diff --git a/include/osgQt/GraphicsWindowQt b/include/osgQt/GraphicsWindowQt
index 825676d..a535a51 100644
--- a/include/osgQt/GraphicsWindowQt
+++ b/include/osgQt/GraphicsWindowQt
@@ -22,6 +22,7 @@
#include <QQueue>
#include <QSet>
#include <QGLWidget>
+#include <osg/Version>
class QInputEvent;
class QGestureEvent;
@@ -36,7 +37,7 @@ namespace osgQt
// forward declarations
class GraphicsWindowQt;
-#if 0
+#if OSG_VERSION_LESS_THAN(3, 5, 6)
/// The function sets the WindowingSystem to Qt.
void OSGQT_EXPORT initQtWindowingSystem();
#endif
diff --git a/src/osgQt/GraphicsWindowQt.cpp b/src/osgQt/GraphicsWindowQt.cpp
index 2fd3855..3fc7bcf 100644
--- a/src/osgQt/GraphicsWindowQt.cpp
+++ b/src/osgQt/GraphicsWindowQt.cpp
@@ -945,7 +945,7 @@ class QtWindowingSystem : public osg::GraphicsContext::WindowingSystemInterface
QtWindowingSystem& operator=( const QtWindowingSystem& );
};
-#if 1
+#if OSG_VERSION_GREATER_OR_EQUAL(3, 5, 6)
REGISTER_WINDOWINGSYSTEMINTERFACE(Qt, QtWindowingSystem)
#else