From bdfd18dc03cc9893e18b741019b2c8d2c577f3de Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Mon, 10 Jun 2013 14:34:25 +0000 Subject: [PATCH] From Kristofer Tingdahl, with additions from Riccardo Corsi and Robert Milharcic, support for Qt5 build --- CMakeLists.txt | 43 ++++++++++++++++----- examples/CMakeLists.txt | 6 +-- examples/osgQtBrowser/CMakeLists.txt | 15 +++++-- examples/osgQtBrowser/osgQtBrowser.cpp | 20 ++++++---- examples/osgQtWidgets/CMakeLists.txt | 13 +++++-- examples/osgQtWidgets/osgQtWidgets.cpp | 25 ++++++------ examples/osgqfont/CMakeLists.txt | 13 +++++-- examples/osgqfont/osgqfont.cpp | 6 +-- examples/osgviewerQt/CMakeLists.txt | 23 ++++++++--- examples/osgviewerQt/osgviewerQt.cpp | 9 +++-- include/osgQt/GraphicsWindowQt | 10 ++--- include/osgQt/QGraphicsViewAdapter | 12 +++--- include/osgQt/QWebViewImage | 7 +++- src/CMakeLists.txt | 2 +- src/OpenThreads/CMakeLists.txt | 4 +- src/OpenThreads/qt/CMakeLists.txt | 11 +++++- src/OpenThreads/qt/QtConditionPrivateData.h | 2 +- src/OpenThreads/qt/QtMutexPrivateData.h | 2 +- src/OpenThreads/qt/QtThread.cpp | 2 +- src/OpenThreads/qt/QtThreadPrivateData.h | 2 +- src/osgQt/CMakeLists.txt | 29 +++++++++----- src/osgQt/GraphicsWindowQt.cpp | 4 +- src/osgQt/QFontImplementation.cpp | 8 ++-- src/osgQt/QGraphicsViewAdapter.cpp | 4 +- src/osgQt/QWidgetImage.cpp | 2 +- 25 files changed, 184 insertions(+), 90 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c95864b52..ea91f4338 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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) # To select a specific version of QT define DESIRED_QT_VERSION -# via cmake -DDESIRED_QT_VERSION=4 - IF (DESIRED_QT_VERSION) +# via cmake -DDESIRED_QT_VERSION=5 +# 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) ELSE() FIND_PACKAGE(Qt3) @@ -547,13 +550,35 @@ IF(OSG_USE_QT AND NOT ANDROID) 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) - FIND_PACKAGE(Qt3) + IF ( NOT Qt5Widgets_FOUND ) + FIND_PACKAGE(Qt4) + + IF (NOT QT4_FOUND) + FIND_PACKAGE(Qt3) + 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() #optional example related dependencies @@ -1029,9 +1054,9 @@ SET(PKGCONFIG_FILES openscenegraph-osgVolume ) -IF(QT4_FOUND) +IF(QT4_FOUND OR Qt5Widgets_FOUND ) SET(PKGCONFIG_FILES ${PKGCONFIG_FILES} openscenegraph-osgQt) -ENDIF(QT4_FOUND) +ENDIF() FOREACH(PKGCONFIG_FILE ${PKGCONFIG_FILES}) CONFIGURE_FILE(${PROJECT_SOURCE_DIR}/packaging/pkgconfig/${PKGCONFIG_FILE}.pc.in diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index 7e1e79ba3..22b58b7d4 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -206,14 +206,14 @@ IF(DYNAMIC_OPENSCENEGRAPH) 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(osgqfont) ENDIF() - IF (QT4_FOUND AND QT_QTWEBKIT_FOUND) + IF ( (QT4_FOUND AND QT_QTWEBKIT_FOUND) OR Qt5WebKitWidgets_FOUND ) ADD_SUBDIRECTORY(osgQtWidgets) ADD_SUBDIRECTORY(osgQtBrowser) ENDIF() diff --git a/examples/osgQtBrowser/CMakeLists.txt b/examples/osgQtBrowser/CMakeLists.txt index 735a8a8cc..d8e5e6d16 100644 --- a/examples/osgQtBrowser/CMakeLists.txt +++ b/examples/osgQtBrowser/CMakeLists.txt @@ -7,10 +7,19 @@ IF(CMAKE_COMPILER_IS_GNUCXX) STRING(REGEX REPLACE "-pedantic" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") ENDIF() -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}) +if ( QT4_FOUND ) + 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) #### 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 ) + + diff --git a/examples/osgQtBrowser/osgQtBrowser.cpp b/examples/osgQtBrowser/osgQtBrowser.cpp index 6459b9511..8f3df9fb8 100644 --- a/examples/osgQtBrowser/osgQtBrowser.cpp +++ b/examples/osgQtBrowser/osgQtBrowser.cpp @@ -29,14 +29,20 @@ #include #include +#include +#if QT_VERSION >= 0x050000 +# include +#else +# include +#endif -#include -#include -#include -#include -#include -#include -#include +#include + +#include +#include +#include +#include +#include #include #include diff --git a/examples/osgQtWidgets/CMakeLists.txt b/examples/osgQtWidgets/CMakeLists.txt index 2266ee4f8..670a29216 100644 --- a/examples/osgQtWidgets/CMakeLists.txt +++ b/examples/osgQtWidgets/CMakeLists.txt @@ -7,10 +7,17 @@ IF(CMAKE_COMPILER_IS_GNUCXX) STRING(REGEX REPLACE "-pedantic" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") ENDIF() -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}) +if ( QT4_FOUND ) + 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) #### 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 ) diff --git a/examples/osgQtWidgets/osgQtWidgets.cpp b/examples/osgQtWidgets/osgQtWidgets.cpp index 9c05822f2..861be0af0 100644 --- a/examples/osgQtWidgets/osgQtWidgets.cpp +++ b/examples/osgQtWidgets/osgQtWidgets.cpp @@ -36,17 +36,16 @@ #include -//#include -//#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +//#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include #include @@ -98,7 +97,11 @@ protected: virtual void mousePressEvent(QMouseEvent* e) { 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); +#endif std::cout << "Ok was " << (ok ? "" : "not") << " pressed, val is " << val << std::endl; } }; diff --git a/examples/osgqfont/CMakeLists.txt b/examples/osgqfont/CMakeLists.txt index fe78e6574..3902ecc38 100644 --- a/examples/osgqfont/CMakeLists.txt +++ b/examples/osgqfont/CMakeLists.txt @@ -1,11 +1,18 @@ #this file is automatically generated -INCLUDE_DIRECTORIES( ${QT_INCLUDE_DIR} ) ADD_DEFINITIONS(-DUSE_QT4) SET(TARGET_SRC osgqfont.cpp ) 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 ### -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 ) diff --git a/examples/osgqfont/osgqfont.cpp b/examples/osgqfont/osgqfont.cpp index 6cc3d99cd..615cc57e8 100644 --- a/examples/osgqfont/osgqfont.cpp +++ b/examples/osgqfont/osgqfont.cpp @@ -16,9 +16,9 @@ * THE SOFTWARE. */ -#include -#include -#include +#include +#include +#include #include #include diff --git a/examples/osgviewerQt/CMakeLists.txt b/examples/osgviewerQt/CMakeLists.txt index 48075362c..ae601494d 100644 --- a/examples/osgviewerQt/CMakeLists.txt +++ b/examples/osgviewerQt/CMakeLists.txt @@ -2,15 +2,26 @@ SET( TARGET_SRC osgviewerQt.cpp ) -IF( QT4_FOUND ) - SET(TARGET_EXTERNAL_LIBRARIES ${QT_QTCORE_LIBRARY_RELEASE} ${QT_QTGUI_LIBRARY_RELEASE} ${QT_QTOPENGL_LIBRARY_RELEASE} ) +IF ( NOT Qt5Widgets_FOUND ) + 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 ) + ELSE( QT4_FOUND ) 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) -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 ) + diff --git a/examples/osgviewerQt/osgviewerQt.cpp b/examples/osgviewerQt/osgviewerQt.cpp index a9cd3c46d..4fab6daae 100644 --- a/examples/osgviewerQt/osgviewerQt.cpp +++ b/examples/osgviewerQt/osgviewerQt.cpp @@ -1,6 +1,6 @@ -#include -#include -#include +#include +#include +#include #include #include @@ -19,6 +19,9 @@ public: ViewerWidget(osgViewer::ViewerBase::ThreadingModel threadingModel=osgViewer::CompositeViewer::SingleThreaded) : QWidget() { 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* widget2 = addViewWidget( createCamera(0,0,100,100), osgDB::readNodeFile("glider.osgt") ); diff --git a/include/osgQt/GraphicsWindowQt b/include/osgQt/GraphicsWindowQt index 029c04569..99ae31c17 100644 --- a/include/osgQt/GraphicsWindowQt +++ b/include/osgQt/GraphicsWindowQt @@ -14,11 +14,11 @@ #ifndef OSGVIEWER_GRAPHICSWINDOWQT #define OSGVIEWER_GRAPHICSWINDOWQT -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include #include #include diff --git a/include/osgQt/QGraphicsViewAdapter b/include/osgQt/QGraphicsViewAdapter index 5afb01ecc..0458a005a 100644 --- a/include/osgQt/QGraphicsViewAdapter +++ b/include/osgQt/QGraphicsViewAdapter @@ -18,12 +18,12 @@ #include #include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include namespace osgQt { diff --git a/include/osgQt/QWebViewImage b/include/osgQt/QWebViewImage index c09e98e9f..be16446f5 100644 --- a/include/osgQt/QWebViewImage +++ b/include/osgQt/QWebViewImage @@ -17,7 +17,12 @@ // 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) -#include +#if QT_VERSION >= 0x050000 +# include +#else +# include +#endif + #include #include diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index f45dc2007..4c3115101 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -34,7 +34,7 @@ FOREACH( mylibfolder ENDFOREACH() -IF (QT4_FOUND AND NOT ANDROID) +IF ((QT4_FOUND OR Qt5Widgets_FOUND) AND NOT ANDROID) ADD_SUBDIRECTORY(osgQt) ENDIF() diff --git a/src/OpenThreads/CMakeLists.txt b/src/OpenThreads/CMakeLists.txt index ce1bd8bac..168055ebe 100644 --- a/src/OpenThreads/CMakeLists.txt +++ b/src/OpenThreads/CMakeLists.txt @@ -81,14 +81,14 @@ IF(CMAKE_SYSTEM MATCHES IRIX) ENDIF(CMAKE_SYSTEM MATCHES IRIX) # 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) ENDIF() # Maybe we should be using the FindThreads.cmake module? IF(ANDROID) SUBDIRS(pthreads) -ELSEIF(QT4_FOUND AND BUILD_OPENTHREADS_WITH_QT) +ELSEIF((QT4_FOUND OR Qt5Widgets_FOUND) AND BUILD_OPENTHREADS_WITH_QT) SUBDIRS(qt) ELSEIF(WIN32) # So I think Cygwin wants to use pthreads diff --git a/src/OpenThreads/qt/CMakeLists.txt b/src/OpenThreads/qt/CMakeLists.txt index 7352475fe..29c8ff6f5 100644 --- a/src/OpenThreads/qt/CMakeLists.txt +++ b/src/OpenThreads/qt/CMakeLists.txt @@ -39,8 +39,15 @@ IF(OPENTHREADS_SONAMES) SET_TARGET_PROPERTIES(${LIB_NAME} PROPERTIES VERSION ${OPENTHREADS_VERSION} SOVERSION ${OPENTHREADS_SOVERSION}) ENDIF() -TARGET_LINK_LIBRARIES(${LIB_NAME} ${QT_QTCORE_LIBRARY}) -INCLUDE_DIRECTORIES(${QT_INCLUDE_DIR} ${QT_QTCORE_INCLUDE_DIR}) +if ( QT4_FOUND ) + 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 # their respective directories, we need to set the diff --git a/src/OpenThreads/qt/QtConditionPrivateData.h b/src/OpenThreads/qt/QtConditionPrivateData.h index b98a44be5..acac9ae68 100644 --- a/src/OpenThreads/qt/QtConditionPrivateData.h +++ b/src/OpenThreads/qt/QtConditionPrivateData.h @@ -20,7 +20,7 @@ #define _QTCONDITIONPRIVATEDATA_H_ #include -#include +#include class QtConditionPrivateData : public QWaitCondition { diff --git a/src/OpenThreads/qt/QtMutexPrivateData.h b/src/OpenThreads/qt/QtMutexPrivateData.h index 4b3b5a3e3..4b94f3c31 100644 --- a/src/OpenThreads/qt/QtMutexPrivateData.h +++ b/src/OpenThreads/qt/QtMutexPrivateData.h @@ -20,7 +20,7 @@ #define _QTMUTEXPRIVATEDATA_H_ #include -#include +#include class QtMutexPrivateData : public QMutex { diff --git a/src/OpenThreads/qt/QtThread.cpp b/src/OpenThreads/qt/QtThread.cpp index 803da0cd3..0b9367b15 100644 --- a/src/OpenThreads/qt/QtThread.cpp +++ b/src/OpenThreads/qt/QtThread.cpp @@ -16,7 +16,7 @@ // ~~~~~~~~~~~ #include "QtThreadPrivateData.h" -#include +#include #include using namespace OpenThreads; diff --git a/src/OpenThreads/qt/QtThreadPrivateData.h b/src/OpenThreads/qt/QtThreadPrivateData.h index 918b73096..a2cc408da 100644 --- a/src/OpenThreads/qt/QtThreadPrivateData.h +++ b/src/OpenThreads/qt/QtThreadPrivateData.h @@ -21,7 +21,7 @@ #include #include -#include +#include struct QtThreadCanceled {}; diff --git a/src/osgQt/CMakeLists.txt b/src/osgQt/CMakeLists.txt index 9a8b43e36..43afffeeb 100644 --- a/src/osgQt/CMakeLists.txt +++ b/src/osgQt/CMakeLists.txt @@ -12,7 +12,11 @@ SET(SOURCES_H ${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 ${HEADER_PATH}/Export @@ -47,20 +51,27 @@ IF(CMAKE_COMPILER_IS_GNUCXX) STRING(REGEX REPLACE "-pedantic" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") 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 #SET(TARGET_LIBRARIES_VARS # QT_QTCORE_LIBRARY # QT_QTGUI_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}) +IF ( Qt5Widgets_FOUND ) + qt5_use_modules( ${LIB_NAME} Widgets OpenGL ) +ENDIF ( Qt5Widgets_FOUND ) diff --git a/src/osgQt/GraphicsWindowQt.cpp b/src/osgQt/GraphicsWindowQt.cpp index 9141ba785..55358bcfc 100644 --- a/src/osgQt/GraphicsWindowQt.cpp +++ b/src/osgQt/GraphicsWindowQt.cpp @@ -14,7 +14,7 @@ #include #include #include -#include +#include using namespace osgQt; @@ -96,7 +96,7 @@ public: KeyMap::iterator itr = mKeyMap.find(event->key()); if (itr == mKeyMap.end()) { - return int(*(event->text().toAscii().data())); + return int(*(event->text().toLatin1().data())); } else return itr->second; diff --git a/src/osgQt/QFontImplementation.cpp b/src/osgQt/QFontImplementation.cpp index e0cbc2818..4cf8304b9 100644 --- a/src/osgQt/QFontImplementation.cpp +++ b/src/osgQt/QFontImplementation.cpp @@ -16,10 +16,10 @@ #include #include -#include -#include -#include -#include +#include +#include +#include +#include namespace osgQt { diff --git a/src/osgQt/QGraphicsViewAdapter.cpp b/src/osgQt/QGraphicsViewAdapter.cpp index 8f81d1f41..6caaca3f6 100644 --- a/src/osgQt/QGraphicsViewAdapter.cpp +++ b/src/osgQt/QGraphicsViewAdapter.cpp @@ -21,8 +21,8 @@ #include #include -#include -#include +#include +#include #define MYQKEYEVENT 2000 #define MYQPOINTEREVENT 2001 diff --git a/src/osgQt/QWidgetImage.cpp b/src/osgQt/QWidgetImage.cpp index 823180e4b..f6b5b9f39 100644 --- a/src/osgQt/QWidgetImage.cpp +++ b/src/osgQt/QWidgetImage.cpp @@ -12,7 +12,7 @@ */ #include -#include +#include namespace osgQt {