From Kristofer Tingdahl, with additions from Riccardo Corsi and Robert Milharcic, support for Qt5 build

This commit is contained in:
Robert Osfield
2013-06-10 14:34:25 +00:00
parent 8cf9600e2c
commit bdfd18dc03
25 changed files with 184 additions and 90 deletions

View File

@@ -536,10 +536,13 @@ OPTION(OSG_USE_QT "Enable to use Qt (build Qt-dependent libraries, plugins and e
IF(OSG_USE_QT AND NOT ANDROID) IF(OSG_USE_QT AND NOT ANDROID)
# To select a specific version of QT define DESIRED_QT_VERSION # To select a specific version of QT define DESIRED_QT_VERSION
# via cmake -DDESIRED_QT_VERSION=4 # via cmake -DDESIRED_QT_VERSION=5
IF (DESIRED_QT_VERSION) # QUIET option disables messages if the package cannot be found.
IF (DESIRED_QT_VERSION MATCHES 4) IF (DESIRED_QT_VERSION)
IF (DESIRED_QT_VERSION MATCHES 5)
FIND_PACKAGE(Qt5Widgets)
ELSEIF (DESIRED_QT_VERSION MATCHES 4)
FIND_PACKAGE(Qt4) FIND_PACKAGE(Qt4)
ELSE() ELSE()
FIND_PACKAGE(Qt3) FIND_PACKAGE(Qt3)
@@ -547,13 +550,35 @@ IF(OSG_USE_QT AND NOT ANDROID)
ELSE() ELSE()
FIND_PACKAGE(Qt4) FIND_PACKAGE(Qt5Widgets QUIET)
IF ( Qt5Widgets_FOUND )
# CMake 2.8.8 or greater required
BUILDER_VERSION_GREATER(2 8 7)
IF(NOT VALID_BUILDER_VERSION)
MESSAGE(
SEND_ERROR
"Qt5 requires CMake version 2.8.8 or greater!\n"
"Update CMake or set DESIRED_QT_VERSION to less than 5
or disable OSG_USE_QT."
)
ENDIF( )
ENDIF( )
IF (NOT QT4_FOUND) IF ( NOT Qt5Widgets_FOUND )
FIND_PACKAGE(Qt3) FIND_PACKAGE(Qt4)
IF (NOT QT4_FOUND)
FIND_PACKAGE(Qt3)
ENDIF()
ENDIF() ENDIF()
ENDIF() ENDIF()
#If we have found Qt5, let's try to top off by getting the webkit as well
IF ( Qt5Widgets_FOUND )
FIND_PACKAGE(Qt5WebKitWidgets)
ENDIF()
ENDIF() ENDIF()
#optional example related dependencies #optional example related dependencies
@@ -1029,9 +1054,9 @@ SET(PKGCONFIG_FILES
openscenegraph-osgVolume openscenegraph-osgVolume
) )
IF(QT4_FOUND) IF(QT4_FOUND OR Qt5Widgets_FOUND )
SET(PKGCONFIG_FILES ${PKGCONFIG_FILES} openscenegraph-osgQt) SET(PKGCONFIG_FILES ${PKGCONFIG_FILES} openscenegraph-osgQt)
ENDIF(QT4_FOUND) ENDIF()
FOREACH(PKGCONFIG_FILE ${PKGCONFIG_FILES}) FOREACH(PKGCONFIG_FILE ${PKGCONFIG_FILES})
CONFIGURE_FILE(${PROJECT_SOURCE_DIR}/packaging/pkgconfig/${PKGCONFIG_FILE}.pc.in CONFIGURE_FILE(${PROJECT_SOURCE_DIR}/packaging/pkgconfig/${PKGCONFIG_FILE}.pc.in

View File

@@ -206,14 +206,14 @@ IF(DYNAMIC_OPENSCENEGRAPH)
ENDIF() ENDIF()
ENDIF() ENDIF()
IF (QT_FOUND AND NOT OSG_GLES1_AVAILABLE AND NOT OSG_GLES2_AVAILABLE AND NOT OSG_GL3_AVAILABLE) IF ( (QT4_FOUND OR Qt5Widgets_FOUND) AND NOT OSG_GLES1_AVAILABLE AND NOT OSG_GLES2_AVAILABLE AND NOT OSG_GL3_AVAILABLE)
IF (QT_QTOPENGL_LIBRARY) IF ( QT4_FOUND OR Qt5Widgets_FOUND)
ADD_SUBDIRECTORY(osgviewerQt) ADD_SUBDIRECTORY(osgviewerQt)
ADD_SUBDIRECTORY(osgqfont) ADD_SUBDIRECTORY(osgqfont)
ENDIF() ENDIF()
IF (QT4_FOUND AND QT_QTWEBKIT_FOUND) IF ( (QT4_FOUND AND QT_QTWEBKIT_FOUND) OR Qt5WebKitWidgets_FOUND )
ADD_SUBDIRECTORY(osgQtWidgets) ADD_SUBDIRECTORY(osgQtWidgets)
ADD_SUBDIRECTORY(osgQtBrowser) ADD_SUBDIRECTORY(osgQtBrowser)
ENDIF() ENDIF()

View File

@@ -7,10 +7,19 @@ IF(CMAKE_COMPILER_IS_GNUCXX)
STRING(REGEX REPLACE "-pedantic" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") STRING(REGEX REPLACE "-pedantic" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
ENDIF() ENDIF()
SET(TARGET_EXTERNAL_LIBRARIES ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY} ${QT_QTOPENGL_LIBRARY} ${QT_QTWEBKIT_LIBRARY}) if ( QT4_FOUND )
INCLUDE_DIRECTORIES(${QT_INCLUDE_DIR} ${QT_QTCORE_INCLUDE_DIR}) SET(TARGET_EXTERNAL_LIBRARIES ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY} ${QT_QTOPENGL_LIBRARY} ${QT_QTWEBKIT_LIBRARY})
INCLUDE_DIRECTORIES(${QT_INCLUDE_DIR} ${QT_QTCORE_INCLUDE_DIR} ${QT_QTOPENGL_INCLUDE_DIR} ${QT_QTGUI_INCLUDE_DIR} ${QT_QTWEBKIT_INCLUDE_DIR} )
endif( QT4_FOUND )
SET(TARGET_ADDED_LIBRARIES osgWidget osgQt) SET(TARGET_ADDED_LIBRARIES osgWidget osgQt)
#### end var setup ### #### end var setup ###
SETUP_EXAMPLE(osgQtBrowser) SET ( EXAMPLE_NAME osgQtBrowser )
SETUP_EXAMPLE(${EXAMPLE_NAME})
IF ( Qt5Widgets_FOUND )
qt5_use_modules( example_${EXAMPLE_NAME} Widgets OpenGL WebKitWidgets )
ENDIF( Qt5Widgets_FOUND )

View File

@@ -29,14 +29,20 @@
#include <osgViewer/ViewerEventHandlers> #include <osgViewer/ViewerEventHandlers>
#include <osgWidget/Browser> #include <osgWidget/Browser>
#include <QtGlobal>
#if QT_VERSION >= 0x050000
# include <QtWebKitWidgets>
#else
# include <QtWebKit>
#endif
#include <QtWebKit/QWebSettings> #include <QWebSettings>
#include <QtWebKit/QtWebKit>
#include <QtGui/QGraphicsScene> #include <QGraphicsScene>
#include <QtGui/QGraphicsView> #include <QGraphicsView>
#include <QtGui/QApplication> #include <QApplication>
#include <QtGui/QPainter> #include <QPainter>
#include <QtGui/QtEvents> #include <QtEvents>
#include <osgQt/QGraphicsViewAdapter> #include <osgQt/QGraphicsViewAdapter>
#include <osgQt/QWebViewImage> #include <osgQt/QWebViewImage>

View File

@@ -7,10 +7,17 @@ IF(CMAKE_COMPILER_IS_GNUCXX)
STRING(REGEX REPLACE "-pedantic" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") STRING(REGEX REPLACE "-pedantic" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
ENDIF() ENDIF()
SET(TARGET_EXTERNAL_LIBRARIES ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY} ${QT_QTOPENGL_LIBRARY} ${QT_QTWEBKIT_LIBRARY}) if ( QT4_FOUND )
INCLUDE_DIRECTORIES(${QT_INCLUDE_DIR} ${QT_QTCORE_INCLUDE_DIR}) SET(TARGET_EXTERNAL_LIBRARIES ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY} ${QT_QTOPENGL_LIBRARY} ${QT_QTWEBKIT_LIBRARY})
INCLUDE_DIRECTORIES(${QT_INCLUDE_DIR} ${QT_QTCORE_INCLUDE_DIR} ${QT_QTOPENGL_INCLUDE_DIR} ${QT_QTGUI_INCLUDE_DIR} ${QT_QTWEBKIT_INCLUDE_DIR} )
endif( QT4_FOUND )
SET(TARGET_ADDED_LIBRARIES osgWidget osgQt) SET(TARGET_ADDED_LIBRARIES osgWidget osgQt)
#### end var setup ### #### end var setup ###
SETUP_EXAMPLE(osgQtWidgets) SET ( EXAMPLE_NAME osgQtWidgets )
SETUP_EXAMPLE(${EXAMPLE_NAME})
IF ( Qt5Widgets_FOUND )
qt5_use_modules( example_${EXAMPLE_NAME} OpenGL WebKitWidgets )
ENDIF( Qt5Widgets_FOUND )

View File

@@ -36,17 +36,16 @@
#include <osgWidget/Browser> #include <osgWidget/Browser>
//#include <QtWebKit/QWebSettings> //#include <QWebSettings>
//#include <QtWebKit/QtWebKit> #include <QGraphicsScene>
#include <QtGui/QGraphicsScene> #include <QGraphicsView>
#include <QtGui/QGraphicsView> #include <QApplication>
#include <QtGui/QApplication> #include <QPainter>
#include <QtGui/QPainter> #include <QtEvents>
#include <QtGui/QtEvents> #include <QDialog>
#include <QtGui/QDialog> #include <QVBoxLayout>
#include <QtGui/QVBoxLayout> #include <QMainWindow>
#include <QtGui/QMainWindow> #include <QtOpenGL>
#include <QtOpenGL/QtOpenGL>
#include <osgQt/QGraphicsViewAdapter> #include <osgQt/QGraphicsViewAdapter>
#include <osgQt/QWebViewImage> #include <osgQt/QWebViewImage>
@@ -98,7 +97,11 @@ protected:
virtual void mousePressEvent(QMouseEvent* e) virtual void mousePressEvent(QMouseEvent* e)
{ {
bool ok = false; bool ok = false;
#if QT_VERSION >= 0x040500
int val = QInputDialog::getInt(this, "Get integer", "Please enter an integer between 0 and pi", 0, 0, 3, 1, &ok);
#else
int val = QInputDialog::getInteger(this, "Get integer", "Please enter an integer between 0 and pi", 0, 0, 3, 1, &ok); int val = QInputDialog::getInteger(this, "Get integer", "Please enter an integer between 0 and pi", 0, 0, 3, 1, &ok);
#endif
std::cout << "Ok was " << (ok ? "" : "not") << " pressed, val is " << val << std::endl; std::cout << "Ok was " << (ok ? "" : "not") << " pressed, val is " << val << std::endl;
} }
}; };

View File

@@ -1,11 +1,18 @@
#this file is automatically generated #this file is automatically generated
INCLUDE_DIRECTORIES( ${QT_INCLUDE_DIR} )
ADD_DEFINITIONS(-DUSE_QT4) ADD_DEFINITIONS(-DUSE_QT4)
SET(TARGET_SRC osgqfont.cpp ) SET(TARGET_SRC osgqfont.cpp )
SET(TARGET_ADDED_LIBRARIES osgQt osgText) SET(TARGET_ADDED_LIBRARIES osgQt osgText)
SET(TARGET_EXTERNAL_LIBRARIES ${QT_QTCORE_LIBRARY_RELEASE} ${QT_QTGUI_LIBRARY_RELEASE} ${QT_QTOPENGL_LIBRARY_RELEASE} ) IF ( NOT Qt5Widgets_FOUND )
INCLUDE_DIRECTORIES( ${QT_INCLUDE_DIR} ${QT_QTCORE_INCLUDE_DIR} ${QT_QTGUI_INCLUDE_DIR} ${QT_QTOPENGL_INCLUDE_DIR} )
SET(TARGET_EXTERNAL_LIBRARIES ${QT_QTCORE_LIBRARY_RELEASE} ${QT_QTGUI_LIBRARY_RELEASE} ${QT_QTOPENGL_LIBRARY_RELEASE} )
ENDIF()
#### end var setup ### #### end var setup ###
SETUP_EXAMPLE(osgqfont) SET ( EXAMPLE_NAME osgqfont )
SETUP_EXAMPLE(${EXAMPLE_NAME})
IF ( Qt5Widgets_FOUND )
qt5_use_modules( example_${EXAMPLE_NAME} Widgets OpenGL )
ENDIF( Qt5Widgets_FOUND )

View File

@@ -16,9 +16,9 @@
* THE SOFTWARE. * THE SOFTWARE.
*/ */
#include <QtGui/QApplication> #include <QApplication>
#include <QtGui/QGridLayout> #include <QGridLayout>
#include <QtGui/QWidget> #include <QWidget>
#include <osgQt/GraphicsWindowQt> #include <osgQt/GraphicsWindowQt>
#include <osgQt/QFontImplementation> #include <osgQt/QFontImplementation>

View File

@@ -2,15 +2,26 @@ SET( TARGET_SRC
osgviewerQt.cpp osgviewerQt.cpp
) )
IF( QT4_FOUND ) IF ( NOT Qt5Widgets_FOUND )
SET(TARGET_EXTERNAL_LIBRARIES ${QT_QTCORE_LIBRARY_RELEASE} ${QT_QTGUI_LIBRARY_RELEASE} ${QT_QTOPENGL_LIBRARY_RELEASE} ) IF( QT4_FOUND )
SET(TARGET_EXTERNAL_LIBRARIES ${QT_QTCORE_LIBRARY_RELEASE} ${QT_QTGUI_LIBRARY_RELEASE}
${QT_QTOPENGL_LIBRARY_RELEASE} )
ADD_DEFINITIONS(-DUSE_QT4) ADD_DEFINITIONS(-DUSE_QT4)
ELSE( QT4_FOUND ) ELSE( QT4_FOUND )
SET(TARGET_EXTERNAL_LIBRARIES ${QT_LIBRARIES} ) SET(TARGET_EXTERNAL_LIBRARIES ${QT_LIBRARIES} )
ENDIF( QT4_FOUND ) ENDIF( QT4_FOUND )
INCLUDE_DIRECTORIES( ${QT_INCLUDE_DIR} ) INCLUDE_DIRECTORIES( ${QT_INCLUDE_DIR} ${QT_QTCORE_INCLUDE_DIR} ${QT_QTGUI_INCLUDE_DIR}
${QT_QTOPENGL_INCLUDE_DIR} )
ENDIF()
SET(TARGET_ADDED_LIBRARIES osgWidget osgQt) SET(TARGET_ADDED_LIBRARIES osgWidget osgQt)
SETUP_EXAMPLE( osgviewerQt ) SET( EXAMPLE_NAME osgviewerQt )
SETUP_EXAMPLE( ${EXAMPLE_NAME} )
IF ( Qt5Widgets_FOUND )
qt5_use_modules( example_${EXAMPLE_NAME} Widgets OpenGL )
ENDIF( Qt5Widgets_FOUND )

View File

@@ -1,6 +1,6 @@
#include <QtCore/QTimer> #include <QTimer>
#include <QtGui/QApplication> #include <QApplication>
#include <QtGui/QGridLayout> #include <QGridLayout>
#include <osgViewer/CompositeViewer> #include <osgViewer/CompositeViewer>
#include <osgViewer/ViewerEventHandlers> #include <osgViewer/ViewerEventHandlers>
@@ -19,6 +19,9 @@ public:
ViewerWidget(osgViewer::ViewerBase::ThreadingModel threadingModel=osgViewer::CompositeViewer::SingleThreaded) : QWidget() ViewerWidget(osgViewer::ViewerBase::ThreadingModel threadingModel=osgViewer::CompositeViewer::SingleThreaded) : QWidget()
{ {
setThreadingModel(threadingModel); setThreadingModel(threadingModel);
// disable the default setting of viewer.done() by pressing Escape.
setKeyEventSetsDone(0);
QWidget* widget1 = addViewWidget( createCamera(0,0,100,100), osgDB::readNodeFile("cow.osgt") ); QWidget* widget1 = addViewWidget( createCamera(0,0,100,100), osgDB::readNodeFile("cow.osgt") );
QWidget* widget2 = addViewWidget( createCamera(0,0,100,100), osgDB::readNodeFile("glider.osgt") ); QWidget* widget2 = addViewWidget( createCamera(0,0,100,100), osgDB::readNodeFile("glider.osgt") );

View File

@@ -14,11 +14,11 @@
#ifndef OSGVIEWER_GRAPHICSWINDOWQT #ifndef OSGVIEWER_GRAPHICSWINDOWQT
#define OSGVIEWER_GRAPHICSWINDOWQT #define OSGVIEWER_GRAPHICSWINDOWQT
#include <QtCore/QMutex> #include <QMutex>
#include <QtCore/QEvent> #include <QEvent>
#include <QtCore/QQueue> #include <QQueue>
#include <QtCore/QSet> #include <QSet>
#include <QtOpenGL/QGLWidget> #include <QGLWidget>
#include <osgViewer/GraphicsWindow> #include <osgViewer/GraphicsWindow>
#include <osgQt/Export> #include <osgQt/Export>

View File

@@ -18,12 +18,12 @@
#include <osg/observer_ptr> #include <osg/observer_ptr>
#include <osgQt/Export> #include <osgQt/Export>
#include <QtCore/QPointer> #include <QPointer>
#include <QtGui/QGraphicsScene> #include <QGraphicsScene>
#include <QtGui/QGraphicsView> #include <QGraphicsView>
#include <QtGui/QApplication> #include <QApplication>
#include <QtGui/QPainter> #include <QPainter>
#include <QtGui/QtEvents> #include <QtEvents>
namespace osgQt namespace osgQt
{ {

View File

@@ -17,7 +17,12 @@
// make sure this header isn't built as par of osgQt, leaving it to applications to build // make sure this header isn't built as par of osgQt, leaving it to applications to build
#if !defined(OSGQT_LIBRARY) && !defined(OSG_LIBRARY_STATIC) #if !defined(OSGQT_LIBRARY) && !defined(OSG_LIBRARY_STATIC)
#include <QtWebKit/QtWebKit> #if QT_VERSION >= 0x050000
# include <QtWebKitWidgets>
#else
# include <QtWebKit>
#endif
#include <osgWidget/Browser> #include <osgWidget/Browser>
#include <osgQt/QGraphicsViewAdapter> #include <osgQt/QGraphicsViewAdapter>

View File

@@ -34,7 +34,7 @@ FOREACH( mylibfolder
ENDFOREACH() ENDFOREACH()
IF (QT4_FOUND AND NOT ANDROID) IF ((QT4_FOUND OR Qt5Widgets_FOUND) AND NOT ANDROID)
ADD_SUBDIRECTORY(osgQt) ADD_SUBDIRECTORY(osgQt)
ENDIF() ENDIF()

View File

@@ -81,14 +81,14 @@ IF(CMAKE_SYSTEM MATCHES IRIX)
ENDIF(CMAKE_SYSTEM MATCHES IRIX) ENDIF(CMAKE_SYSTEM MATCHES IRIX)
# Add support for using Qt threads # Add support for using Qt threads
IF(QT4_FOUND) IF(QT4_FOUND OR Qt5Widgets_FOUND)
OPTION(BUILD_OPENTHREADS_WITH_QT "Build OpenThreads with Qt threading support." OFF) OPTION(BUILD_OPENTHREADS_WITH_QT "Build OpenThreads with Qt threading support." OFF)
ENDIF() ENDIF()
# Maybe we should be using the FindThreads.cmake module? # Maybe we should be using the FindThreads.cmake module?
IF(ANDROID) IF(ANDROID)
SUBDIRS(pthreads) SUBDIRS(pthreads)
ELSEIF(QT4_FOUND AND BUILD_OPENTHREADS_WITH_QT) ELSEIF((QT4_FOUND OR Qt5Widgets_FOUND) AND BUILD_OPENTHREADS_WITH_QT)
SUBDIRS(qt) SUBDIRS(qt)
ELSEIF(WIN32) ELSEIF(WIN32)
# So I think Cygwin wants to use pthreads # So I think Cygwin wants to use pthreads

View File

@@ -39,8 +39,15 @@ IF(OPENTHREADS_SONAMES)
SET_TARGET_PROPERTIES(${LIB_NAME} PROPERTIES VERSION ${OPENTHREADS_VERSION} SOVERSION ${OPENTHREADS_SOVERSION}) SET_TARGET_PROPERTIES(${LIB_NAME} PROPERTIES VERSION ${OPENTHREADS_VERSION} SOVERSION ${OPENTHREADS_SOVERSION})
ENDIF() ENDIF()
TARGET_LINK_LIBRARIES(${LIB_NAME} ${QT_QTCORE_LIBRARY}) if ( QT4_FOUND )
INCLUDE_DIRECTORIES(${QT_INCLUDE_DIR} ${QT_QTCORE_INCLUDE_DIR}) TARGET_LINK_LIBRARIES(${LIB_NAME} ${QT_QTCORE_LIBRARY})
INCLUDE_DIRECTORIES(${QT_INCLUDE_DIR} ${QT_QTCORE_INCLUDE_DIR})
else( QT4_FOUND )
IF ( Qt5Widgets_FOUND )
qt5_use_modules( ${LIB_NAME} Core )
ENDIF ( Qt5Widgets_FOUND )
endif( QT4_FOUND )
# Since we're building different platforms binaries in # Since we're building different platforms binaries in
# their respective directories, we need to set the # their respective directories, we need to set the

View File

@@ -20,7 +20,7 @@
#define _QTCONDITIONPRIVATEDATA_H_ #define _QTCONDITIONPRIVATEDATA_H_
#include <OpenThreads/Condition> #include <OpenThreads/Condition>
#include <QtCore/QWaitCondition> #include <QWaitCondition>
class QtConditionPrivateData : public QWaitCondition class QtConditionPrivateData : public QWaitCondition
{ {

View File

@@ -20,7 +20,7 @@
#define _QTMUTEXPRIVATEDATA_H_ #define _QTMUTEXPRIVATEDATA_H_
#include <OpenThreads/Mutex> #include <OpenThreads/Mutex>
#include <QtCore/QMutex> #include <QMutex>
class QtMutexPrivateData : public QMutex class QtMutexPrivateData : public QMutex
{ {

View File

@@ -16,7 +16,7 @@
// ~~~~~~~~~~~ // ~~~~~~~~~~~
#include "QtThreadPrivateData.h" #include "QtThreadPrivateData.h"
#include <QtCore/QCoreApplication> #include <QCoreApplication>
#include <iostream> #include <iostream>
using namespace OpenThreads; using namespace OpenThreads;

View File

@@ -21,7 +21,7 @@
#include <OpenThreads/Thread> #include <OpenThreads/Thread>
#include <OpenThreads/Block> #include <OpenThreads/Block>
#include <QtCore/QThread> #include <QThread>
struct QtThreadCanceled {}; struct QtThreadCanceled {};

View File

@@ -12,7 +12,11 @@ SET(SOURCES_H
${HEADER_PATH}/QGraphicsViewAdapter ${HEADER_PATH}/QGraphicsViewAdapter
) )
QT4_WRAP_CPP( SOURCES_H_MOC ${SOURCES_H} OPTIONS "-f" ) IF ( Qt5Widgets_FOUND )
QT5_WRAP_CPP( SOURCES_H_MOC ${SOURCES_H} OPTIONS "-f" )
ELSE()
QT4_WRAP_CPP( SOURCES_H_MOC ${SOURCES_H} OPTIONS "-f" )
ENDIF()
SET(TARGET_H SET(TARGET_H
${HEADER_PATH}/Export ${HEADER_PATH}/Export
@@ -47,20 +51,27 @@ IF(CMAKE_COMPILER_IS_GNUCXX)
STRING(REGEX REPLACE "-pedantic" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") STRING(REGEX REPLACE "-pedantic" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
ENDIF() ENDIF()
SET(TARGET_LIBRARIES
${TARGET_LIBRARIES}
${QT_QTCORE_LIBRARY}
${QT_QTGUI_LIBRARY}
${QT_QTOPENGL_LIBRARY}
)
# FIXME: This should work but something with the LINK_WITH_VARIABLES macro is not working # FIXME: This should work but something with the LINK_WITH_VARIABLES macro is not working
#SET(TARGET_LIBRARIES_VARS #SET(TARGET_LIBRARIES_VARS
# QT_QTCORE_LIBRARY # QT_QTCORE_LIBRARY
# QT_QTGUI_LIBRARY # QT_QTGUI_LIBRARY
# QT_QTOPENGL_LIBRARY # QT_QTOPENGL_LIBRARY
#) #)
INCLUDE_DIRECTORIES(${QT_INCLUDE_DIR} ${QT_QTCORE_INCLUDE_DIR})
IF( QT4_FOUND )
INCLUDE_DIRECTORIES( ${QT_INCLUDE_DIR} ${QT_QTCORE_INCLUDE_DIR} ${QT_QTGUI_INCLUDE_DIR}
${QT_QTOPENGL_INCLUDE_DIR} )
SET(TARGET_LIBRARIES
${TARGET_LIBRARIES}
${QT_QTCORE_LIBRARY}
${QT_QTGUI_LIBRARY}
${QT_QTOPENGL_LIBRARY}
)
ENDIF( QT4_FOUND )
SETUP_LIBRARY(${LIB_NAME}) SETUP_LIBRARY(${LIB_NAME})
IF ( Qt5Widgets_FOUND )
qt5_use_modules( ${LIB_NAME} Widgets OpenGL )
ENDIF ( Qt5Widgets_FOUND )

View File

@@ -14,7 +14,7 @@
#include <osg/DeleteHandler> #include <osg/DeleteHandler>
#include <osgQt/GraphicsWindowQt> #include <osgQt/GraphicsWindowQt>
#include <osgViewer/ViewerBase> #include <osgViewer/ViewerBase>
#include <QtGui/QInputEvent> #include <QInputEvent>
using namespace osgQt; using namespace osgQt;
@@ -96,7 +96,7 @@ public:
KeyMap::iterator itr = mKeyMap.find(event->key()); KeyMap::iterator itr = mKeyMap.find(event->key());
if (itr == mKeyMap.end()) if (itr == mKeyMap.end())
{ {
return int(*(event->text().toAscii().data())); return int(*(event->text().toLatin1().data()));
} }
else else
return itr->second; return itr->second;

View File

@@ -16,10 +16,10 @@
#include <osgDB/Registry> #include <osgDB/Registry>
#include <osgText/Font> #include <osgText/Font>
#include <QtGui/QFont> #include <QFont>
#include <QtGui/QFontMetrics> #include <QFontMetrics>
#include <QtGui/QImage> #include <QImage>
#include <QtGui/QPainter> #include <QPainter>
namespace osgQt { namespace osgQt {

View File

@@ -21,8 +21,8 @@
#include <osg/NodeVisitor> #include <osg/NodeVisitor>
#include <osg/io_utils> #include <osg/io_utils>
#include <QtGui/QGraphicsItem> #include <QGraphicsItem>
#include <QtGui/QGraphicsProxyWidget> #include <QGraphicsProxyWidget>
#define MYQKEYEVENT 2000 #define MYQKEYEVENT 2000
#define MYQPOINTEREVENT 2001 #define MYQPOINTEREVENT 2001

View File

@@ -12,7 +12,7 @@
*/ */
#include <osgQt/QWidgetImage> #include <osgQt/QWidgetImage>
#include <QtGui/QLayout> #include <QLayout>
namespace osgQt namespace osgQt
{ {