diff --git a/AABB_tree/demo/AABB_tree/CMakeLists.txt b/AABB_tree/demo/AABB_tree/CMakeLists.txt index f455cae3f06..b66e3f46877 100644 --- a/AABB_tree/demo/AABB_tree/CMakeLists.txt +++ b/AABB_tree/demo/AABB_tree/CMakeLists.txt @@ -8,52 +8,28 @@ set(CMAKE_INCLUDE_CURRENT_DIR ON) # Instruct CMake to run moc automatically when needed. set(CMAKE_AUTOMOC ON) -if(NOT POLICY CMP0070 AND POLICY CMP0053) - # Only set CMP0053 to OLD with CMake<3.10, otherwise there is a warning. - cmake_policy(SET CMP0053 OLD) -endif() - -if(POLICY CMP0071) - cmake_policy(SET CMP0071 NEW) -endif() - -# Include this package's headers first -include_directories(BEFORE ./ ./include) # Find CGAL and CGAL Qt6 find_package(CGAL REQUIRED OPTIONAL_COMPONENTS Qt6) # Find Qt6 itself -find_package(Qt6 QUIET COMPONENTS OpenGLWidgets Widgets OpenGL Qml) +find_package(Qt6 QUIET COMPONENTS Gui) if(CGAL_Qt6_FOUND AND Qt6_FOUND) qt6_wrap_ui(UI_FILES MainWindow.ui) - include(AddFileDependencies) - qt6_generate_moc("MainWindow.h" "${CMAKE_CURRENT_BINARY_DIR}/MainWindow_moc.cpp") - add_file_dependencies(MainWindow_moc.cpp "${CMAKE_CURRENT_SOURCE_DIR}/MainWindow.h") - qt6_generate_moc("Viewer.h" "${CMAKE_CURRENT_BINARY_DIR}/Viewer_moc.cpp") - add_file_dependencies(Viewer_moc.cpp "${CMAKE_CURRENT_SOURCE_DIR}/Viewer.h") - qt6_generate_moc("Scene.h" "${CMAKE_CURRENT_BINARY_DIR}/Scene_moc.cpp") - add_file_dependencies(Scene_moc.cpp "${CMAKE_CURRENT_SOURCE_DIR}/Scene.h") qt6_add_resources(CGAL_Qt6_RESOURCE_FILES AABB_demo.qrc) - add_file_dependencies( - AABB_demo.cpp "${CMAKE_CURRENT_BINARY_DIR}/MainWindow_moc.cpp" - "${CMAKE_CURRENT_BINARY_DIR}/Viewer_moc.cpp" - "${CMAKE_CURRENT_BINARY_DIR}/Scene_moc.cpp") - add_executable( AABB_demo AABB_demo.cpp ${UI_FILES} ${CGAL_Qt6_RESOURCE_FILES} - #${CGAL_Qt6_MOC_FILES} ) # Link with Qt libraries - target_link_libraries(AABB_demo PRIVATE Qt6::OpenGLWidgets Qt6::Widgets Qt6::OpenGL Qt6::Qml + target_link_libraries(AABB_demo PRIVATE Qt6::Gui CGAL::CGAL CGAL::CGAL_Qt6) add_to_cached_list(CGAL_EXECUTABLE_TARGETS AABB_demo) diff --git a/AABB_tree/demo/AABB_tree/MainWindow.cpp b/AABB_tree/demo/AABB_tree/MainWindow.cpp index cd1444b9968..63e4a0fe596 100644 --- a/AABB_tree/demo/AABB_tree/MainWindow.cpp +++ b/AABB_tree/demo/AABB_tree/MainWindow.cpp @@ -13,10 +13,8 @@ #include "ui_MainWindow.h" - - MainWindow::MainWindow(QWidget* parent) - : CGAL::Qt::DemosMainWindow(parent), myEngine(new QJSEngine(this)) + : CGAL::Qt::DemosMainWindow(parent) { ui = new Ui::MainWindow; ui->setupUi(this); @@ -40,25 +38,12 @@ MainWindow::MainWindow(QWidget* parent) connect(this, SIGNAL(openRecentFile(QString)), this, SLOT(open(QString))); - QJSValue mainWindow = myEngine->newQObject(this); - myEngine->globalObject().setProperty("main_window", mainWindow); readSettings(); - std::ifstream script("init.js"); - if(script.good()){ - std::string line; - while(getline(script, line)){ - myEngine->evaluate(line.c_str()); - } - } } MainWindow::~MainWindow() { m_pViewer->makeCurrent(); - // AF I thought this helps to avoid the exception when the program - // terminates, but it does not - myEngine->globalObject().setProperty("main_window", QJSValue()); - myEngine->collectGarbage(); delete ui; } @@ -80,13 +65,6 @@ void MainWindow::dropEvent(QDropEvent *event) event->acceptProposedAction(); } - -void MainWindow::hello() const -{ - std::cout << "Hhello world" << std::endl; -} - - void MainWindow::updateViewerBBox() { m_pScene->update_bbox(); diff --git a/AABB_tree/demo/AABB_tree/MainWindow.h b/AABB_tree/demo/AABB_tree/MainWindow.h index 87f6de0c76c..d220dec4400 100644 --- a/AABB_tree/demo/AABB_tree/MainWindow.h +++ b/AABB_tree/demo/AABB_tree/MainWindow.h @@ -1,8 +1,6 @@ #ifndef MAINWINDOW_H #define MAINWINDOW_H -#include -#include #include class QDragEnterEvent; @@ -13,38 +11,6 @@ namespace Ui { class MainWindow; } -#if 0 - -struct Foo : public QObject -{ - - Q_OBJECT -public: - QJSEngine* myEngine; - - Foo() - : myEngine(new QJSEngine(this)) - { - QJSValue baz = myEngine->newQObject(this); - myEngine->.globalObject().setProperty("baz", baz); - } - - void bar() - { - std::cout << "bar()" << std::endl; - myEngine->evaluate("baz.hello()"); - } - -public slots: - void hello() const // if not a slot it must be - { - std::cout << "called hello()" << std::endl; - } - -}; -#endif - - class MainWindow : public CGAL::Qt::DemosMainWindow { @@ -54,8 +20,6 @@ public: ~MainWindow(); public slots: - - void hello() const; void updateViewerBBox(); void open(QString filename); void setAddKeyFrameKeyboardModifiers(Qt::KeyboardModifiers); @@ -113,7 +77,6 @@ public: void on_actionView_cutting_plane_triggered(); private: - QJSEngine* myEngine; Scene* m_pScene; Viewer* m_pViewer; Ui::MainWindow* ui; diff --git a/AABB_tree/demo/AABB_tree/Scene.h b/AABB_tree/demo/AABB_tree/Scene.h index cc109a433fd..74309b25ef3 100644 --- a/AABB_tree/demo/AABB_tree/Scene.h +++ b/AABB_tree/demo/AABB_tree/Scene.h @@ -1,7 +1,6 @@ #ifndef SCENE_H #define SCENE_H -#include #include #include @@ -77,7 +76,6 @@ private: }; public: - QOpenGLContext* context; void draw(CGAL::QGLViewer*); void update_bbox(); Bbox bbox() { return m_bbox; } diff --git a/AABB_tree/demo/AABB_tree/Viewer.cpp b/AABB_tree/demo/AABB_tree/Viewer.cpp index 6f5eac00679..9e5cf22bdb7 100644 --- a/AABB_tree/demo/AABB_tree/Viewer.cpp +++ b/AABB_tree/demo/AABB_tree/Viewer.cpp @@ -1,9 +1,6 @@ #include "Viewer.h" #include "Scene.h" #include -#include -#include - Viewer::Viewer(QWidget* parent) : CGAL::QGLViewer(parent), m_pScene(nullptr), diff --git a/AABB_tree/demo/AABB_tree/init.js b/AABB_tree/demo/AABB_tree/init.js deleted file mode 100644 index e7f08e266c6..00000000000 --- a/AABB_tree/demo/AABB_tree/init.js +++ /dev/null @@ -1,2 +0,0 @@ -main_window.hello(); -main_window.hello();