Commit 373d4a8e authored by Johnny Jazeix's avatar Johnny Jazeix

conf and source code modified for compiling with qt5 (compiles with Qt4 if Qt5...

conf and source code modified for compiling with qt5 (compiles with Qt4 if Qt5 is not found and Qt4 is installed)
parent 97b960a6
......@@ -31,10 +31,26 @@ include (CheckLibraryExists)
include (CMakeDependentOption)
### Required Packages
find_package(Qt4 COMPONENTS QtCore QtGui QtXml REQUIRED)
set(QT_USE_QTUITOOLS ON)
set(QT_USE_QTOPENGL ON)
include(${QT_USE_FILE})
# Try to find Qt5 : http://forum.openscenegraph.org/viewtopic.php?t=11431
set(USE_QT5 OFF)
# QUIET option disables messages if the package cannot be found.
find_package(Qt5Widgets QUIET)
if(Qt5Widgets_FOUND)
# CMake 2.8.8 or greater required for qt5 use
if("${CMAKE_VERSION}" VERSION_GREATER 2.8.7)
set(USE_QT5 ON)
endif()
endif()
if(USE_QT5)
set(CMAKE_AUTOMOC ON)
find_package(Qt5 COMPONENTS Core Xml Widgets OpenGL UiTools REQUIRED)
else(USE_QT5) # Try Qt4
find_package(Qt4 COMPONENTS QtCore QtGui QtXml REQUIRED)
set(QT_USE_QTUITOOLS ON)
set(QT_USE_QTOPENGL ON)
include(${QT_USE_FILE})
endif(USE_QT5)
#find_package(OpenGL)
find_package(GLU)
......
......@@ -30,4 +30,8 @@ set(DISTRIBUTION_srcs
add_library(Distribution SHARED ${DISTRIBUTION_srcs})
IF(USE_QT5)
qt5_use_modules(Distribution Widgets Core)
ENDIF(USE_QT5)
install(TARGETS Distribution DESTINATION ${HOME}/.vite)
\ No newline at end of file
#include <cmath>
#include <set>
#include <stack>
#include <vector>
......@@ -6,15 +7,15 @@
#include <fstream>
#include <algorithm>
/* -- */
#include <QWidget>
#include <QSlider>
#include <QPainter>
#include <QTextEdit>
#include <QHBoxLayout>
#include <QTreeWidgetItem>
#include <QStackedWidget>
#include <QApplication>
#include <QtGui>
#include <QGraphicsLineItem>
#include <QGraphicsScene>
#include <QGraphicsView>
/* -- */
#include "plugin/Plugin.hpp"
/* -- */
......@@ -414,8 +415,8 @@ private:
int width = 100;
int offsety = 100;
scene->addItem(new QGraphicsLineItem(0, 0+offsety, 0, -height+offsety, NULL, scene));
scene->addItem(new QGraphicsLineItem(0, 0+offsety, width, 0+offsety, NULL, scene));
scene->addItem(new QGraphicsLineItem(0, 0+offsety, 0, -height+offsety, NULL));
scene->addItem(new QGraphicsLineItem(0, 0+offsety, width, 0+offsety, NULL));
for (i = 0; i < nbreaks; i++)
{
......
......@@ -30,4 +30,8 @@ set(TRACEINFOS_srcs
add_library(TraceInfos SHARED ${TRACEINFOS_srcs})
IF(USE_QT5)
qt5_use_modules(TraceInfos Widgets Core)
ENDIF(USE_QT5)
install(TARGETS TraceInfos DESTINATION ${HOME}/.vite)
\ No newline at end of file
......@@ -373,10 +373,18 @@ IF(VITE_ENABLE_SERIALIZATION)
ENDIF(VITE_ENABLE_SERIALIZATION)
#############################################
# QT5
#############################################
IF(USE_QT5)
QT5_WRAP_UI(VITE_UIS_H ${VITE_UIS})
QT5_WRAP_CPP(VITE_MOC ${VITE_UIS_H} ${VITE_MOC_HDRS})
QT5_ADD_RESOURCES(VITE_RCC_SRCS ${VITE_RCCS})
ADD_DEFINITIONS(-DQT_NO_DEBUG)
#############################################
# QT4
#############################################
ELSE(USE_QT5)
QT4_AUTOMOC(${VITE_SRCS})
FOREACH(_hdrs_file ${VITE_HDRS})
GET_FILENAME_COMPONENT(_abs_file ${_hdrs_file} ABSOLUTE)
......@@ -393,6 +401,7 @@ QT4_ADD_RESOURCES(VITE_RCC_SRCS ${VITE_RCCS})
ADD_DEFINITIONS(-DQT_NO_DEBUG)
ENDIF(USE_QT5)
#############################################
INCLUDE_DIRECTORIES(
......@@ -425,6 +434,13 @@ else( APPLE )
ADD_EXECUTABLE(vite ${VITE_SRCS} ${VITE_MOC} ${VITE_RCC_SRCS})
endif( APPLE )
#############################################
# QT5
#############################################
IF(USE_QT5)
qt5_use_modules(vite Widgets Core Xml OpenGL UiTools)
ENDIF(USE_QT5)
TARGET_LINK_LIBRARIES(vite
${QT_LIBRARIES}
${GLU_LIBRARY}
......
......@@ -1028,7 +1028,11 @@ void Interface_graphic::on_show_all_trace_triggered(){
_core->launch_action(Core::_STATE_RENDER_AREA_REGISTERED_TRANSLATE, &id);
}
void Interface_graphic::on_zoom_box_textChanged(QString s){
#if QT_VERSION < 0x050000
void Interface_graphic::on_zoom_box_textChanged(const QString &s){
#else
void Interface_graphic::on_zoom_box_currentTextChanged(const QString &s){
#endif
QRegExp reg_exp_number("^(\\d+)");
QString result;
Element_pos d;
......
......@@ -685,7 +685,11 @@ protected slots:
*
* \param s The new string value of the zoom box.
*/
void on_zoom_box_textChanged(QString s);
#if QT_VERSION < 0x050000
void on_zoom_box_textChanged(const QString &s);
#else
void on_zoom_box_currentTextChanged(const QString &s);
#endif
/*!
* \brief Change the x position of camera view for state drawing area.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment