Add of Apollonius_graph_2 demonstration of GraphicView and all GraphicView demonstrations works on Windows.

This commit is contained in:
Aurelien Vialon 2014-07-17 13:03:23 +02:00
parent c3aaf0bffe
commit 4c85bee791
2 changed files with 56 additions and 19 deletions

View File

@ -176,15 +176,29 @@ MainWindow::on_actionInsertRandomPoints_triggered()
CGAL::Random_points_in_iso_rectangle_2<Point_2> pg((isor.min)(), (isor.max)());
bool ok = false;
//New for Qt5 version !
#if QT_VERSION >= 0x050000
const int number_of_points =
QInputDialog::getInteger(this,
QInputDialog::getInt(this,
tr("Number of random points"),
tr("Enter number of random points"),
100,
0,
(std::numeric_limits<int>::max)(),
1,
&ok);
100,
0,
(std::numeric_limits<int>::max)(),
1,
&ok);
#else
const int number_of_points =
QInputDialog::getInteger(this,
tr("Number of random points"),
tr("Enter number of random points"),
100,
0,
(std::numeric_limits<int>::max)(),
1,
&ok);
#endif
if(!ok) {
return;
@ -282,9 +296,9 @@ int main(int argc, char **argv)
app.setOrganizationName("GeometryFactory");
app.setApplicationName("Apollonius_graph_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(Apollonius_graph_2);
MainWindow mainWindow;

View File

@ -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 Apollonius_graph_2.ui )
qt_wrap_ui( DT_UI_FILES Apollonius_graph_2.ui )
# qrc files (resources files, that contain icons, at least)
qt4_add_resources ( DT_RESOURCE_FILES ./Apollonius_graph_2.qrc )
qt_add_resources ( DT_RESOURCE_FILES ./Apollonius_graph_2.qrc )
# use the Qt MOC preprocessor on classes that derives from QObject
qt4_generate_moc( Apollonius_graph_2.cpp Apollonius_graph_2.moc )
qt_generate_moc( Apollonius_graph_2.cpp Apollonius_graph_2.moc )
# The executable itself.
add_executable ( Apollonius_graph_2 Apollonius_graph_2.cpp Apollonius_graph_2.moc ${DT_UI_FILES} ${DT_RESOURCE_FILES} )