diff --git a/CMakeLists.txt b/CMakeLists.txt index 53ecdf39ef5f916068b62dd6b8daf694df54cb62..8b3763f549dced8be6e708b7be45ab44bfca39a2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -69,7 +69,6 @@ IF(NOT CLIENT_ONLY) SET(CMAKE_INCLUDE_CURRENT_DIR ON) IF(USE_QT4) FIND_PACKAGE(Qt4 REQUIRED QtCore QtGui QtOpenGl QtNetwork) - ADD_DEFINITIONS(-DUSE_QT4) SET(PKG_CONFIG_EXTRA "qtversion: ${QT_VERSION_MAJOR}.${QT_VERSION_MINOR}.${QT_VERSION_PATCH}") ELSE(USE_QT4) FOREACH (component "Core" "Widgets" "Gui" "OpenGL" "Network") diff --git a/plugins/pyqgv/plugin.cc b/plugins/pyqgv/plugin.cc index a6709a1159e50cdb574ed9229b16ed93831a615d..0e86499c645ce1e751806b476bf3c80924e61a0d 100644 --- a/plugins/pyqgv/plugin.cc +++ b/plugins/pyqgv/plugin.cc @@ -25,7 +25,7 @@ namespace PyQgv { registerQGV(); } -#ifdef USE_QT4 +#if (QT_VERSION < QT_VERSION_CHECK(5,0,0)) Q_EXPORT_PLUGIN2 (pyqgv, Plugin) -#endif // USE_QT4 +#endif } // namespace PyQgv diff --git a/plugins/pyqgv/plugin.hh b/plugins/pyqgv/plugin.hh index bd5d8b20d2957bb7d0ab420a66f69c146e290e01..336c6b91f9aeb96cf3da647f3a8ab7abb14bdb4c 100644 --- a/plugins/pyqgv/plugin.hh +++ b/plugins/pyqgv/plugin.hh @@ -17,6 +17,7 @@ // <http://www.gnu.org/licenses/>. #include <QObject> +#include <QtGlobal> #include <gepetto/gui/plugin-interface.hh> @@ -31,9 +32,9 @@ namespace PyQgv { class Plugin : public QObject, public gepetto::gui::PluginInterface { Q_OBJECT Q_INTERFACES (gepetto::gui::PluginInterface) -#ifndef USE_QT4 +#if (QT_VERSION >= QT_VERSION_CHECK(5,0,0)) Q_PLUGIN_METADATA (IID "gepetto-viewer-corba.pyqgv") -#endif // USE_QT4 +#endif public: QString name () const { return QString("PyQGV"); } diff --git a/src/gui/main.cc.in b/src/gui/main.cc.in index 45803e6888f971a049fb56cfe8f132799fd31ddf..12b2d30c3fdfed2a1432ba02bf7f37a93e3e5f0d 100644 --- a/src/gui/main.cc.in +++ b/src/gui/main.cc.in @@ -4,6 +4,7 @@ #include <QProcessEnvironment> #include <QSplashScreen> #include <QIcon> +#include <QtGlobal> #include <QItemSelection> @@ -14,9 +15,11 @@ using namespace gepetto::gui; -#if (QT_VERSION <= QT_VERSION_CHECK(5,5,1)) +// TODO check what version exactly already includes the metatype declaration. +// It is not in 5.2.1 and it is in 5.5.1 +#if (QT_VERSION < QT_VERSION_CHECK(5,5,1)) Q_DECLARE_METATYPE(QItemSelection) -#endif // USE_QT4 +#endif void setupApplication () { @@ -42,11 +45,11 @@ int main(int argc, char *argv[]) SafeApplication a(argc, argv); a.setStyle(QStyleFactory::create ( -#ifdef USE_QT4 +#if (QT_VERSION < QT_VERSION_CHECK(5,0,0)) "cleanlooks" -#else // USE_QT4 +#else "fusion" -#endif // USE_QT4 +#endif )); QPixmap pixmap(":/img/gepetto.png"); a.setWindowIcon(pixmap); diff --git a/src/gui/mainwindow.cc b/src/gui/mainwindow.cc index 2fabbba7be01961c68f40fbad74ff39ac22e8ff4..54d6769c11a91051b93fa0083fe5914aa4e6c285 100644 --- a/src/gui/mainwindow.cc +++ b/src/gui/mainwindow.cc @@ -1,6 +1,7 @@ #include "gepetto/gui/mainwindow.hh" #include "ui_mainwindow.h" +#include <QtGlobal> #include <QScrollBar> #include <QMessageBox> @@ -217,9 +218,9 @@ namespace gepetto { return osgWindows_.last(); } else { OSGWidget* osgWidget = new OSGWidget (osgViewerManagers_, name, this, 0 -#ifndef USE_QT4 +#if (QT_VERSION >= QT_VERSION_CHECK(5,0,0)) , osgViewer::Viewer::SingleThreaded -#endif // USE_QT4 +#endif ); osgWidget->setObjectName(name.c_str()); addOSGWidget (osgWidget);