diff --git a/GraphicsView/demo/Alpha_shapes_2/Alpha_shapes_2.cpp b/GraphicsView/demo/Alpha_shapes_2/Alpha_shapes_2.cpp index 48e54076fea..41567988d01 100644 --- a/GraphicsView/demo/Alpha_shapes_2/Alpha_shapes_2.cpp +++ b/GraphicsView/demo/Alpha_shapes_2/Alpha_shapes_2.cpp @@ -211,6 +211,18 @@ MainWindow::on_actionInsertRandomPoints_triggered() Iso_rectangle_2 isor = convert(rect); CGAL::Random_points_in_iso_rectangle_2 pg((isor.min)(), (isor.max)()); bool ok = false; + + #if QT_VERSION >= 0x050000 + const int number_of_points = + QInputDialog::getInt(this, + tr("Number of random points"), + tr("Enter number of random points"), + 100, + 0, + (std::numeric_limits::max)(), + 1, + &ok); + #else const int number_of_points = QInputDialog::getInteger(this, tr("Number of random points"), @@ -220,6 +232,8 @@ MainWindow::on_actionInsertRandomPoints_triggered() (std::numeric_limits::max)(), 1, &ok); + #endif + if(!ok) { return; @@ -299,9 +313,9 @@ int main(int argc, char **argv) app.setOrganizationName("GeometryFactory"); app.setApplicationName("Alpha_shape_2 demo"); - // Import resources from libCGALQt4. + // Import resources from libCGAL (Qt4 or Qt5). // See http://doc.trolltech.com/4.4/qdir.html#Q_INIT_RESOURCE - CGAL_QT4_INIT_RESOURCES; + CGAL_QT_INIT_RESOURCES;//New for Qt5 version ! MainWindow mainWindow; mainWindow.show(); diff --git a/GraphicsView/demo/Alpha_shapes_2/CMakeLists.txt b/GraphicsView/demo/Alpha_shapes_2/CMakeLists.txt index 8feda27552a..06d6109ac0a 100644 --- a/GraphicsView/demo/Alpha_shapes_2/CMakeLists.txt +++ b/GraphicsView/demo/Alpha_shapes_2/CMakeLists.txt @@ -10,35 +10,59 @@ else() cmake_policy(VERSION 2.6) endif() -find_package(CGAL COMPONENTS Qt4) - -include(${CGAL_USE_FILE}) set( QT_USE_QTXML TRUE ) set( QT_USE_QTMAIN TRUE ) set( QT_USE_QTSCRIPT TRUE ) set( QT_USE_QTOPENGL TRUE ) +#New for Qt5 version ! +option (USE_QT5 "Use Qt5 version instead of Qt4" ON) + +if(USE_QT5) + + find_package(CGAL COMPONENTS Qt5) + + include(${CGAL_USE_FILE}) + + find_package(Qt5) + + set(CMAKE_AUTOMOC OFF) + +else (USE_QT5) + + find_package(CGAL COMPONENTS Qt4) + + include(${CGAL_USE_FILE}) + + find_package(Qt4) + + if(CGAL_Qt4_FOUND AND QT4_FOUND) + include(${QT_USE_FILE}) + message("Qt4 found") + set(QT4 TRUE) + endif() + +endif (USE_QT5) + +include(QtChoice) -find_package(Qt4) include_directories (BEFORE ../../include) include_directories (BEFORE ./include) -if ( CGAL_FOUND AND CGAL_Qt4_FOUND AND QT4_FOUND ) - -include(${QT_USE_FILE}) +if ( CGAL_FOUND AND (QT4 OR QT5) ) #-------------------------------- # The "Delaunay" demo: Alpha_shapes_2 #-------------------------------- # UI files (Qt Designer files) -qt4_wrap_ui( DT_UI_FILES Alpha_shapes_2.ui ) +qt_wrap_ui( DT_UI_FILES Alpha_shapes_2.ui ) # qrc files (resources files, that contain icons, at least) -qt4_add_resources ( DT_RESOURCE_FILES ./Alpha_shapes_2.qrc ) +qt_add_resources ( DT_RESOURCE_FILES ./Alpha_shapes_2.qrc ) # use the Qt MOC preprocessor on classes that derives from QObject -qt4_generate_moc( Alpha_shapes_2.cpp Alpha_shapes_2.moc ) +qt_generate_moc( Alpha_shapes_2.cpp Alpha_shapes_2.moc ) # The executable itself. add_executable ( Alpha_shapes_2 Alpha_shapes_2.cpp Alpha_shapes_2.moc ${DT_UI_FILES} ${DT_RESOURCE_FILES} ) diff --git a/GraphicsView/demo/Bounding_volumes/Bounding_volumes.cpp b/GraphicsView/demo/Bounding_volumes/Bounding_volumes.cpp index 30739b66ed2..0cb6896fe03 100644 --- a/GraphicsView/demo/Bounding_volumes/Bounding_volumes.cpp +++ b/GraphicsView/demo/Bounding_volumes/Bounding_volumes.cpp @@ -435,6 +435,18 @@ MainWindow::on_actionInsertRandomPoints_triggered() Iso_rectangle_2 isor = convert(rect); CGAL::Random_points_in_iso_rectangle_2 pg((isor.min)(), (isor.max)()); bool ok = false; + + #if QT_VERSION >= 0x050000 + const int number_of_points = + QInputDialog::getInt(this, + tr("Number of random points"), + tr("Enter number of random points"), + 100, + 0, + (std::numeric_limits::max)(), + 1, + &ok); + #else const int number_of_points = QInputDialog::getInteger(this, tr("Number of random points"), @@ -444,6 +456,8 @@ MainWindow::on_actionInsertRandomPoints_triggered() (std::numeric_limits::max)(), 1, &ok); + #endif + if(!ok) { return; @@ -539,9 +553,9 @@ int main(int argc, char **argv) app.setOrganizationName("GeometryFactory"); app.setApplicationName("Bounding_volumes demo"); - // Import resources from libCGALQt4. + // Import resources from libCGAL (Qt4 or Qt5). // See http://doc.trolltech.com/4.4/qdir.html#Q_INIT_RESOURCE - CGAL_QT4_INIT_RESOURCES; + CGAL_QT_INIT_RESOURCES;//New for Qt5 version ! MainWindow mainWindow; mainWindow.show(); diff --git a/GraphicsView/demo/Bounding_volumes/CMakeLists.txt b/GraphicsView/demo/Bounding_volumes/CMakeLists.txt index 7f1e1c8e8ef..f7f3ec9ea11 100644 --- a/GraphicsView/demo/Bounding_volumes/CMakeLists.txt +++ b/GraphicsView/demo/Bounding_volumes/CMakeLists.txt @@ -10,37 +10,63 @@ else() cmake_policy(VERSION 2.6) endif() -find_package(CGAL COMPONENTS Qt4) - -include(${CGAL_USE_FILE}) - set( QT_USE_QTXML TRUE ) set( QT_USE_QTMAIN TRUE ) set( QT_USE_QTSCRIPT TRUE ) set( QT_USE_QTOPENGL TRUE ) -find_package(Qt4) +#New for Qt5 version ! +option (USE_QT5 "Use Qt5 version instead of Qt4" ON) + +if(USE_QT5) + + find_package(CGAL COMPONENTS Qt5) + + include(${CGAL_USE_FILE}) + + find_package(Qt5) + + set(CMAKE_AUTOMOC OFF) + +else (USE_QT5) + + find_package(CGAL COMPONENTS Qt4) + + include(${CGAL_USE_FILE}) + + find_package(Qt4) + + if(CGAL_Qt4_FOUND AND QT4_FOUND) + include(${QT_USE_FILE}) + message("Qt4 found") + set(QT4 TRUE) + endif() + +endif (USE_QT5) + +include(QtChoice) + + include_directories (BEFORE ../../include) include_directories (BEFORE ./include) include_directories (BEFORE ../../../Matrix_search/include) -if ( CGAL_FOUND AND CGAL_Qt4_FOUND AND QT4_FOUND ) +if ( CGAL_FOUND AND (QT4 OR QT5) ) -include(${QT_USE_FILE}) #---------------------------------------------- # The "Bounding volumes" demo: Bounding_volumes #---------------------------------------------- # UI files (Qt Designer files) -qt4_wrap_ui( DT_UI_FILES Bounding_volumes.ui ) +qt_wrap_ui( DT_UI_FILES Bounding_volumes.ui ) # qrc files (resources files, that contain icons, at least) -qt4_add_resources ( DT_RESOURCE_FILES ./Bounding_volumes.qrc ) +qt_add_resources ( DT_RESOURCE_FILES ./Bounding_volumes.qrc ) # use the Qt MOC preprocessor on classes that derives from QObject -qt4_generate_moc( "Bounding_volumes.cpp" "${CMAKE_CURRENT_BINARY_DIR}/Bounding_volumes.moc" ) +qt_generate_moc( "Bounding_volumes.cpp" "${CMAKE_CURRENT_BINARY_DIR}/Bounding_volumes.moc" ) # The executable itself. add_executable ( Bounding_volumes Bounding_volumes.cpp Bounding_volumes.moc ${DT_UI_FILES} ${DT_RESOURCE_FILES} ) diff --git a/GraphicsView/demo/Circular_kernel_2/CMakeLists.txt b/GraphicsView/demo/Circular_kernel_2/CMakeLists.txt index 56b239ccf39..64bfa97b20f 100644 --- a/GraphicsView/demo/Circular_kernel_2/CMakeLists.txt +++ b/GraphicsView/demo/Circular_kernel_2/CMakeLists.txt @@ -10,35 +10,58 @@ else() cmake_policy(VERSION 2.6) endif() -find_package(CGAL COMPONENTS Qt4) - -include(${CGAL_USE_FILE}) - set( QT_USE_QTXML TRUE ) set( QT_USE_QTMAIN TRUE ) set( QT_USE_QTSCRIPT TRUE ) set( QT_USE_QTOPENGL TRUE ) +#New for Qt5 version ! +option (USE_QT5 "Use Qt5 version instead of Qt4" ON) + +if(USE_QT5) + + find_package(CGAL COMPONENTS Qt5) + + include(${CGAL_USE_FILE}) + + find_package(Qt5) + + set(CMAKE_AUTOMOC OFF) + +else (USE_QT5) + + find_package(CGAL COMPONENTS Qt4) + + include(${CGAL_USE_FILE}) + + find_package(Qt4) + + if(CGAL_Qt4_FOUND AND QT4_FOUND) + include(${QT_USE_FILE}) + message("Qt4 found") + set(QT4 TRUE) + endif() + +endif (USE_QT5) + +include(QtChoice) -find_package(Qt4) include_directories (BEFORE ../../include) -if ( CGAL_FOUND AND CGAL_Qt4_FOUND AND QT4_FOUND ) - - include(${QT_USE_FILE}) +if ( CGAL_FOUND AND (QT4 OR QT5) ) #-------------------------------- # The demo: Circular_kernel_2 #-------------------------------- # UI files (Qt Designer files) - qt4_wrap_ui( DT_UI_FILES Circular_kernel_2.ui ) + qt_wrap_ui( DT_UI_FILES Circular_kernel_2.ui ) # qrc files (resources files, that contain icons, at least) - qt4_add_resources ( DT_RESOURCE_FILES ./Circular_kernel_2.qrc ) + qt_add_resources ( DT_RESOURCE_FILES ./Circular_kernel_2.qrc ) # use the Qt MOC preprocessor on classes that derives from QObject - qt4_generate_moc( "Circular_kernel_2.cpp" "${CMAKE_CURRENT_BINARY_DIR}/Circular_kernel_2.moc" ) + qt_generate_moc( "Circular_kernel_2.cpp" "${CMAKE_CURRENT_BINARY_DIR}/Circular_kernel_2.moc" ) # The executable itself. add_executable ( Circular_kernel_2 Circular_kernel_2.cpp Circular_kernel_2.moc ${DT_UI_FILES} ${DT_RESOURCE_FILES} ) diff --git a/GraphicsView/demo/Circular_kernel_2/Circular_kernel_2.cpp b/GraphicsView/demo/Circular_kernel_2/Circular_kernel_2.cpp index 868506d7ae0..ed35b4f5e0a 100644 --- a/GraphicsView/demo/Circular_kernel_2/Circular_kernel_2.cpp +++ b/GraphicsView/demo/Circular_kernel_2/Circular_kernel_2.cpp @@ -287,9 +287,9 @@ int main(int argc, char **argv) app.setOrganizationName("GeometryFactory"); app.setApplicationName("Circular_kernel_2 demo"); - // Import resources from libCGALQt4. + // Import resources from libCGAL (Qt4 or Qt5). // See http://doc.trolltech.com/4.4/qdir.html#Q_INIT_RESOURCE - CGAL_QT4_INIT_RESOURCES; + CGAL_QT_INIT_RESOURCES;//New for Qt5 version ! MainWindow mainWindow; mainWindow.show(); diff --git a/GraphicsView/demo/Generator/CMakeLists.txt b/GraphicsView/demo/Generator/CMakeLists.txt index 45cbeffad45..c31ec50ff22 100644 --- a/GraphicsView/demo/Generator/CMakeLists.txt +++ b/GraphicsView/demo/Generator/CMakeLists.txt @@ -10,33 +10,59 @@ else() cmake_policy(VERSION 2.6) endif() -find_package(CGAL COMPONENTS Qt4) - -include(${CGAL_USE_FILE}) set( QT_USE_QTXML TRUE ) set( QT_USE_QTMAIN TRUE ) set( QT_USE_QTSCRIPT TRUE ) set( QT_USE_QTOPENGL TRUE ) -find_package(Qt4) +#New for Qt5 version ! +option (USE_QT5 "Use Qt5 version instead of Qt4" ON) + +if(USE_QT5) + + find_package(CGAL COMPONENTS Qt5) + + include(${CGAL_USE_FILE}) + + find_package(Qt5) + + set(CMAKE_AUTOMOC OFF) + +else (USE_QT5) + + find_package(CGAL COMPONENTS Qt4) + + include(${CGAL_USE_FILE}) + + find_package(Qt4) + + if(CGAL_Qt4_FOUND AND QT4_FOUND) + include(${QT_USE_FILE}) + message("Qt4 found") + set(QT4 TRUE) + endif() + +endif (USE_QT5) + +include(QtChoice) + include_directories (BEFORE ../../include) -if ( CGAL_FOUND AND CGAL_Qt4_FOUND AND QT4_FOUND ) +if ( CGAL_FOUND AND (QT4 OR QT5) ) - include(${QT_USE_FILE}) #-------------------------------- # Demo: Generator_2 #-------------------------------- # UI files (Qt Designer files) - qt4_wrap_ui( DT_UI_FILES Generator_2.ui ) + qt_wrap_ui( DT_UI_FILES Generator_2.ui ) # qrc files (resources files, that contain icons, at least) - qt4_add_resources ( DT_RESOURCE_FILES ./Generator_2.qrc ) + qt_add_resources ( DT_RESOURCE_FILES ./Generator_2.qrc ) # use the Qt MOC preprocessor on classes that derives from QObject - qt4_generate_moc( "Generator_2.cpp" "${CMAKE_CURRENT_BINARY_DIR}/Generator_2.moc" ) + qt_generate_moc( "Generator_2.cpp" "${CMAKE_CURRENT_BINARY_DIR}/Generator_2.moc" ) # The executable itself. add_executable ( Generator_2 Generator_2.cpp Generator_2.moc ${DT_UI_FILES} ${DT_RESOURCE_FILES} ) diff --git a/GraphicsView/demo/Generator/Generator_2.cpp b/GraphicsView/demo/Generator/Generator_2.cpp index fcf941adee6..c1a42c1c5f4 100644 --- a/GraphicsView/demo/Generator/Generator_2.cpp +++ b/GraphicsView/demo/Generator/Generator_2.cpp @@ -9,6 +9,7 @@ // Qt headers #include #include +#include #include #include @@ -61,6 +62,18 @@ private: G pg(radius); bool ok = false; + + #if QT_VERSION >= 0x050000 + const int number_of_points = + QInputDialog::getInt(this, + tr("Number of random points"), + tr("Enter number of random points"), + 100, + 0, + (std::numeric_limits::max)(), + 1, + &ok); + #else const int number_of_points = QInputDialog::getInteger(this, tr("Number of random points"), @@ -70,6 +83,8 @@ private: (std::numeric_limits::max)(), 1, &ok); + #endif + if(!ok) { return; @@ -281,9 +296,9 @@ int main(int argc, char **argv) app.setOrganizationName("GeometryFactory"); app.setApplicationName("Generator_2 demo"); - // Import resources from libCGALQt4. + // Import resources from libCGAL (Qt4 or Qt5). // See http://doc.trolltech.com/4.4/qdir.html#Q_INIT_RESOURCE - CGAL_QT4_INIT_RESOURCES; + CGAL_QT_INIT_RESOURCES;//New for QT5 version ! Q_INIT_RESOURCE(Generator_2); MainWindow mainWindow; diff --git a/GraphicsView/demo/GraphicsView/CMakeLists.txt b/GraphicsView/demo/GraphicsView/CMakeLists.txt index 07a20b1e2c3..9633154ab7b 100644 --- a/GraphicsView/demo/GraphicsView/CMakeLists.txt +++ b/GraphicsView/demo/GraphicsView/CMakeLists.txt @@ -9,22 +9,43 @@ else() cmake_policy(VERSION 2.6) endif() -find_package(CGAL COMPONENTS Qt4) - -include(${CGAL_USE_FILE}) - - set( QT_USE_QTXML TRUE ) set( QT_USE_QTMAIN TRUE ) set( QT_USE_QTSCRIPT TRUE ) set( QT_USE_QTOPENGL TRUE ) -find_package(Qt4) +#New for Qt5 version ! +option (USE_QT5 "Use Qt5 version instead of Qt4" ON) -if ( CGAL_FOUND AND CGAL_Qt4_FOUND AND QT4_FOUND ) +if(USE_QT5) - include(${QT_USE_FILE}) + find_package(CGAL COMPONENTS Qt5) + include(${CGAL_USE_FILE}) + + find_package(Qt5) + + set(CMAKE_AUTOMOC OFF) + +else (USE_QT5) + + find_package(CGAL COMPONENTS Qt4) + + include(${CGAL_USE_FILE}) + + find_package(Qt4) + + if(CGAL_Qt4_FOUND AND QT4_FOUND) + include(${QT_USE_FILE}) + message("Qt4 found") + set(QT4 TRUE) + endif() + +endif (USE_QT5) + +#include(QtChoice) not necessary here. + +if ( CGAL_FOUND AND (QT4 OR QT5) ) add_executable ( min min.cpp ) diff --git a/GraphicsView/demo/GraphicsView/min.cpp b/GraphicsView/demo/GraphicsView/min.cpp index 67e8663355a..3fc8b95832a 100644 --- a/GraphicsView/demo/GraphicsView/min.cpp +++ b/GraphicsView/demo/GraphicsView/min.cpp @@ -5,6 +5,13 @@ #include #include +//New for Qt5 version ! +#if QT_VERSION >= 0x050000 +#include +#include +#include +#endif + int main(int argc, char **argv) { QApplication app(argc, argv); diff --git a/GraphicsView/demo/L1_Voronoi_diagram_2/CMakeLists.txt b/GraphicsView/demo/L1_Voronoi_diagram_2/CMakeLists.txt index 0b7cb87affd..43067e4c960 100644 --- a/GraphicsView/demo/L1_Voronoi_diagram_2/CMakeLists.txt +++ b/GraphicsView/demo/L1_Voronoi_diagram_2/CMakeLists.txt @@ -10,36 +10,60 @@ else() cmake_policy(VERSION 2.6) endif() -find_package(CGAL COMPONENTS Qt4) - -include(${CGAL_USE_FILE}) set( QT_USE_QTXML TRUE ) set( QT_USE_QTMAIN TRUE ) set( QT_USE_QTSCRIPT TRUE ) set( QT_USE_QTOPENGL TRUE ) +#New for Qt5 version ! +option (USE_QT5 "Use Qt5 version instead of Qt4" ON) + +if(USE_QT5) + + find_package(CGAL COMPONENTS Qt5) + + include(${CGAL_USE_FILE}) + + find_package(Qt5) + + set(CMAKE_AUTOMOC OFF) + +else (USE_QT5) + + find_package(CGAL COMPONENTS Qt4) + + include(${CGAL_USE_FILE}) + + find_package(Qt4) + + if(CGAL_Qt4_FOUND AND QT4_FOUND) + include(${QT_USE_FILE}) + message("Qt4 found") + set(QT4 TRUE) + endif() + +endif (USE_QT5) + +include(QtChoice) -find_package(Qt4) include_directories (BEFORE ../../include) include_directories (BEFORE ./include) -if ( CGAL_FOUND AND CGAL_Qt4_FOUND AND QT4_FOUND ) - -include(${QT_USE_FILE}) +if ( QT4 OR QT5 ) #-------------------------------- # The "L1 Voronoi diagram" demo: L1_voronoi_diagram_2 #-------------------------------- # UI files (Qt Designer files) -qt4_wrap_ui( DT_UI_FILES L1_voronoi_diagram_2.ui ) +qt_wrap_ui( DT_UI_FILES L1_voronoi_diagram_2.ui ) # qrc files (resources files, that contain icons, at least) -qt4_add_resources ( DT_RESOURCE_FILES ./L1_voronoi_diagram_2.qrc ) +qt_add_resources ( DT_RESOURCE_FILES ./L1_voronoi_diagram_2.qrc ) # use the Qt MOC preprocessor on classes that derives from QObject -qt4_generate_moc( L1_voronoi_diagram_2.cpp L1_voronoi_diagram_2.moc ) +qt_generate_moc( L1_voronoi_diagram_2.cpp L1_voronoi_diagram_2.moc ) # The executable itself. add_executable ( L1_voronoi_diagram_2 L1_voronoi_diagram_2.cpp L1_voronoi_diagram_2.moc ${DT_UI_FILES} ${DT_RESOURCE_FILES} ) diff --git a/GraphicsView/demo/L1_Voronoi_diagram_2/L1_voronoi_diagram_2.cpp b/GraphicsView/demo/L1_Voronoi_diagram_2/L1_voronoi_diagram_2.cpp index 4d02c1886b5..4b2f17bbd3c 100644 --- a/GraphicsView/demo/L1_Voronoi_diagram_2/L1_voronoi_diagram_2.cpp +++ b/GraphicsView/demo/L1_Voronoi_diagram_2/L1_voronoi_diagram_2.cpp @@ -245,6 +245,18 @@ MainWindow::on_actionInsertRandomPoints_triggered() Iso_rectangle_2 isor = convert(rect); CGAL::Random_points_in_iso_rectangle_2 pg((isor.min)(), (isor.max)()); bool ok = false; + + #if QT_VERSION >= 0x050000 + const int number_of_points = + QInputDialog::getInt(this, + tr("Number of random points"), + tr("Enter number of random points"), + 100, + 0, + (std::numeric_limits::max)(), + 1, + &ok); + #else const int number_of_points = QInputDialog::getInteger(this, tr("Number of random points"), @@ -254,6 +266,8 @@ MainWindow::on_actionInsertRandomPoints_triggered() (std::numeric_limits::max)(), 1, &ok); + #endif + if(!ok) { return; @@ -385,9 +399,10 @@ int main(int argc, char **argv) app.setOrganizationName("GeometryFactory"); app.setApplicationName("L1 Voronoi diagram_2 demo"); - // Import resources from libCGALQt4. + // Import resources from libCGAL (Qt4 or Qt5). // See http://doc.trolltech.com/4.4/qdir.html#Q_INIT_RESOURCE - CGAL_QT4_INIT_RESOURCES; + CGAL_QT_INIT_RESOURCES;//New for Qt5 version ! + MainWindow mainWindow; mainWindow.show(); return app.exec(); diff --git a/GraphicsView/demo/Largest_empty_rect_2/CMakeLists.txt b/GraphicsView/demo/Largest_empty_rect_2/CMakeLists.txt index 3f184a3f492..338d9fe9545 100644 --- a/GraphicsView/demo/Largest_empty_rect_2/CMakeLists.txt +++ b/GraphicsView/demo/Largest_empty_rect_2/CMakeLists.txt @@ -10,33 +10,58 @@ else() cmake_policy(VERSION 2.6) endif() -find_package(CGAL COMPONENTS Qt4) - -include(${CGAL_USE_FILE}) - set( QT_USE_QTXML TRUE ) set( QT_USE_QTMAIN TRUE ) set( QT_USE_QTSCRIPT TRUE ) set( QT_USE_QTOPENGL TRUE ) -find_package(Qt4) +#New for Qt5 version ! +option (USE_QT5 "Use Qt5 version instead of Qt4" ON) + +if(USE_QT5) + + find_package(CGAL COMPONENTS Qt5) + + include(${CGAL_USE_FILE}) + + find_package(Qt5) + + set(CMAKE_AUTOMOC OFF) + +else (USE_QT5) + + find_package(CGAL COMPONENTS Qt4) + + include(${CGAL_USE_FILE}) + + find_package(Qt4) + + if(CGAL_Qt4_FOUND AND QT4_FOUND) + include(${QT_USE_FILE}) + message("Qt4 found") + set(QT4 TRUE) + endif() + +endif (USE_QT5) + +include(QtChoice) + include_directories (BEFORE ../../include) -if ( CGAL_FOUND AND CGAL_Qt4_FOUND AND QT4_FOUND ) +if ( QT4 OR QT5 ) - include(${QT_USE_FILE}) #-------------------------------- # Demo: Largest_empty_rectangle_2 #-------------------------------- # UI files (Qt Designer files) - qt4_wrap_ui( DT_UI_FILES Largest_empty_rectangle_2.ui ) + qt_wrap_ui( DT_UI_FILES Largest_empty_rectangle_2.ui ) # qrc files (resources files, that contain icons, at least) - qt4_add_resources ( DT_RESOURCE_FILES ./Largest_empty_rectangle_2.qrc ) + qt_add_resources ( DT_RESOURCE_FILES ./Largest_empty_rectangle_2.qrc ) # use the Qt MOC preprocessor on classes that derives from QObject - qt4_generate_moc( Largest_empty_rectangle_2.cpp Largest_empty_rectangle_2.moc ) + qt_generate_moc( Largest_empty_rectangle_2.cpp Largest_empty_rectangle_2.moc ) # The executable itself. add_executable ( Largest_empty_rectangle_2 Largest_empty_rectangle_2.cpp Largest_empty_rectangle_2.moc ${DT_UI_FILES} ${DT_RESOURCE_FILES} ) diff --git a/GraphicsView/demo/Largest_empty_rect_2/Largest_empty_rectangle_2.cpp b/GraphicsView/demo/Largest_empty_rect_2/Largest_empty_rectangle_2.cpp index 5920a4e8d93..eb908a3059a 100644 --- a/GraphicsView/demo/Largest_empty_rect_2/Largest_empty_rectangle_2.cpp +++ b/GraphicsView/demo/Largest_empty_rect_2/Largest_empty_rectangle_2.cpp @@ -8,6 +8,7 @@ #include #include #include +#include #include #include @@ -60,6 +61,18 @@ private: G pg(radius); bool ok = false; + + #if QT_VERSION >= 0x050000 + const int number_of_points = + QInputDialog::getInt(this, + tr("Number of random points"), + tr("Enter number of random points"), + 100, + 0, + (std::numeric_limits::max)(), + 1, + &ok); + #else const int number_of_points = QInputDialog::getInteger(this, tr("Number of random points"), @@ -69,6 +82,8 @@ private: (std::numeric_limits::max)(), 1, &ok); + #endif + if(!ok) { return; @@ -275,9 +290,9 @@ int main(int argc, char **argv) app.setOrganizationName("GeometryFactory"); app.setApplicationName("Largest_empty_rectangle_2 demo"); - // Import resources from libCGALQt4. + // Import resources from libCGAL (Qt4 or Qt5). // See http://doc.trolltech.com/4.4/qdir.html#Q_INIT_RESOURCE - CGAL_QT4_INIT_RESOURCES; + CGAL_QT_INIT_RESOURCES;//New for Qt5 version ! Q_INIT_RESOURCE(Largest_empty_rectangle_2); MainWindow mainWindow; diff --git a/GraphicsView/demo/Periodic_2_triangulation_2/CMakeLists.txt b/GraphicsView/demo/Periodic_2_triangulation_2/CMakeLists.txt index 1552a30fb75..65cc6bfaedc 100644 --- a/GraphicsView/demo/Periodic_2_triangulation_2/CMakeLists.txt +++ b/GraphicsView/demo/Periodic_2_triangulation_2/CMakeLists.txt @@ -8,9 +8,6 @@ if ( COMMAND cmake_policy ) cmake_policy( SET CMP0003 NEW ) endif() -find_package(CGAL COMPONENTS Qt4 REQUIRED) - -include(${CGAL_USE_FILE}) set( QT_USE_QTXML TRUE ) set( QT_USE_QTMAIN TRUE ) @@ -18,25 +15,53 @@ set( QT_USE_QTSCRIPT TRUE ) set( QT_USE_QTOPENGL TRUE ) -find_package(Qt4) +#New for Qt5 version ! +option (USE_QT5 "Use Qt5 version instead of Qt4" ON) + +if(USE_QT5) + + find_package(CGAL COMPONENTS Qt5 REQUIRED) + + include(${CGAL_USE_FILE}) + + find_package(Qt5) + + set(CMAKE_AUTOMOC OFF) + +else (USE_QT5) + + find_package(CGAL COMPONENTS Qt4 REQUIRED) + + include(${CGAL_USE_FILE}) + + find_package(Qt4) + + if(CGAL_Qt4_FOUND AND QT4_FOUND) + include(${QT_USE_FILE}) + message("Qt4 found") + set(QT4 TRUE) + endif() + +endif (USE_QT5) + +include(QtChoice) + + include_directories (BEFORE ../../../include) include_directories (BEFORE ./include) -if ( CGAL_FOUND AND CGAL_Qt4_FOUND AND QT4_FOUND ) - -include(${QT_USE_FILE}) - +if ( QT4 OR QT5 ) #-------------------------------- # The "2D Periodic triangulation" demo: Periodic_2_triangulation_2 #-------------------------------- # UI files (Qt Designer files) -qt4_wrap_ui( DT_UI_FILES Periodic_2_triangulation_2.ui ) +qt_wrap_ui( DT_UI_FILES Periodic_2_triangulation_2.ui ) # qrc files (resources files, that contain icons, at least) -qt4_add_resources ( DT_RESOURCE_FILES ./Periodic_2_triangulation_2.qrc ) +qt_add_resources ( DT_RESOURCE_FILES ./Periodic_2_triangulation_2.qrc ) # use the Qt MOC preprocessor on classes that derives from QObject -qt4_generate_moc( Periodic_2_Delaunay_triangulation_2.cpp Periodic_2_triangulation_2.moc ) +qt_generate_moc( Periodic_2_Delaunay_triangulation_2.cpp Periodic_2_triangulation_2.moc ) # find header files for projects that can show them file(GLOB headers "*.h") @@ -60,6 +85,6 @@ target_link_libraries( Periodic_2_Delaunay_triangulation_2 ${QT_LIBRARIES} ) target_link_libraries( Periodic_2_Delaunay_triangulation_2 ${CGAL_LIBRARIES} ${CGAL_3RD_PARTY_LIBRARIES}) else() - message(STATUS "NOTICE: This demo requires CGAL and Qt4, and will not be compiled.") + message(STATUS "NOTICE: This demo requires CGAL and Qt4 or Qt5, and will not be compiled.") endif() diff --git a/GraphicsView/demo/Periodic_2_triangulation_2/Periodic_2_Delaunay_triangulation_2.cpp b/GraphicsView/demo/Periodic_2_triangulation_2/Periodic_2_Delaunay_triangulation_2.cpp index 81eeac6b3e1..120494ec954 100644 --- a/GraphicsView/demo/Periodic_2_triangulation_2/Periodic_2_Delaunay_triangulation_2.cpp +++ b/GraphicsView/demo/Periodic_2_triangulation_2/Periodic_2_Delaunay_triangulation_2.cpp @@ -294,6 +294,18 @@ MainWindow::on_actionInsertRandomPoints_triggered() CGAL::Random_points_in_iso_rectangle_2 pg((triang.domain().min)(), (triang.domain().max)()); bool ok = false; + + #if QT_VERSION >= 0x050000 + const int number_of_points = + QInputDialog::getInt(this, + tr("Number of random points"), + tr("Enter number of random points"), + 250, + 0, + (std::numeric_limits::max)(), + 1, + &ok); + #else const int number_of_points = QInputDialog::getInteger(this, tr("Number of random points"), @@ -303,6 +315,7 @@ MainWindow::on_actionInsertRandomPoints_triggered() (std::numeric_limits::max)(), 1, &ok); + #endif if(!ok) { return; @@ -442,9 +455,9 @@ int main(int argc, char **argv) app.setOrganizationName("Nico Kruithof"); app.setApplicationName("Periodic_2_Delaunay_triangulation_2 demo"); - // Import resources from libCGALQt4. + // Import resources from libCGAL (Qt4 or Qt5). // See http://doc.trolltech.com/4.4/qdir.html#Q_INIT_RESOURCE - CGAL_QT4_INIT_RESOURCES; + CGAL_QT_INIT_RESOURCES;//New for Qt5 version ! MainWindow mainWindow; mainWindow.show(); diff --git a/GraphicsView/demo/Polygon/CMakeLists.txt b/GraphicsView/demo/Polygon/CMakeLists.txt index 60e6d1af7fb..c4e4c232cf5 100644 --- a/GraphicsView/demo/Polygon/CMakeLists.txt +++ b/GraphicsView/demo/Polygon/CMakeLists.txt @@ -10,37 +10,62 @@ else() cmake_policy(VERSION 2.6) endif() -find_package(CGAL COMPONENTS Qt4 Core GMP MPFR) - -include(${CGAL_USE_FILE}) set( QT_USE_QTXML TRUE ) set( QT_USE_QTMAIN TRUE ) set( QT_USE_QTSCRIPT TRUE ) set( QT_USE_QTOPENGL TRUE ) -#find_package(Qt4) +#New for Qt5 version ! +option (USE_QT5 "Use Qt5 version instead of Qt4" ON) + +if(USE_QT5) + + find_package(CGAL COMPONENTS Qt5 Core GMP MPFR) + + include(${CGAL_USE_FILE}) + + find_package(Qt5) + + set(CMAKE_AUTOMOC OFF) + +else (USE_QT5) + + find_package(CGAL COMPONENTS Qt4 Core GMP MPFR) + + include(${CGAL_USE_FILE}) + + find_package(Qt4) + + if(CGAL_Qt4_FOUND AND QT4_FOUND) + include(${QT_USE_FILE}) + message("Qt4 found") + set(QT4 TRUE) + endif() + +endif (USE_QT5) + +include(QtChoice) include_directories (BEFORE ../../include) -if ( CGAL_FOUND AND CGAL_Qt4_FOUND AND QT4_FOUND ) +if ( CGAL_FOUND AND (Qt4 OR QT5) ) if( CGAL_Core_FOUND) add_definitions(-DCGAL_USE_CORE) endif() - include(${QT_USE_FILE}) #-------------------------------- # Demo: Polygon_2 #-------------------------------- # UI files (Qt Designer files) - qt4_wrap_ui( DT_UI_FILES Polygon_2.ui ) + qt_wrap_ui( DT_UI_FILES Polygon_2.ui ) # qrc files (resources files, that contain icons, at least) - qt4_add_resources ( DT_RESOURCE_FILES ./Polygon_2.qrc ) + qt_add_resources ( DT_RESOURCE_FILES ./Polygon_2.qrc ) # use the Qt MOC preprocessor on classes that derives from QObject - qt4_generate_moc( Polygon_2.cpp "${CMAKE_CURRENT_BINARY_DIR}/Polygon_2.moc" ) + qt_generate_moc( Polygon_2.cpp "${CMAKE_CURRENT_BINARY_DIR}/Polygon_2.moc" ) # add_library( CGAL SHARED IMPORTED ) # SET_PROPERTY(TARGET CGAL PROPERTY IMPORTED_LOCATION ${CGAL_LIBRARY} ) diff --git a/GraphicsView/demo/Polygon/Polygon_2.cpp b/GraphicsView/demo/Polygon/Polygon_2.cpp index 5ea49cde7bf..ff4fee423a5 100644 --- a/GraphicsView/demo/Polygon/Polygon_2.cpp +++ b/GraphicsView/demo/Polygon/Polygon_2.cpp @@ -16,6 +16,7 @@ #include #include #include +#include #include // GraphicsView items and event filters (input classes) @@ -570,9 +571,9 @@ int main(int argc, char **argv) app.setOrganizationName("GeometryFactory"); app.setApplicationName("Polygon_2 demo"); - // Import resources from libCGALQt4. + // Import resources from libCGAL (Qt4 or Qt5). // See http://doc.trolltech.com/4.4/qdir.html#Q_INIT_RESOURCE - CGAL_QT4_INIT_RESOURCES; + CGAL_QT_INIT_RESOURCES; Q_INIT_RESOURCE(Polygon_2); MainWindow mainWindow; diff --git a/GraphicsView/demo/Segment_Delaunay_graph_2/CMakeLists.txt b/GraphicsView/demo/Segment_Delaunay_graph_2/CMakeLists.txt index cccbe9abe90..eb29f15961e 100644 --- a/GraphicsView/demo/Segment_Delaunay_graph_2/CMakeLists.txt +++ b/GraphicsView/demo/Segment_Delaunay_graph_2/CMakeLists.txt @@ -10,36 +10,59 @@ else() cmake_policy(VERSION 2.6) endif() -find_package(CGAL COMPONENTS Qt4 Core) - -include(${CGAL_USE_FILE}) - set( QT_USE_QTXML TRUE ) set( QT_USE_QTMAIN TRUE ) set( QT_USE_QTSCRIPT TRUE ) set( QT_USE_QTOPENGL TRUE ) +#New for Qt5 version ! +option (USE_QT5 "Use Qt5 version instead of Qt4" ON) + +if(USE_QT5) + + find_package(CGAL COMPONENTS Qt5 Core) + + include(${CGAL_USE_FILE}) + + find_package(Qt5) + + set(CMAKE_AUTOMOC OFF) + +else (USE_QT5) + + find_package(CGAL COMPONENTS Qt4 Core) + + include(${CGAL_USE_FILE}) + + find_package(Qt4) + + if(CGAL_Qt4_FOUND AND QT4_FOUND) + include(${QT_USE_FILE}) + message("Qt4 found") + set(QT4 TRUE) + endif() + +endif (USE_QT5) + +include(QtChoice) -find_package(Qt4) include_directories (BEFORE ../../include) include_directories (BEFORE ./include) -if ( CGAL_FOUND AND CGAL_Qt4_FOUND AND QT4_FOUND ) - -include(${QT_USE_FILE}) +if ( CGAL_FOUND AND (QT4 OR QT5) ) #-------------------------------- # The "Segment Voronoi" demo: Segment_voronoi_2 #-------------------------------- # UI files (Qt Designer files) -qt4_wrap_ui( CDT_UI_FILES Segment_voronoi_2.ui ) +qt_wrap_ui( CDT_UI_FILES Segment_voronoi_2.ui ) # qrc files (resources files, that contain icons, at least) -qt4_add_resources ( CDT_RESOURCE_FILES ./Segment_voronoi_2.qrc ) +qt_add_resources ( CDT_RESOURCE_FILES ./Segment_voronoi_2.qrc ) # use the Qt MOC preprocessor on classes that derives from QObject -qt4_generate_moc( "Segment_voronoi_2.cpp" "${CMAKE_CURRENT_BINARY_DIR}/Segment_voronoi_2.moc" ) +qt_generate_moc( "Segment_voronoi_2.cpp" "${CMAKE_CURRENT_BINARY_DIR}/Segment_voronoi_2.moc" ) # The executable itself. add_executable ( Segment_voronoi_2 Segment_voronoi_2.cpp Segment_voronoi_2.moc ${CDT_UI_FILES} ${CDT_RESOURCE_FILES} ) diff --git a/GraphicsView/demo/Segment_Delaunay_graph_2/Segment_voronoi_2.cpp b/GraphicsView/demo/Segment_Delaunay_graph_2/Segment_voronoi_2.cpp index becb7f1db88..7b8320028de 100644 --- a/GraphicsView/demo/Segment_Delaunay_graph_2/Segment_voronoi_2.cpp +++ b/GraphicsView/demo/Segment_Delaunay_graph_2/Segment_voronoi_2.cpp @@ -18,6 +18,11 @@ #include #include +#if QT_VERSION >= 0x050000 +#include +#include +#endif + // GraphicsView items and event filters (input classes) #include #include @@ -375,9 +380,9 @@ int main(int argc, char **argv) app.setOrganizationName("GeometryFactory"); app.setApplicationName("Segment Voronoi 2 demo"); - // Import resources from libCGALQt4. + // Import resources from libCGAL (Qt4 or Qt5). // See http://doc.trolltech.com/4.4/qdir.html#Q_INIT_RESOURCE - CGAL_QT4_INIT_RESOURCES; + CGAL_QT_INIT_RESOURCES;//New for Qt5 version ! MainWindow mainWindow; mainWindow.show(); diff --git a/GraphicsView/demo/Snap_rounding_2/CMakeLists.txt b/GraphicsView/demo/Snap_rounding_2/CMakeLists.txt index 9ed559048c6..2dd34d1ec29 100644 --- a/GraphicsView/demo/Snap_rounding_2/CMakeLists.txt +++ b/GraphicsView/demo/Snap_rounding_2/CMakeLists.txt @@ -10,34 +10,58 @@ else() cmake_policy(VERSION 2.6) endif() -find_package(CGAL COMPONENTS Qt4) - -include(${CGAL_USE_FILE}) set( QT_USE_QTXML TRUE ) set( QT_USE_QTMAIN TRUE ) set( QT_USE_QTSCRIPT TRUE ) set( QT_USE_QTOPENGL TRUE ) +#New for Qt5 version ! +option (USE_QT5 "Use Qt5 version instead of Qt4" ON) + +if(USE_QT5) + + find_package(CGAL COMPONENTS Qt5) + + include(${CGAL_USE_FILE}) + + find_package(Qt5) + + set(CMAKE_AUTOMOC OFF) + +else (USE_QT5) + + find_package(CGAL COMPONENTS Qt4) + + include(${CGAL_USE_FILE}) + + find_package(Qt4) + + if(CGAL_Qt4_FOUND AND QT4_FOUND) + include(${QT_USE_FILE}) + message("Qt4 found") + set(QT4 TRUE) + endif() + +endif (USE_QT5) + +include(QtChoice) -find_package(Qt4) include_directories (BEFORE ../../include) include_directories (BEFORE ../../../Snap_rounding_2/include) -if ( CGAL_FOUND AND CGAL_Qt4_FOUND AND QT4_FOUND ) - -include(${QT_USE_FILE}) +if ( CGAL_FOUND AND (QT4 OR QT5) ) #-------------------------------- # UI files (Qt Designer files) -qt4_wrap_ui( DT_UI_FILES Snap_rounding_2.ui ) +qt_wrap_ui( DT_UI_FILES Snap_rounding_2.ui ) # qrc files (resources files, that contain icons, at least) -qt4_add_resources ( DT_RESOURCE_FILES ./Snap_rounding_2.qrc ) +qt_add_resources ( DT_RESOURCE_FILES ./Snap_rounding_2.qrc ) # use the Qt MOC preprocessor on classes that derives from QObject -qt4_generate_moc( Snap_rounding_2.cpp Snap_rounding_2.moc ) +qt_generate_moc( Snap_rounding_2.cpp Snap_rounding_2.moc ) # The executable itself. add_executable ( Snap_rounding_2 Snap_rounding_2.cpp Snap_rounding_2.moc ${DT_UI_FILES} ${DT_RESOURCE_FILES} ) diff --git a/GraphicsView/demo/Snap_rounding_2/Snap_rounding_2.cpp b/GraphicsView/demo/Snap_rounding_2/Snap_rounding_2.cpp index 587b876533c..cb712443c34 100644 --- a/GraphicsView/demo/Snap_rounding_2/Snap_rounding_2.cpp +++ b/GraphicsView/demo/Snap_rounding_2/Snap_rounding_2.cpp @@ -306,9 +306,9 @@ int main(int argc, char **argv) app.setOrganizationName("GeometryFactory"); app.setApplicationName("Snap_rounding_2 demo"); - // Import resources from libCGALQt4. + // Import resources from libCGAL (Qt4 or Qt5). // See http://doc.trolltech.com/4.4/qdir.html#Q_INIT_RESOURCE - CGAL_QT4_INIT_RESOURCES; + CGAL_QT_INIT_RESOURCES;//New for Qt5 version ! Q_INIT_RESOURCE(Snap_rounding_2); MainWindow mainWindow; diff --git a/GraphicsView/demo/Spatial_searching_2/CMakeLists.txt b/GraphicsView/demo/Spatial_searching_2/CMakeLists.txt index b7f6b51abd5..aad725c1352 100644 --- a/GraphicsView/demo/Spatial_searching_2/CMakeLists.txt +++ b/GraphicsView/demo/Spatial_searching_2/CMakeLists.txt @@ -10,34 +10,59 @@ else() cmake_policy(VERSION 2.6) endif() -find_package(CGAL COMPONENTS Qt4) - -include(${CGAL_USE_FILE}) set( QT_USE_QTXML TRUE ) set( QT_USE_QTMAIN TRUE ) set( QT_USE_QTSCRIPT TRUE ) set( QT_USE_QTOPENGL TRUE ) -find_package(Qt4) +#New for Qt5 version ! +option (USE_QT5 "Use Qt5 version instead of Qt4" ON) + +if(USE_QT5) + + find_package(CGAL COMPONENTS Qt5) + + include(${CGAL_USE_FILE}) + + find_package(Qt5) + + set(CMAKE_AUTOMOC OFF) + +else (USE_QT5) + + find_package(CGAL COMPONENTS Qt4) + + include(${CGAL_USE_FILE}) + + find_package(Qt4) + + if(CGAL_Qt4_FOUND AND QT4_FOUND) + include(${QT_USE_FILE}) + message("Qt4 found") + set(QT4 TRUE) + endif() + +endif (USE_QT5) + +include(QtChoice) include_directories (BEFORE ../../include) include_directories (BEFORE ../../../Spatial_searching/include) -if ( CGAL_FOUND AND CGAL_Qt4_FOUND AND QT4_FOUND ) +if ( CGAL_FOUND AND (QT4 OR QT5)) - include(${QT_USE_FILE}) #-------------------------------- # Demo: Spatial_searching_2 #-------------------------------- # UI files (Qt Designer files) - qt4_wrap_ui( DT_UI_FILES Spatial_searching_2.ui ) + qt_wrap_ui( DT_UI_FILES Spatial_searching_2.ui ) # qrc files (resources files, that contain icons, at least) - qt4_add_resources ( DT_RESOURCE_FILES ./Spatial_searching_2.qrc ) + qt_add_resources ( DT_RESOURCE_FILES ./Spatial_searching_2.qrc ) # use the Qt MOC preprocessor on classes that derives from QObject - qt4_generate_moc( Spatial_searching_2.cpp Spatial_searching_2.moc ) + qt_generate_moc( Spatial_searching_2.cpp Spatial_searching_2.moc ) # The executable itself. add_executable ( Spatial_searching_2 Spatial_searching_2.cpp Spatial_searching_2.moc ${DT_UI_FILES} ${DT_RESOURCE_FILES} ) diff --git a/GraphicsView/demo/Spatial_searching_2/Spatial_searching_2.cpp b/GraphicsView/demo/Spatial_searching_2/Spatial_searching_2.cpp index ce24e3fdd7f..6b18faad798 100644 --- a/GraphicsView/demo/Spatial_searching_2/Spatial_searching_2.cpp +++ b/GraphicsView/demo/Spatial_searching_2/Spatial_searching_2.cpp @@ -9,6 +9,7 @@ #include #include #include +#include #include // GraphicsView items and event filters (input classes) @@ -66,6 +67,18 @@ public: G pg(radius); bool ok = false; + + #if QT_VERSION >= 0x050000 + const int number_of_points = + QInputDialog::getInt(this, + tr("Number of random points"), + tr("Enter number of random points"), + 100, + 0, + (std::numeric_limits::max)(), + 1, + &ok); + #else const int number_of_points = QInputDialog::getInteger(this, tr("Number of random points"), @@ -75,6 +88,8 @@ public: (std::numeric_limits::max)(), 1, &ok); + #endif + if(!ok) { return; @@ -288,9 +303,9 @@ int main(int argc, char **argv) app.setOrganizationName("GeometryFactory"); app.setApplicationName("Spatial_searching_2 demo"); - // Import resources from libCGALQt4. + // Import resources from libCGAL (Qt4 or Qt5). // See http://doc.trolltech.com/4.4/qdir.html#Q_INIT_RESOURCE - CGAL_QT4_INIT_RESOURCES; + CGAL_QT_INIT_RESOURCES;//New for Qt5 version ! Q_INIT_RESOURCE(Spatial_searching_2); MainWindow mainWindow; diff --git a/GraphicsView/demo/Stream_lines_2/CMakeLists.txt b/GraphicsView/demo/Stream_lines_2/CMakeLists.txt index 12b9d931dff..11770817f13 100644 --- a/GraphicsView/demo/Stream_lines_2/CMakeLists.txt +++ b/GraphicsView/demo/Stream_lines_2/CMakeLists.txt @@ -10,33 +10,56 @@ else() cmake_policy(VERSION 2.6) endif() -find_package(CGAL COMPONENTS Qt4) - -include(${CGAL_USE_FILE}) - set( QT_USE_QTXML TRUE ) set( QT_USE_QTMAIN TRUE ) set( QT_USE_QTSCRIPT TRUE ) set( QT_USE_QTOPENGL TRUE ) +#New for Qt5 version ! +option (USE_QT5 "Use Qt5 version instead of Qt4" ON) + +if(USE_QT5) + + find_package(CGAL COMPONENTS Qt5) + + include(${CGAL_USE_FILE}) + + find_package(Qt5) + + set(CMAKE_AUTOMOC OFF) + +else (USE_QT5) + + find_package(CGAL COMPONENTS Qt4) + + include(${CGAL_USE_FILE}) + + find_package(Qt4) + + if(CGAL_Qt4_FOUND AND QT4_FOUND) + include(${QT_USE_FILE}) + message("Qt4 found") + set(QT4 TRUE) + endif() + +endif (USE_QT5) + +include(QtChoice) -find_package(Qt4) include_directories (BEFORE ../../include) -if ( CGAL_FOUND AND CGAL_Qt4_FOUND AND QT4_FOUND ) - -include(${QT_USE_FILE}) +if ( CGAL_FOUND AND (QT4 OR QT5) ) #-------------------------------- # UI files (Qt Designer files) -qt4_wrap_ui( DT_UI_FILES Stream_lines_2.ui ) +qt_wrap_ui( DT_UI_FILES Stream_lines_2.ui ) # qrc files (resources files, that contain icons, at least) -qt4_add_resources ( DT_RESOURCE_FILES ./Stream_lines_2.qrc ) +qt_add_resources ( DT_RESOURCE_FILES ./Stream_lines_2.qrc ) # use the Qt MOC preprocessor on classes that derives from QObject -qt4_generate_moc( Stream_lines_2.cpp Stream_lines_2.moc ) +qt_generate_moc( Stream_lines_2.cpp Stream_lines_2.moc ) # The executable itself. add_executable ( Stream_lines_2 Stream_lines_2.cpp Stream_lines_2.moc ${DT_UI_FILES} ${DT_RESOURCE_FILES} ) diff --git a/GraphicsView/demo/Stream_lines_2/Stream_lines_2.cpp b/GraphicsView/demo/Stream_lines_2/Stream_lines_2.cpp index 101165c245f..0f126f27fcb 100644 --- a/GraphicsView/demo/Stream_lines_2/Stream_lines_2.cpp +++ b/GraphicsView/demo/Stream_lines_2/Stream_lines_2.cpp @@ -239,9 +239,9 @@ int main(int argc, char **argv) app.setOrganizationName("GeometryFactory"); app.setApplicationName("Stream_lines_2 demo"); - // Import resources from libCGALQt4. + // Import resources from libCGAL (Qt4 or Qt5). // See http://doc.trolltech.com/4.4/qdir.html#Q_INIT_RESOURCE - CGAL_QT4_INIT_RESOURCES; + CGAL_QT_INIT_RESOURCES;//New for Qt5 version ! Q_INIT_RESOURCE(Stream_lines_2); MainWindow mainWindow; diff --git a/GraphicsView/demo/Triangulation_2/CMakeLists.txt b/GraphicsView/demo/Triangulation_2/CMakeLists.txt index 20cb6aedac5..7e0df4d61db 100644 --- a/GraphicsView/demo/Triangulation_2/CMakeLists.txt +++ b/GraphicsView/demo/Triangulation_2/CMakeLists.txt @@ -10,17 +10,42 @@ else() cmake_policy(VERSION 2.6) endif() -find_package(CGAL COMPONENTS Qt4) - -include(${CGAL_USE_FILE}) set( QT_USE_QTXML TRUE ) set( QT_USE_QTMAIN TRUE ) set( QT_USE_QTSCRIPT TRUE ) set( QT_USE_QTOPENGL TRUE ) +#New for Qt5 version ! +option (USE_QT5 "Use Qt5 version instead of Qt4" ON) -#find_package(Qt4) +if(USE_QT5) + + find_package(CGAL COMPONENTS Qt5) + + include(${CGAL_USE_FILE}) + + find_package(Qt5) + + set(CMAKE_AUTOMOC OFF) + +else (USE_QT5) + + find_package(CGAL COMPONENTS Qt4) + + include(${CGAL_USE_FILE}) + + find_package(Qt4) + + if(CGAL_Qt4_FOUND AND QT4_FOUND) + include(${QT_USE_FILE}) + message("Qt4 found") + set(QT4 TRUE) + endif() + +endif (USE_QT5) + +include(QtChoice) include_directories (BEFORE ../../include) include_directories (BEFORE ./include) @@ -28,21 +53,20 @@ include_directories (BEFORE ../../../Number_types/include) include_directories (BEFORE ../../../Triangulation_2/include) -if ( CGAL_FOUND AND CGAL_Qt4_FOUND AND QT4_FOUND ) +if ( CGAL_FOUND AND (QT4 OR QT5) ) -include(${QT_USE_FILE}) #-------------------------------- # The "constrained Delaunay" demo: Constrained_Delaunay_triangulation_2 #-------------------------------- # UI files (Qt Designer files) -qt4_wrap_ui( CDT_UI_FILES Constrained_Delaunay_triangulation_2.ui ) +qt_wrap_ui( CDT_UI_FILES Constrained_Delaunay_triangulation_2.ui ) # qrc files (resources files, that contain icons, at least) -qt4_add_resources ( CDT_RESOURCE_FILES ./Constrained_Delaunay_triangulation_2.qrc ) +qt_add_resources ( CDT_RESOURCE_FILES ./Constrained_Delaunay_triangulation_2.qrc ) # use the Qt MOC preprocessor on classes that derives from QObject -qt4_generate_moc( "Constrained_Delaunay_triangulation_2.cpp" "${CMAKE_CURRENT_BINARY_DIR}/Constrained_Delaunay_triangulation_2.moc" ) +qt_generate_moc( "Constrained_Delaunay_triangulation_2.cpp" "${CMAKE_CURRENT_BINARY_DIR}/Constrained_Delaunay_triangulation_2.moc" ) # The executable itself. add_executable ( Constrained_Delaunay_triangulation_2 Constrained_Delaunay_triangulation_2.cpp Constrained_Delaunay_triangulation_2.moc ${CDT_UI_FILES} ${CDT_RESOURCE_FILES} ) @@ -58,13 +82,13 @@ target_link_libraries( Constrained_Delaunay_triangulation_2 ${CGAL_LIBRARIES} $ # The "Delaunay" demo: Delaunay_triangulation_2 #-------------------------------- # UI files (Qt Designer files) -qt4_wrap_ui( DT_UI_FILES Delaunay_triangulation_2.ui ) +qt_wrap_ui( DT_UI_FILES Delaunay_triangulation_2.ui ) # qrc files (resources files, that contain icons, at least) -qt4_add_resources ( DT_RESOURCE_FILES ./Delaunay_triangulation_2.qrc ) +qt_add_resources ( DT_RESOURCE_FILES ./Delaunay_triangulation_2.qrc ) # use the Qt MOC preprocessor on classes that derives from QObject -qt4_generate_moc( "Delaunay_triangulation_2.cpp" "${CMAKE_CURRENT_BINARY_DIR}/Delaunay_triangulation_2.moc" ) +qt_generate_moc( "Delaunay_triangulation_2.cpp" "${CMAKE_CURRENT_BINARY_DIR}/Delaunay_triangulation_2.moc" ) # The executable itself. add_executable ( Delaunay_triangulation_2 Delaunay_triangulation_2.cpp Delaunay_triangulation_2.moc ${DT_UI_FILES} ${DT_RESOURCE_FILES} ) @@ -80,13 +104,13 @@ target_link_libraries( Delaunay_triangulation_2 ${CGAL_LIBRARIES} ${CGAL_3RD_PAR # The "Regular" demo: Regular_triangulation_2 #-------------------------------- # UI files (Qt Designer files) -qt4_wrap_ui( DT_UI_FILES Regular_triangulation_2.ui ) +qt_wrap_ui( DT_UI_FILES Regular_triangulation_2.ui ) # qrc files (resources files, that contain icons, at least) -qt4_add_resources ( DT_RESOURCE_FILES ./Regular_triangulation_2.qrc ) +qt_add_resources ( DT_RESOURCE_FILES ./Regular_triangulation_2.qrc ) # use the Qt MOC preprocessor on classes that derives from QObject -qt4_generate_moc( "Regular_triangulation_2.cpp" "${CMAKE_CURRENT_BINARY_DIR}/Regular_triangulation_2.moc" ) +qt_generate_moc( "Regular_triangulation_2.cpp" "${CMAKE_CURRENT_BINARY_DIR}/Regular_triangulation_2.moc" ) # The executable itself. add_executable ( Regular_triangulation_2 Regular_triangulation_2.cpp Regular_triangulation_2.moc ${DT_UI_FILES} ${DT_RESOURCE_FILES} ) diff --git a/GraphicsView/demo/Triangulation_2/Constrained_Delaunay_triangulation_2.cpp b/GraphicsView/demo/Triangulation_2/Constrained_Delaunay_triangulation_2.cpp index 7bd7e839af2..8846e2c0c66 100644 --- a/GraphicsView/demo/Triangulation_2/Constrained_Delaunay_triangulation_2.cpp +++ b/GraphicsView/demo/Triangulation_2/Constrained_Delaunay_triangulation_2.cpp @@ -676,6 +676,18 @@ MainWindow::on_actionInsertRandomPoints_triggered() Iso_rectangle_2 isor = convert(rect); CGAL::Random_points_in_iso_rectangle_2 pg((isor.min)(), (isor.max)()); bool ok = false; + + #if QT_VERSION >= 0x050000 + const int number_of_points = + QInputDialog::getInt(this, + tr("Number of random points"), + tr("Enter number of random points"), + 100, + 0, + (std::numeric_limits::max)(), + 1, + &ok); + #else const int number_of_points = QInputDialog::getInteger(this, tr("Number of random points"), @@ -685,6 +697,7 @@ MainWindow::on_actionInsertRandomPoints_triggered() (std::numeric_limits::max)(), 1, &ok); + #endif if(!ok) { return; @@ -714,9 +727,9 @@ int main(int argc, char **argv) app.setOrganizationName("GeometryFactory"); app.setApplicationName("Constrained_Delaunay_triangulation_2 demo"); - // Import resources from libCGALQt4. + // Import resources from libCGAL (Qt4 or Qt5). // See http://doc.trolltech.com/4.4/qdir.html#Q_INIT_RESOURCE - CGAL_QT4_INIT_RESOURCES; + CGAL_QT_INIT_RESOURCES; //New for Qt5 version ! MainWindow mainWindow; mainWindow.show(); diff --git a/GraphicsView/demo/Triangulation_2/Delaunay_triangulation_2.cpp b/GraphicsView/demo/Triangulation_2/Delaunay_triangulation_2.cpp index 488afc62744..1ced0e5d712 100644 --- a/GraphicsView/demo/Triangulation_2/Delaunay_triangulation_2.cpp +++ b/GraphicsView/demo/Triangulation_2/Delaunay_triangulation_2.cpp @@ -280,6 +280,18 @@ MainWindow::on_actionInsertRandomPoints_triggered() Iso_rectangle_2 isor = convert(rect); CGAL::Random_points_in_iso_rectangle_2 pg((isor.min)(), (isor.max)()); bool ok = false; + + #if QT_VERSION >= 0x050000 + const int number_of_points = + QInputDialog::getInt(this, + tr("Number of random points"), + tr("Enter number of random points"), + 100, + 0, + (std::numeric_limits::max)(), + 1, + &ok); + #else const int number_of_points = QInputDialog::getInteger(this, tr("Number of random points"), @@ -289,6 +301,7 @@ MainWindow::on_actionInsertRandomPoints_triggered() (std::numeric_limits::max)(), 1, &ok); + #endif if(!ok) { return; @@ -382,9 +395,9 @@ int main(int argc, char **argv) app.setOrganizationName("GeometryFactory"); app.setApplicationName("Delaunay_triangulation_2 demo"); - // Import resources from libCGALQt4. + // Import resources from libCGAL (Qt4 or QT5). // See http://doc.trolltech.com/4.4/qdir.html#Q_INIT_RESOURCE - CGAL_QT4_INIT_RESOURCES; + CGAL_QT_INIT_RESOURCES;//New for Qt5 version ! MainWindow mainWindow; mainWindow.show(); diff --git a/GraphicsView/demo/Triangulation_2/Regular_triangulation_2.cpp b/GraphicsView/demo/Triangulation_2/Regular_triangulation_2.cpp index 8c9ee5567b4..6d9936da04c 100644 --- a/GraphicsView/demo/Triangulation_2/Regular_triangulation_2.cpp +++ b/GraphicsView/demo/Triangulation_2/Regular_triangulation_2.cpp @@ -215,11 +215,20 @@ MainWindow::on_actionInsertRandomPoints_triggered() QRectF rect = CGAL::Qt::viewportsBbox(&scene); CGAL::Qt::Converter convert; Iso_rectangle_2 isor = convert(rect); - CGAL::Random_points_in_iso_rectangle_2 pg((isor.min)(), (isor.max)()); + CGAL::Random_points_in_iso_rectangle_2 pg((isor.min)(), (isor.max)()); + + #if QT_VERSION >= 0x050000 + const int number_of_points = + QInputDialog::getInt(this, + tr("Number of random points"), + tr("Enter number of random points"), 100, 0); + #else const int number_of_points = QInputDialog::getInteger(this, tr("Number of random points"), tr("Enter number of random points"), 100, 0); + #endif + // wait cursor QApplication::setOverrideCursor(Qt::WaitCursor); @@ -295,9 +304,9 @@ int main(int argc, char **argv) app.setOrganizationName("GeometryFactory"); app.setApplicationName("Regular_triangulation_2 demo"); - // Import resources from libCGALQt4. + // Import resources from libCGAL (Qt4 or Qt5). // See http://doc.trolltech.com/4.4/qdir.html#Q_INIT_RESOURCE - CGAL_QT4_INIT_RESOURCES; + CGAL_QT_INIT_RESOURCES;//New for Qt5 version ! MainWindow mainWindow; mainWindow.show(); diff --git a/Polyhedron/demo/Polyhedron/Polyhedron_demo_mesh_3_plugin_cgal_code.cpp b/Polyhedron/demo/Polyhedron/Polyhedron_demo_mesh_3_plugin_cgal_code.cpp index 345e0d888be..dc1aa9175f2 100644 --- a/Polyhedron/demo/Polyhedron/Polyhedron_demo_mesh_3_plugin_cgal_code.cpp +++ b/Polyhedron/demo/Polyhedron/Polyhedron_demo_mesh_3_plugin_cgal_code.cpp @@ -329,8 +329,6 @@ Scene_item* cgal_code_mesh_3(const Polyhedron* pMesh, } } -#if QT_VERSION >= 0x050000 #include "Polyhedron_demo_mesh_3_plugin_cgal_code.moc" -#else //#include "Scene_c3t3_item.moc" //Check this one, it's strange moc include. -#endif +