diff --git a/Polyhedron/demo/Polyhedron/MainWindow.cpp b/Polyhedron/demo/Polyhedron/MainWindow.cpp index b797ecf7a70..4560cf9acee 100644 --- a/Polyhedron/demo/Polyhedron/MainWindow.cpp +++ b/Polyhedron/demo/Polyhedron/MainWindow.cpp @@ -73,10 +73,12 @@ #include #include +#include "Color_map.h" + #ifdef QT_SCRIPT_LIB # include # include -#include "Color_map.h" + using namespace CGAL::Three; @@ -123,6 +125,7 @@ const QString debug_widgets_names[9] = { # endif #endif +#if 0 QScriptValue myPrintFunction(QScriptContext *context, QScriptEngine *engine) { MainWindow* mw = qobject_cast(engine->parent()); @@ -138,6 +141,7 @@ QScriptValue myPrintFunction(QScriptContext *context, QScriptEngine *engine) return engine->undefinedValue(); } +#endif inline QKeySequence combine(Qt::Modifier m, Qt::Key k) @@ -166,8 +170,8 @@ MainWindow::MainWindow(const QStringList &keywords, bool verbose, QWidget* paren is_locked = false; // remove the Load Script menu entry, when the demo has not been compiled with QT_SCRIPT_LIB #if !defined(QT_SCRIPT_LIB) - ui->menuBar->removeAction(ui->actionLoadScript); - ui->menuBar->removeAction(ui->on_actionLoad_a_Scene_from_a_Script_File); + // ui->menuBar->removeAction(ui->actionLoadScript); + // ui->menuBar->removeAction(ui->on_actionLoad_a_Scene_from_a_Script_File); #endif // Save some pointers from ui, for latter use. sceneView = ui->sceneView; @@ -528,6 +532,7 @@ void MainWindow::filterOperations(bool) #include +#if 0 void MainWindow::evaluate_script(QString script, const QString& filename, const bool quiet) { @@ -595,6 +600,7 @@ void MainWindow::enableScriptDebugger(bool b /* = true */) this->error(tr("Your version of Qt is too old, and for that reason " "the Qt Script Debugger is not available.")); } +#endif namespace { bool actionsByName(QAction* x, QAction* y) { @@ -650,8 +656,8 @@ bool MainWindow::load_plugin(QString fileName, bool blacklisted) QFileInfo fileinfo(fileName); //set plugin name QString name = fileinfo.fileName(); - name.remove(QRegExp("^lib")); - name.remove(QRegExp("\\..*")); + name.remove(QRegularExpression("^lib")); + name.remove(QRegularExpression("\\..*")); //do not load it if it is in the blacklist if(blacklisted) { @@ -1138,20 +1144,22 @@ bool MainWindow::file_matches_filter(const QString& filters, QString filename_striped=fileinfo.fileName(); //match all filters between () - QRegExp all_filters_rx("\\((.*)\\)"); + QRegularExpression all_filters_rx("\\((.*)\\)"); QStringList split_filters = filters.split(";;"); Q_FOREACH(const QString& filter, split_filters) { //extract filters +#if 0 // AF @todo if ( all_filters_rx.indexIn(filter)!=-1 ){ Q_FOREACH(const QString& pattern,all_filters_rx.cap(1).split(' ')){ - QRegExp rx(pattern); - rx.setPatternSyntax(QRegExp::Wildcard); + QRegularExpression rx(pattern); + rx.setPatternSyntax(QRegularExpression::Wildcard); if ( rx.exactMatch(filename_striped) ){ return true; } } } +#endif } return false; } @@ -1268,6 +1276,7 @@ void MainWindow::open(QString filename) bool MainWindow::open(QString filename, QString loader_name) { QFileInfo fileinfo(filename); boost::optional item_opt; +#if 0 // AF try { item_opt = wrap_a_call_to_cpp ([this, fileinfo, loader_name]() @@ -1284,6 +1293,7 @@ bool MainWindow::open(QString filename, QString loader_name) { std::cerr << e.what() << std::endl; return false; } +#endif return true; } @@ -1887,6 +1897,7 @@ void MainWindow::closeEvent(QCloseEvent *event) event->accept(); } +#if 0 bool MainWindow::loadScript(QString filename) { QFileInfo fileinfo(filename); @@ -1920,12 +1931,15 @@ bool MainWindow::loadScript(QFileInfo info) #endif return false; } +#endif void MainWindow::throw_exception() { +#if 0 // AF wrap_a_call_to_cpp([]() { throw std::runtime_error("Exception thrown in " "MainWindow::throw_exception()"); }, this, __FILE__, __LINE__); +#endif } void MainWindow::on_actionLoadScript_triggered() @@ -2046,7 +2060,7 @@ void MainWindow::on_actionSaveAs_triggered() sf = plugin->saveNameFilters().split(";;").first(); } } - QRegExp extensions("\\(\\*\\..+\\)"); + QRegularExpression extensions("\\(\\*\\..+\\)"); QStringList filter_exts; if(filters.empty()) { @@ -2056,6 +2070,7 @@ void MainWindow::on_actionSaveAs_triggered() .arg(item->name())); return; } +#if 0 // AF Q_FOREACH(QString string, filters) { QStringList sl = string.split(";;"); @@ -2065,6 +2080,8 @@ void MainWindow::on_actionSaveAs_triggered() filter_exts.append(extensions.capturedTexts()); } } +#endif + filters << tr("All files (*)"); if(canSavePlugins.isEmpty()) { QMessageBox::warning(this, @@ -2094,9 +2111,9 @@ void MainWindow::on_actionSaveAs_triggered() if(filename.isEmpty()) return; last_saved_dir = QFileInfo(filename).absoluteDir().path(); - extensions.indexIn(sf.split(";;").first()); + // AF extensions.indexIn(sf.split(";;").first()); QString filter_ext, filename_ext; - filter_ext = extensions.cap().split(" ").first();// in case of syntax like (*.a *.b) + // AF filter_ext = extensions.cap().split(" ").first();// in case of syntax like (*.a *.b) filter_ext.remove(")"); filter_ext.remove("("); @@ -2804,9 +2821,11 @@ void MainWindow::colorItems() return; std::vector colors_; colors_.reserve(nb_files); +# compute_color_map(scene->item(scene->selectionIndices().last())->color(), static_cast(nb_files), std::back_inserter(colors_)); + std::size_t nb_item = -1; Q_FOREACH(int id, scene->selectionIndices()) { @@ -3859,7 +3878,7 @@ void MainWindow::on_actionLoad_a_Scene_from_a_Script_File_triggered() if(filename.isEmpty()) return; } - loadScript(QFileInfo(filename)); + if(do_download){ QFile tmp_file(filename); tmp_file.remove(); diff --git a/Polyhedron/demo/Polyhedron/MainWindow.h b/Polyhedron/demo/Polyhedron/MainWindow.h index 7202c8ac629..f0c3adca007 100644 --- a/Polyhedron/demo/Polyhedron/MainWindow.h +++ b/Polyhedron/demo/Polyhedron/MainWindow.h @@ -3,12 +3,13 @@ #include "config.h" #include "MainWindow_config.h" -#include +#include #include #include -#include -#include +// AF @todo Scripting has changed +// #include +// #include #include @@ -60,8 +61,8 @@ namespace Ui { class MAINWINDOW_EXPORT MainWindow : public CGAL::Qt::DemosMainWindow, public Messages_interface, - public CGAL::Three::Three, - protected QScriptable + public CGAL::Three::Three + // AF , protected QScriptable { Q_OBJECT Q_INTERFACES(Messages_interface) @@ -147,12 +148,13 @@ public Q_SLOTS: index of the item to be reloaded as data attached to the action. The index must identify a valid `Scene_item`.*/ void reloadItem(); - +#if 0 //! Loads a script. Returns true if it worked. bool loadScript(QString filename); //! Loads a script. Returns true if it worked. bool loadScript(QFileInfo); +#endif /*! * Gives the keyboard input focus to the widget searchEdit. @@ -261,7 +263,7 @@ public Q_SLOTS: * If able, finds a script debugger and interrupts current action. Default * value for parameter is true. */ - void enableScriptDebugger(bool = true); + // void enableScriptDebugger(bool = true); /// This slot is used to test exception handling in Qt Scripts. void throw_exception(); @@ -449,9 +451,11 @@ public: //! Calls evaluate_script(script, filename, true). void evaluate_script_quiet(QString script, const QString & fileName = QString()); + #endif + QMutex mutex; QWaitCondition wait_condition; -#endif + public Q_SLOTS: void on_actionSa_ve_Scene_as_Script_triggered(); void on_actionLoad_a_Scene_from_a_Script_File_triggered(); diff --git a/Polyhedron/demo/Polyhedron/Polyhedron_demo.cpp b/Polyhedron/demo/Polyhedron/Polyhedron_demo.cpp index 7b6e5225dfe..6348c203eab 100644 --- a/Polyhedron/demo/Polyhedron/Polyhedron_demo.cpp +++ b/Polyhedron/demo/Polyhedron/Polyhedron_demo.cpp @@ -129,10 +129,10 @@ Polyhedron_demo::Polyhedron_demo(int& argc, char **argv, } #endif - mainWindow.loadScript(":/cgal/Polyhedron_3/javascript/lib.js"); + // mainWindow.loadScript(":/cgal/Polyhedron_3/javascript/lib.js"); QFileInfo autostart_js("autostart.js"); if(!parser.isSet(no_autostart) && autostart_js.exists()) { - mainWindow.loadScript(autostart_js); + // mainWindow.loadScript(autostart_js); } Q_FOREACH(QString filename, parser.positionalArguments()) { mainWindow.open(filename); diff --git a/Polyhedron/demo/Polyhedron/Scene.cpp b/Polyhedron/demo/Polyhedron/Scene.cpp index c70929ab4a5..8a66f7fb2ca 100644 --- a/Polyhedron/demo/Polyhedron/Scene.cpp +++ b/Polyhedron/demo/Polyhedron/Scene.cpp @@ -15,7 +15,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/Polyhedron/demo/Polyhedron/Scene.h b/Polyhedron/demo/Polyhedron/Scene.h index b661ed7baa8..0724bc577cf 100644 --- a/Polyhedron/demo/Polyhedron/Scene.h +++ b/Polyhedron/demo/Polyhedron/Scene.h @@ -7,7 +7,7 @@ #include #include -#include +#include #include #include #include diff --git a/Polyhedron/demo/Polyhedron/Show_point_dialog.cpp b/Polyhedron/demo/Polyhedron/Show_point_dialog.cpp index c831303083d..1654dadf30b 100644 --- a/Polyhedron/demo/Polyhedron/Show_point_dialog.cpp +++ b/Polyhedron/demo/Polyhedron/Show_point_dialog.cpp @@ -2,6 +2,7 @@ #include "ui_Show_point_dialog.h" #include +#include Show_point_dialog::Show_point_dialog(QWidget* parent) : QDialog(parent) @@ -50,7 +51,8 @@ void Show_point_dialog::interprete_string(const QString& string) + "|" + not_double_char_re + "+" + double_re + ")" + "$"; - QRegExp re(full_re); +#if 0 // AF @todo QRegExp had exactMatch() and cap() + QRegularExpression re(full_re); if(re.exactMatch(string)) { // const double x = re.cap(1).toDouble(); // const double y = re.cap(2).toDouble(); @@ -66,6 +68,7 @@ void Show_point_dialog::interprete_string(const QString& string) ui->coord_z->setText(QString()); m_has_correct_coordinates = false; } +#endif } double Show_point_dialog::get_x() const diff --git a/Polyhedron/demo/Polyhedron/Viewer.cpp b/Polyhedron/demo/Polyhedron/Viewer.cpp index 201e15555c5..83182e00bf2 100644 --- a/Polyhedron/demo/Polyhedron/Viewer.cpp +++ b/Polyhedron/demo/Polyhedron/Viewer.cpp @@ -18,6 +18,7 @@ #include #include #include +#include #include #ifdef CGAL_USE_WEBSOCKETS #include @@ -1838,7 +1839,7 @@ void Viewer::setLighting() connect(dialog->position_lineEdit, &QLineEdit::editingFinished, [this, dialog]() { - QStringList list = dialog->position_lineEdit->text().split(QRegExp(","), CGAL_QT_SKIP_EMPTY_PARTS); + QStringList list = dialog->position_lineEdit->text().split(QRegularExpression(","), CGAL_QT_SKIP_EMPTY_PARTS); if (list.isEmpty()) return; if (list.size()!=3){ QMessageBox *msgBox = new QMessageBox; diff --git a/Polyhedron/demo/Polyhedron/polyhedron_demo_macros.cmake b/Polyhedron/demo/Polyhedron/polyhedron_demo_macros.cmake index 0e20273faa7..3b31bce3992 100644 --- a/Polyhedron/demo/Polyhedron/polyhedron_demo_macros.cmake +++ b/Polyhedron/demo/Polyhedron/polyhedron_demo_macros.cmake @@ -19,7 +19,7 @@ include(${CGAL_MODULES_DIR}/CGAL_add_test.cmake) set(moc_file_name "") else() set(moc_file_name ${plugin_implementation_base_name}.moc ) - qt5_generate_moc( ${plugin_implementation_base_name}.cpp "${CMAKE_CURRENT_BINARY_DIR}/${moc_file_name}" ) + qt6_generate_moc( ${plugin_implementation_base_name}.cpp "${CMAKE_CURRENT_BINARY_DIR}/${moc_file_name}" ) add_file_dependencies( ${moc_file_name} "${CMAKE_CURRENT_SOURCE_DIR}/${plugin_implementation_base_name}.cpp" ) endif() @@ -49,7 +49,7 @@ include(${CGAL_MODULES_DIR}/CGAL_add_test.cmake) set_property(TEST "compilation_of__demo_framework" APPEND PROPERTY FIXTURES_SETUP "demo_framework_SetupFixture") set_property(TEST "compilation_of__demo_framework" - APPEND PROPERTY DEPENDS "compilation_of__CGAL_Qt5_moc_and_resources") + APPEND PROPERTY DEPENDS "compilation_of__CGAL_Qt6_moc_and_resources") endif() endif() else() diff --git a/Three/include/CGAL/Three/exceptions.h b/Three/include/CGAL/Three/exceptions.h index cf3640d5b46..15fa13cd320 100644 --- a/Three/include/CGAL/Three/exceptions.h +++ b/Three/include/CGAL/Three/exceptions.h @@ -19,9 +19,9 @@ #include #include #include -#include -#include -#include +//#include +//#include +//#include #include #include @@ -60,6 +60,7 @@ struct Optional_or_bool { enum Context { CURRENT_CONTEXT, PARENT_CONTEXT }; +#if 1 // AF @todo scripting has changed /// This function template wraps a `Callable` that can be called without /// any argument (such as a lambda expression without arguments), and in /// case the function call is in a Qt Script context, wraps the call in a @@ -69,7 +70,7 @@ enum Context { CURRENT_CONTEXT, PARENT_CONTEXT }; template typename Optional_or_bool::type>::type wrap_a_call_to_cpp(Callable f, - QScriptable* qs = 0, + // QScriptable* qs = 0, const char* file = 0, int line = -1, Context c = CURRENT_CONTEXT) { @@ -78,12 +79,13 @@ wrap_a_call_to_cpp(Callable f, typedef typename O_r_b::type Return_type; const bool no_try_catch = qApp->property("no-try-catch").toBool(); - if(no_try_catch || qs == 0 || !qs->context()) return O_r_b::invoke(f); + if(no_try_catch /* || qs == 0 || !qs->context() */ ) return O_r_b::invoke(f); else try { return O_r_b::invoke(f); } catch(const std::exception& e) { +#if 0 const Script_exception* se = dynamic_cast(&e); QScriptContext* context = qs->context(); QStringList qt_bt = context->backtrace(); @@ -121,9 +123,11 @@ wrap_a_call_to_cpp(Callable f, qScriptValueFromSequence(context->engine(), qt_bt)); std::cerr << "result after throwError: " << qPrintable(v.toString()) << std::endl; +#endif return Return_type(); } } +#endif } // end namespace Three } // end namespace CGAL