From 652f7b26c09ae4052049cbb7107c6ae79f0bcc75 Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Wed, 15 Nov 2023 08:59:17 +0000 Subject: [PATCH] Replace Q_FOREACH --- Polyhedron/demo/Polyhedron/MainWindow.cpp | 138 +++++++++--------- .../Plugins/AABB_tree/Cut_plugin.cpp | 10 +- .../AABB_tree/Do_trees_intersect_plugin.cpp | 14 +- .../Alpha_wrap_3/Alpha_wrap_3_plugin.cpp | 6 +- .../Camera_position/Camera_positions_list.cpp | 2 +- .../Convex_decomposition/Nef_plugin.cpp | 2 +- .../IO/Implicit_function_io_plugin.cpp | 4 +- .../Plugins/IO/Polylines_io_plugin.cpp | 2 +- .../Plugins/Mesh_2/Mesh_2_plugin.cpp | 22 +-- .../Plugins/Mesh_3/Io_image_plugin.cpp | 10 +- .../Mesh_3/Io_implicit_function_plugin.cpp | 6 +- .../Plugins/Mesh_3/Mesh_3_plugin.cpp | 6 +- .../Plugins/Mesh_3/Offset_meshing_plugin.cpp | 2 +- .../Plugins/Mesh_3/Optimization_plugin.cpp | 2 +- .../Polyhedron/Plugins/Mesh_3/Volume_plane.h | 2 +- .../Clip_polyhedron_plugin.cpp | 4 +- .../Plugins/PCA/Affine_transform_plugin.cpp | 2 +- .../Plugins/PCA/Basic_generator_plugin.cpp | 6 +- .../Plugins/PCA/Clipping_box_plugin.cpp | 4 +- .../Plugins/PCA/Create_bbox_mesh_plugin.cpp | 4 +- .../Plugins/PCA/Create_obb_mesh_plugin.cpp | 6 +- .../Plugins/PCA/Edit_box_plugin.cpp | 2 +- .../Polyhedron/Plugins/PCA/Pca_plugin.cpp | 2 +- .../Plugins/PCA/Scene_edit_box_item.cpp | 8 +- .../Plugins/PMP/Degenerated_faces_plugin.cpp | 8 +- .../Plugins/PMP/Detect_sharp_edges_plugin.cpp | 6 +- .../Plugins/PMP/Engrave_text_plugin.cpp | 11 +- .../Polyhedron/Plugins/PMP/Extrude_plugin.cpp | 4 +- .../Plugins/PMP/Hole_filling_plugin.cpp | 8 +- .../PMP/Isotropic_remeshing_plugin.cpp | 2 +- .../PMP/Join_and_split_polyhedra_plugin.cpp | 10 +- .../Mean_curvature_flow_skeleton_plugin.cpp | 2 +- .../Plugins/PMP/Orient_soup_plugin.cpp | 5 +- .../PMP/Point_inside_polyhedron_plugin.cpp | 8 +- .../PMP/Polyhedron_stitching_plugin.cpp | 10 +- .../PMP/Remesh_planar_patches_plugin.cpp | 2 +- .../Plugins/PMP/Repair_polyhedron_plugin.cpp | 2 +- .../Scene_facegraph_item_k_ring_selection.h | 4 +- .../Plugins/PMP/Selection_plugin.cpp | 4 +- .../PMP/Surface_intersection_plugin.cpp | 16 +- .../Plugins/PMP/Triangulate_facets_plugin.cpp | 4 +- .../Plugins/Point_set/Alpha_shape_plugin.cpp | 2 +- .../Point_set/Merge_point_sets_plugin.cpp | 6 +- .../Point_set/Point_set_selection_plugin.cpp | 6 +- .../Point_set_shape_detection_plugin.cpp | 4 +- .../Point_set_to_mesh_distance_plugin.cpp | 4 +- .../Point_set/Register_point_sets_plugin.cpp | 2 +- .../Subdivision_methods_plugin.cpp | 2 +- .../Surface_mesh/Offset_meshing_plugin.cpp | 4 +- .../Surface_mesh/Parameterization_plugin.cpp | 16 +- .../Scene_polyhedron_shortest_path_item.cpp | 4 +- .../Plugins/Surface_mesh/UVProjector.h | 2 +- .../Edit_polyhedron_plugin.cpp | 16 +- .../Scene_edit_polyhedron_item.cpp | 2 +- .../demo/Polyhedron/Polyhedron_demo.cpp | 4 +- .../Polyhedron_demo_plugin_helper.cpp | 4 +- Polyhedron/demo/Polyhedron/Scene.cpp | 68 ++++----- Polyhedron/demo/Polyhedron/Scene.h | 12 +- Polyhedron/demo/Polyhedron/Scene_find_items.h | 4 +- .../demo/Polyhedron/Scene_group_item.cpp | 2 +- .../Scene_points_with_normal_item.cpp | 2 +- .../Scene_polyhedron_selection_item.cpp | 16 +- .../demo/Polyhedron/Scene_polylines_item.cpp | 2 +- .../Polyhedron/Scene_surface_mesh_item.cpp | 18 +-- .../Scene_textured_surface_mesh_item.cpp | 3 +- .../Polyhedron/Scene_triangulation_3_item.cpp | 3 +- Polyhedron/demo/Polyhedron/TextRenderer.cpp | 8 +- Polyhedron/demo/Polyhedron/Three.cpp | 7 +- Polyhedron/demo/Polyhedron/Viewer.cpp | 4 +- 69 files changed, 296 insertions(+), 303 deletions(-) diff --git a/Polyhedron/demo/Polyhedron/MainWindow.cpp b/Polyhedron/demo/Polyhedron/MainWindow.cpp index 1714b547af9..24455668188 100644 --- a/Polyhedron/demo/Polyhedron/MainWindow.cpp +++ b/Polyhedron/demo/Polyhedron/MainWindow.cpp @@ -317,7 +317,7 @@ MainWindow::MainWindow(const QStringList &keywords, bool verbose, QWidget* paren accepted_keywords.clear(); // Setup the submenu of the View menu that can toggle the dockwidgets - Q_FOREACH(QDockWidget* widget, findChildren()) { + for(QDockWidget* widget : findChildren()) { widget->setFeatures(QDockWidget::DockWidgetClosable | QDockWidget::DockWidgetFloatable); ui->menuDockWindows->addAction(widget->toggleViewAction()); } @@ -342,7 +342,7 @@ MainWindow::MainWindow(const QStringList &keywords, bool verbose, QWidget* paren actionResetDefaultLoaders = new QAction("Reset Default Loaders",this); // evaluate_script("print(plugins);"); - Q_FOREACH(QAction* action, findChildren()) { + for(QAction* action : findChildren()) { if(action->objectName() != "") { QJSValue objectValue = script_engine->newQObject(action); script_engine->globalObject().setProperty(action->objectName(), @@ -372,11 +372,11 @@ void addActionToMenu(QAction* action, QMenu* menu) void filterMenuOperations(QMenu* menu, QString filter, bool keep_from_here) { QList buffer; - Q_FOREACH(QAction* action, menu->actions()) + for(QAction* action : menu->actions()) buffer.append(action); while(!buffer.isEmpty()){ - Q_FOREACH(QAction* action, buffer) { + for(QAction* action : buffer) { if(QMenu* submenu = action->menu()) { bool keep = true; @@ -384,7 +384,7 @@ void filterMenuOperations(QMenu* menu, QString filter, bool keep_from_here) keep = submenu->menuAction()->text().contains(filter, Qt::CaseInsensitive); if(!keep) { - Q_FOREACH(QAction* subaction, submenu->actions()) + for(QAction* subaction : submenu->actions()) { submenu->removeAction(subaction); buffer.append(subaction); @@ -421,23 +421,23 @@ void MainWindow::filterOperations(bool) ui->menuOperations->hide(); #endif //return actions to their true menu - Q_FOREACH(QMenu* menu, action_menu_map.values()) + for(QMenu* menu : action_menu_map.values()) { - Q_FOREACH(QAction* action, menu->actions()) + for(QAction* action : menu->actions()) { if(action != searchAction) menu->removeAction(action); } } - Q_FOREACH(QAction* action, action_menu_map.keys()) + for(QAction* action : action_menu_map.keys()) { QMenu* menu = action_menu_map[action]; addActionToMenu(action, menu); } QString filter=operationSearchBar.text(); - Q_FOREACH(const PluginNamePair& p, plugins) { - Q_FOREACH(QAction* action, p.first->actions()) { + for(const PluginNamePair& p : plugins) { + for(QAction* action : p.first->actions()) { action->setVisible( p.first->applicable(action) && (action->text().remove("&").contains(filter, Qt::CaseInsensitive) || action->property("subMenuName") @@ -579,7 +579,7 @@ bool MainWindow::load_plugin(QString fileName, bool blacklisted) bool do_load = accepted_keywords.empty(); if(!do_load) { - Q_FOREACH(QString k, s_keywords) + for(QString k : s_keywords) { if(accepted_keywords.contains(k)) { @@ -621,7 +621,7 @@ bool MainWindow::load_plugin(QString fileName, bool blacklisted) void MainWindow::loadPlugins() { - Q_FOREACH(QObject *obj, QPluginLoader::staticInstances()) + for(QObject *obj : QPluginLoader::staticInstances()) { initPlugin(obj); initIOPlugin(obj); @@ -637,7 +637,7 @@ void MainWindow::loadPlugins() QFileInfoList filist = QDir(dirPath).entryInfoList(); filist << msvc_dir.entryInfoList(); - Q_FOREACH(QFileInfo fileinfo, filist) + for(QFileInfo fileinfo : filist) { //checks if the path leads to a directory if(fileinfo.baseName().contains("Plugins")) @@ -645,7 +645,7 @@ void MainWindow::loadPlugins() QString plugins_dir = fileinfo.absolutePath(); plugins_dir.append("/").append(fileinfo.baseName()); - Q_FOREACH(QString package_dir, + for(QString package_dir : QDir(plugins_dir).entryList(QDir::Dirs)) { QString package_dir_path(plugins_dir); @@ -677,7 +677,7 @@ void MainWindow::loadPlugins() QByteArray new_path = path.append(env_path.prepend(separator)).toUtf8(); qputenv("PATH", new_path); #endif - Q_FOREACH (QString pluginsDir, + for (QString pluginsDir : env_path.split(separator, CGAL_QT_SKIP_EMPTY_PARTS)) { QDir dir(pluginsDir); if(dir.isReadable()) @@ -686,11 +686,11 @@ void MainWindow::loadPlugins() } QSet loaded; - Q_FOREACH (QDir pluginsDir, plugins_directories) { + for (QDir pluginsDir : plugins_directories) { if(verbose) qDebug("# Looking for plugins in directory \"%s\"...", qPrintable(pluginsDir.absolutePath())); - Q_FOREACH(QString fileName, pluginsDir.entryList(QDir::Files)) + for(QString fileName : pluginsDir.entryList(QDir::Files)) { QString abs_name = pluginsDir.absoluteFilePath(fileName); if(loaded.find(abs_name) == loaded.end()) @@ -708,7 +708,7 @@ void MainWindow::loadPlugins() void MainWindow::updateMenus() { QList as = ui->menuOperations->actions(); - Q_FOREACH(QAction* a, as) + for(QAction* a : as) { QString menuPath = a->property("subMenuName").toString(); setMenus(menuPath, ui->menuOperations->title(), a); @@ -724,7 +724,7 @@ void MainWindow::updateMenus() bool MainWindow::hasPlugin(const QString& pluginName) const { - Q_FOREACH(const PluginNamePair& p, plugins) { + for(const PluginNamePair& p : plugins) { if(p.second == pluginName) return true; } return false; @@ -741,7 +741,7 @@ bool MainWindow::initPlugin(QObject* obj) plugin->init(this, this->scene, this); plugins << qMakePair(plugin, obj->objectName()); - Q_FOREACH(QAction* action, plugin->actions()) { + for(QAction* action : plugin->actions()) { // If action does not belong to the menus, add it to "Operations" menu if(!childs.contains(action)) { ui->menuOperations->addAction(action); @@ -771,7 +771,7 @@ bool MainWindow::initIOPlugin(QObject* obj) void MainWindow::clearMenu(QMenu* menu) { - Q_FOREACH(QAction* action, menu->actions()) + for(QAction* action : menu->actions()) { QMenu* menu = action->menu(); if(menu) { @@ -805,7 +805,7 @@ void MainWindow::addAction(QString actionName, QString actionText, QString menuName) { QMenu* menu = nullptr; - Q_FOREACH(QAction* action, findChildren()) { + for(QAction* action : findChildren()) { if(!action->menu()) continue; QString menuText = action->menu()->title(); if(menuText != menuName) continue; @@ -894,7 +894,7 @@ void MainWindow::updateViewersBboxes(bool recenter) { CGAL::qglviewer::Vec min, max; computeViewerBBox(min, max); - Q_FOREACH(CGAL::QGLViewer* v, CGAL::QGLViewer::QGLViewerPool()) + for(CGAL::QGLViewer* v : CGAL::QGLViewer::QGLViewerPool()) { if(v == nullptr) continue; @@ -939,7 +939,7 @@ void MainWindow::computeViewerBBox(CGAL::qglviewer::Vec& vmin, CGAL::qglviewer:: } if(offset != viewer->offset()) { - Q_FOREACH(CGAL::QGLViewer* v, CGAL::QGLViewer::QGLViewerPool()) + for(CGAL::QGLViewer* v : CGAL::QGLViewer::QGLViewerPool()) { if(v == nullptr) continue; @@ -959,7 +959,7 @@ void MainWindow::reloadItem() { Scene_item* item = nullptr; - Q_FOREACH(Scene::Item_id id, scene->selectionIndices()) + for(Scene::Item_id id : scene->selectionIndices()) { item = scene->item(id); if(!item)//secure items like selection items that get deleted when their "parent" item is reloaded. @@ -1017,7 +1017,7 @@ void MainWindow::reloadItem() { } CGAL::Three::Polyhedron_demo_io_plugin_interface* MainWindow::findLoader(const QString& loader_name) const { - Q_FOREACH(CGAL::Three::Polyhedron_demo_io_plugin_interface* io_plugin, + for(CGAL::Three::Polyhedron_demo_io_plugin_interface* io_plugin : io_plugins) { if(io_plugin->name() == loader_name) { return io_plugin; @@ -1037,7 +1037,7 @@ bool MainWindow::file_matches_filter(const QString& filters, QRegularExpression all_filters_rx("\\((.*)\\)"); QStringList split_filters = filters.split(";;"); - Q_FOREACH(const QString& filter, split_filters) { + for(const QString& filter : split_filters) { QRegularExpressionMatch match = all_filters_rx.match(filter); if(match.hasMatch()){ for (const QString& pattern : match.captured(1).split(' ')) { @@ -1322,7 +1322,7 @@ QList MainWindow::getSelectedSceneItemIndices() const { QModelIndexList selectedIndices = sceneView->selectionModel()->selectedIndexes(); QList result; - Q_FOREACH(QModelIndex index, selectedIndices) { + for(QModelIndex index : selectedIndices) { int temp = scene->getIdFromModelIndex(proxyModel->mapToSource(index)); if(!result.contains(temp)) result<setSelectedItemIndex(getSelectedSceneItemIndex()); scene->setSelectedItemIndices(getSelectedSceneItemIndices()); CGAL::Three::Scene_item* item = scene->item(getSelectedSceneItemIndex()); - Q_FOREACH(CGAL::QGLViewer* vi, CGAL::QGLViewer::QGLViewerPool()) + for(CGAL::QGLViewer* vi : CGAL::QGLViewer::QGLViewerPool()) { if(vi == nullptr) continue; @@ -1346,7 +1346,7 @@ void MainWindow::selectionChanged() vi->setManipulatedFrame(nullptr); } if(vi->manipulatedFrame() == nullptr) { - Q_FOREACH(CGAL::Three::Scene_item* item, scene->entries()) { + for(CGAL::Three::Scene_item* item : scene->entries()) { if(item->manipulatable() && item->manipulatedFrame() != nullptr) { if(vi->manipulatedFrame() != nullptr) { // there are at least two possible frames @@ -1444,7 +1444,7 @@ void MainWindow::showSceneContextMenu(const QPoint& p) { QVector slider_menus; bool has_stats = false; bool has_reload = false; - Q_FOREACH(Scene::Item_id id, scene->selectionIndices()) + for(Scene::Item_id id : scene->selectionIndices()) { if(!scene->item(id)->property("source filename").toString().isEmpty()) { @@ -1452,7 +1452,7 @@ void MainWindow::showSceneContextMenu(const QPoint& p) { break; } } - Q_FOREACH(QAction* action, scene->item(main_index)->contextMenu()->actions()) + for(QAction* action : scene->item(main_index)->contextMenu()->actions()) { if(action->property("is_groupable").toBool()) { @@ -1476,7 +1476,7 @@ void MainWindow::showSceneContextMenu(const QPoint& p) { } } - Q_FOREACH(Scene::Item_id index, scene->selectionIndices()) + for(Scene::Item_id index : scene->selectionIndices()) { if(index == main_index) continue; @@ -1490,7 +1490,7 @@ void MainWindow::showSceneContextMenu(const QPoint& p) { QMenu menu; menu.addAction(actionAddToGroup); menu.insertSeparator(nullptr); - Q_FOREACH(QString name, menu_actions.keys()) + for(QString name : menu_actions.keys()) { if(name == QString("alpha slider") || name == QString("points slider") @@ -1512,10 +1512,10 @@ void MainWindow::showSceneContextMenu(const QPoint& p) { connect(slider, &QSlider::valueChanged, [this, slider]() { - Q_FOREACH(Scene::Item_id id, scene->selectionIndices()) + for(Scene::Item_id id : scene->selectionIndices()) { Scene_item* item = scene->item(id); - Q_FOREACH(QAction* action, item->contextMenu()->actions()) + for(QAction* action : item->contextMenu()->actions()) { if(action->text() == "Alpha value") { @@ -1547,10 +1547,10 @@ void MainWindow::showSceneContextMenu(const QPoint& p) { connect(slider, &QSlider::valueChanged, [this, slider]() { - Q_FOREACH(Scene::Item_id id, scene->selectionIndices()) + for(Scene::Item_id id : scene->selectionIndices()) { Scene_item* item = scene->item(id); - Q_FOREACH(QAction* action, item->contextMenu()->actions()) + for(QAction* action : item->contextMenu()->actions()) { if(action->text() == "Points Size") { @@ -1582,10 +1582,10 @@ void MainWindow::showSceneContextMenu(const QPoint& p) { connect(slider, &QSlider::valueChanged, [this, slider]() { - Q_FOREACH(Scene::Item_id id, scene->selectionIndices()) + for(Scene::Item_id id : scene->selectionIndices()) { Scene_item* item = scene->item(id); - Q_FOREACH(QAction* action, item->contextMenu()->actions()) + for(QAction* action : item->contextMenu()->actions()) { if(action->text() == "Normals Length") { @@ -1625,10 +1625,10 @@ void MainWindow::showSceneContextMenu(const QPoint& p) { connect(slider, &QSlider::valueChanged, [this, slider]() { - Q_FOREACH(Scene::Item_id id, scene->selectionIndices()) + for(Scene::Item_id id : scene->selectionIndices()) { Scene_item* item = scene->item(id); - Q_FOREACH(QAction* action, item->contextMenu()->actions()) + for(QAction* action : item->contextMenu()->actions()) { if(action->text() == "Line Width") { @@ -1652,7 +1652,7 @@ void MainWindow::showSceneContextMenu(const QPoint& p) { } if(!slider_menus.empty()) { - Q_FOREACH(QMenu* m, slider_menus){ + for(QMenu* m : slider_menus){ menu.addMenu(m); } menu.insertSeparator(nullptr); @@ -1744,7 +1744,7 @@ void MainWindow::readSettings() settings.value("default_ps_rm", "points").toString()); // read plugin blacklist QStringList blacklist=settings.value("plugin_blacklist",QStringList()).toStringList(); - Q_FOREACH(QString name,blacklist){ plugin_blacklist.insert(name); } + for(QString name :blacklist){ plugin_blacklist.insert(name); } def_save_dir = settings.value("default_saveas_dir", QDir::homePath()).toString(); this->default_point_size = settings.value("points_size").toInt(); this->default_normal_length = settings.value("normals_length").toInt(); @@ -1758,7 +1758,7 @@ void MainWindow::writeSettings() { //setting plugin blacklist QStringList blacklist; - Q_FOREACH(QString name,plugin_blacklist){ blacklist << name; } + for(QString name :plugin_blacklist){ blacklist << name; } if ( !blacklist.isEmpty() ) settings.setValue("plugin_blacklist",blacklist); else settings.remove("plugin_blacklist"); } @@ -1838,7 +1838,7 @@ void MainWindow::on_actionLoad_triggered() for(CGAL::Three::Polyhedron_demo_io_plugin_interface* plugin : io_plugins) { QStringList split_filters = plugin->loadNameFilters().split(";;"); - Q_FOREACH(const QString& filter, split_filters) { + for(const QString& filter : split_filters) { FilterPluginMap::iterator it = filterPluginMap.find(filter); if(it != filterPluginMap.end()) { if(verbose) @@ -1881,7 +1881,7 @@ void MainWindow::on_actionLoad_triggered() std::back_inserter(colors_)); std::size_t nb_item = -1; - Q_FOREACH(const QString& filename, dialog.selectedFiles()) { + for(const QString& filename : dialog.selectedFiles()) { CGAL::Three::Scene_item* item = nullptr; if(selectedPlugin) { @@ -2002,9 +2002,9 @@ void MainWindow::on_actionSaveAs_triggered() filename_ext.push_front("."); QStringList final_extensions; - Q_FOREACH(QString string, filter_exts) + for(QString string : filter_exts) { - Q_FOREACH(QString s, string.split(" ")){// in case of syntax like (*.a *.b) + for(QString s : string.split(" ")){// in case of syntax like (*.a *.b) s.remove(")"); s.remove("("); //remove * @@ -2099,7 +2099,7 @@ void MainWindow::on_actionDuplicate_triggered() void MainWindow::on_actionShowHide_triggered() { scene->setUpdatesEnabled(false); - Q_FOREACH(QModelIndex index, sceneView->selectionModel()->selectedRows()) + for(QModelIndex index : sceneView->selectionModel()->selectedRows()) { int i = scene->getIdFromModelIndex(proxyModel->mapToSource(index)); CGAL::Three::Scene_item* item = scene->item(i); @@ -2216,7 +2216,7 @@ void MainWindow::on_actionPreferences_triggered() ignoredBrush(Qt::lightGray); //add blacklisted plugins - Q_FOREACH (QString name, PathNames_map.keys()) + for (QString name : PathNames_map.keys()) { QTreeWidgetItem *item = new QTreeWidgetItem(prefdiag.treeWidget); item->setText(1, name); @@ -2245,7 +2245,7 @@ void MainWindow::on_actionPreferences_triggered() detdiag.setupUi(&dialog); QTreeWidgetItem *header = new QTreeWidgetItem(titles); detdiag.treeWidget->setHeaderItem(header); - Q_FOREACH(QTreeWidgetItem* plugin_item, prefdiag.treeWidget->selectedItems()) + for(QTreeWidgetItem* plugin_item : prefdiag.treeWidget->selectedItems()) { QString name = plugin_item->text(1); QString keywords = plugin_metadata_map[name].first.join(", "); @@ -2379,7 +2379,7 @@ void MainWindow::setBackgroundColor() { QColor c = QColorDialog::getColor(); if(c.isValid()) { - Q_FOREACH(CGAL::QGLViewer* v, CGAL::QGLViewer::QGLViewerPool()) + for(CGAL::QGLViewer* v : CGAL::QGLViewer::QGLViewerPool()) { if(v == nullptr) continue; @@ -2456,7 +2456,7 @@ void MainWindow::on_actionLoadPlugin_triggered() this, tr("Select the directory containing your plugins:"), ".",filters); - Q_FOREACH(QString name, paths) + for(QString name : paths) load_plugin(name, false); updateMenus(); @@ -2549,7 +2549,7 @@ QString MainWindow::get_item_stats() { //1st step : get all classnames of the selected items QList classnames; - Q_FOREACH(int id, scene->selectionIndices()) + for(int id : scene->selectionIndices()) { Scene_item* item = scene->item(id); QString classname = item->property("classname").toString(); @@ -2561,7 +2561,7 @@ QString MainWindow::get_item_stats() //2nd step : separate the selection in lists corresponding to their classname QVector< QList > items; items.resize(classnames.size()); - Q_FOREACH(int id, scene->selectionIndices()) + for(int id : scene->selectionIndices()) { Scene_item* s_item = scene->item(id); for(int i=0; i """); - Q_FOREACH(Scene_item* sit, items[i]) + for(Scene_item* sit : items[i]) { str.append(QString("").arg(sit->name())); } @@ -2602,7 +2602,7 @@ QString MainWindow::get_item_stats() .arg(data.categories[j].first)); titles_limit+=data.categories[j].second; str.append(QString("").arg(data.titles.at(title))); - Q_FOREACH(Scene_item* sit, items[i]) + for(Scene_item* sit : items[i]) { str.append(QString("").arg(sit->computeStats(title))); } @@ -2610,7 +2610,7 @@ QString MainWindow::get_item_stats() for(;title").arg(data.titles.at(title))); - Q_FOREACH(Scene_item* sit, items[i]) + for(Scene_item* sit : items[i]) { str.append(QString("").arg(sit->computeStats(title))); } @@ -2703,7 +2703,7 @@ void MainWindow::colorItems() std::back_inserter(colors_)); std::size_t nb_item = -1; - Q_FOREACH(int id, scene->selectionIndices()) + for(int id : scene->selectionIndices()) { scene->item(id)->setColor(colors_[++nb_item]); } @@ -2715,7 +2715,7 @@ void MainWindow::colorItems() void MainWindow::exportStatistics() { std::vector items; - Q_FOREACH(int id, getSelectedSceneItemIndices()) + for(int id : getSelectedSceneItemIndices()) { Scene_item* s_item = scene->item(id); items.push_back(s_item); @@ -2767,10 +2767,10 @@ void MainWindow::propagate_action() QAction* sender = qobject_cast(this->sender()); if(!sender) return; QString name = sender->text(); - Q_FOREACH(Scene::Item_id id, scene->selectionIndices()) + for(Scene::Item_id id : scene->selectionIndices()) { Scene_item* item = scene->item(id); - Q_FOREACH(QAction* action, item->contextMenu()->actions()) + for(QAction* action : item->contextMenu()->actions()) { if(action->text() == name) { @@ -3163,7 +3163,7 @@ void MainWindow::toggleFullScreen() QList dockWidgets = findChildren(); if(visibleDockWidgets.isEmpty()) { - Q_FOREACH(QDockWidget * dock, dockWidgets) + for(QDockWidget * dock : dockWidgets) { if(dock->isVisible()) { @@ -3174,7 +3174,7 @@ void MainWindow::toggleFullScreen() } else { - Q_FOREACH(QDockWidget * dock, visibleDockWidgets){ + for(QDockWidget * dock : visibleDockWidgets){ dock->show(); } visibleDockWidgets.clear(); @@ -3538,7 +3538,7 @@ void SubViewer::changeEvent(QEvent *event) if(isMaximized()) { QMenu* menu = mw->findChild("menuView"); - Q_FOREACH(QAction* action, viewMenu->actions()) + for(QAction* action : viewMenu->actions()) { menu->addAction(action); } @@ -3556,7 +3556,7 @@ void SubViewer::changeEvent(QEvent *event) else { QMenu* menu = mw->findChild("menuView"); - Q_FOREACH(QAction* action, viewMenu->actions()) + for(QAction* action : viewMenu->actions()) { menu->removeAction(action); } @@ -3605,10 +3605,10 @@ void MainWindow::test_all_actions() { int nb_items = scene->numberOfEntries(); selectSceneItem(0); - Q_FOREACH(PluginNamePair pnp, plugins) + for(PluginNamePair pnp : plugins) { Polyhedron_demo_plugin_interface* plugin = pnp.first; - Q_FOREACH(QAction* action, plugin->actions()){ + for(QAction* action : plugin->actions()){ if(plugin->applicable(action)){ qDebug()<<"Testing "<text()<<" on"; qDebug()<item(scene->mainSelectionIndex())->name()<<"..."; diff --git a/Polyhedron/demo/Polyhedron/Plugins/AABB_tree/Cut_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/AABB_tree/Cut_plugin.cpp index f72ebe5a7bd..2d02ea43c88 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/AABB_tree/Cut_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/AABB_tree/Cut_plugin.cpp @@ -398,7 +398,7 @@ private: FT diag = scene_diag(); std::vector closed_sm_trees; - Q_FOREACH(SM_Tree *sm_tree, sm_trees->values()) + for(SM_Tree *sm_tree : sm_trees->values()) if(!(is_signed && !CGAL::is_closed(*qobject_cast(sm_trees->key(sm_tree))->polyhedron()))) closed_sm_trees.push_back(sm_tree); #ifndef CGAL_LINKED_WITH_TBB @@ -1063,7 +1063,7 @@ public Q_SLOTS: } void uncheckActions() { - Q_FOREACH(QAction* action, _actions) + for(QAction* action : _actions) if(action->isChecked()) { action->setChecked(false); @@ -1129,11 +1129,11 @@ private: Polyhedron_demo_cut_plugin::~Polyhedron_demo_cut_plugin() { - Q_FOREACH(Facet_sm_tree *tree, facet_sm_trees.values()) + for(Facet_sm_tree *tree : facet_sm_trees.values()) { delete tree; } - Q_FOREACH(Edge_sm_tree *tree, edge_sm_trees.values()) + for(Edge_sm_tree *tree : edge_sm_trees.values()) { delete tree; } @@ -1182,7 +1182,7 @@ void Polyhedron_demo_cut_plugin::init(QMainWindow* mainWindow, QActionGroup *group = new QActionGroup(mainWindow); group->setExclusive(true); - Q_FOREACH(QAction *action, _actions) + for(QAction *action : _actions) { action->setActionGroup(group); action->setCheckable(true); diff --git a/Polyhedron/demo/Polyhedron/Plugins/AABB_tree/Do_trees_intersect_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/AABB_tree/Do_trees_intersect_plugin.cpp index 5f9eeed5838..979453ec2af 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/AABB_tree/Do_trees_intersect_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/AABB_tree/Do_trees_intersect_plugin.cpp @@ -42,7 +42,7 @@ public: { if(scene->selectionIndices().size() <2) return false; - Q_FOREACH(Scene::Item_id i, scene->selectionIndices()) + for(Scene::Item_id i : scene->selectionIndices()) { if(! qobject_cast(scene->item(i))) return false; @@ -76,7 +76,7 @@ private Q_SLOTS: void start() { QApplication::setOverrideCursor(Qt::WaitCursor); - Q_FOREACH(Scene::Item_id i, scene->selectionIndices()) + for(Scene::Item_id i : scene->selectionIndices()) { Scene_surface_mesh_item* item=qobject_cast(scene->item(i)); if (!CGAL::is_triangle_mesh(*item->face_graph())) @@ -96,7 +96,7 @@ private Q_SLOTS: group_item = nullptr;}); scene->addItem(group_item); - Q_FOREACH(Scene::Item_id i, scene->selectionIndices()) + for(Scene::Item_id i : scene->selectionIndices()) { Scene_surface_mesh_item* item=qobject_cast(scene->item(i)); connect(item, &Scene_surface_mesh_item::aboutToBeDestroyed, @@ -147,7 +147,7 @@ public Q_SLOTS: { if(items.empty()) return; - Q_FOREACH(Scene_movable_sm_item* item, items) + for(Scene_movable_sm_item* item : items) item->setColor(QColor(Qt::green)); CGAL::Three::Viewer_interface* viewer = static_cast( @@ -158,7 +158,7 @@ public Q_SLOTS: std::size_t mesh_id = 0; std::size_t sel_id = 0; - Q_FOREACH(Scene_movable_sm_item* item, items) + for(Scene_movable_sm_item* item : items) { if(item == sel_item) { @@ -168,7 +168,7 @@ public Q_SLOTS: ++mesh_id; } mesh_id = 0; - Q_FOREACH(Scene_movable_sm_item* item, items) + for(Scene_movable_sm_item* item : items) { if(mesh_id == sel_id) { @@ -251,7 +251,7 @@ public Q_SLOTS: std::size_t mesh_id = 0; std::size_t sel_id = 0; - Q_FOREACH(Scene_movable_sm_item* item, items) + for(Scene_movable_sm_item* item : items) { if(item == sel_item) { diff --git a/Polyhedron/demo/Polyhedron/Plugins/Alpha_wrap_3/Alpha_wrap_3_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/Alpha_wrap_3/Alpha_wrap_3_plugin.cpp index a1b29fd5689..563885a376c 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Alpha_wrap_3/Alpha_wrap_3_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/Alpha_wrap_3/Alpha_wrap_3_plugin.cpp @@ -359,7 +359,7 @@ public: if(scene->selectionIndices().empty()) return false; - Q_FOREACH(int index, scene->selectionIndices()) + for(int index : scene->selectionIndices()) { if(!qobject_cast(scene->item(index)) && !qobject_cast(scene->item(index)) && @@ -540,7 +540,7 @@ public Q_SLOTS: Segments segments; Points points; - Q_FOREACH(int index, this->scene->selectionIndices()) + for(int index : this->scene->selectionIndices()) { // --- Scene_surface_mesh_item* sm_item = qobject_cast(this->scene->item(index)); @@ -765,7 +765,7 @@ public Q_SLOTS: QApplication::restoreOverrideCursor(); QApplication::setOverrideCursor(Qt::BusyCursor); - Q_FOREACH(int index, this->scene->selectionIndices()) + for(int index : this->scene->selectionIndices()) { Scene_surface_mesh_item* sm_item = qobject_cast(this->scene->item(index)); if(sm_item != nullptr) diff --git a/Polyhedron/demo/Polyhedron/Plugins/Camera_position/Camera_positions_list.cpp b/Polyhedron/demo/Polyhedron/Plugins/Camera_position/Camera_positions_list.cpp index c015e8f495c..016aaa796ad 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Camera_position/Camera_positions_list.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/Camera_position/Camera_positions_list.cpp @@ -64,7 +64,7 @@ void Camera_positions_list::on_downButton_pressed() void Camera_positions_list::on_minusButton_pressed() { - Q_FOREACH(QModelIndex index, + for(QModelIndex index : m_listView->selectionModel()->selectedIndexes()) { m_model->removeRows(index.row(), 1); } diff --git a/Polyhedron/demo/Polyhedron/Plugins/Convex_decomposition/Nef_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/Convex_decomposition/Nef_plugin.cpp index 73d7a944d06..c5b7a5c04c8 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Convex_decomposition/Nef_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/Convex_decomposition/Nef_plugin.cpp @@ -52,7 +52,7 @@ void init(QMainWindow* mw, << actionIntersection << actionDifference << actionMinkowskiSum; - Q_FOREACH(QAction * action, _actions) + for(QAction * action : _actions) action->setProperty("subMenuName", "Boolean Operations"); _actions<< actionConvexDecomposition; diff --git a/Polyhedron/demo/Polyhedron/Plugins/IO/Implicit_function_io_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/IO/Implicit_function_io_plugin.cpp index 7159c3c3839..628362efd0b 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/IO/Implicit_function_io_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/IO/Implicit_function_io_plugin.cpp @@ -118,7 +118,7 @@ load_function() const // Add loaded functions to the dialog int i=0; - Q_FOREACH( Implicit_function_interface* f, functions_ ) + for( Implicit_function_interface* f : functions_ ) { ui.functionList->insertItem(i++,f->name()); } @@ -159,7 +159,7 @@ load_function_plugins() if( !pluginsDir.cd(newDir) ) return; } - Q_FOREACH (QString fileName, pluginsDir.entryList(QDir::Files)) + for (QString fileName : pluginsDir.entryList(QDir::Files)) { if ( fileName.contains("plugin") && QLibrary::isLibrary(fileName) ) { diff --git a/Polyhedron/demo/Polyhedron/Plugins/IO/Polylines_io_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/IO/Polylines_io_plugin.cpp index 2f61bd32aa8..3573ec548f3 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/IO/Polylines_io_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/IO/Polylines_io_plugin.cpp @@ -73,7 +73,7 @@ public: return qobject_cast(scene->item( scene->mainSelectionIndex())); bool all_polylines_selected = true; - Q_FOREACH(int index, scene->selectionIndices()) + for(int index : scene->selectionIndices()) { if (!qobject_cast(scene->item(index))) { diff --git a/Polyhedron/demo/Polyhedron/Plugins/Mesh_2/Mesh_2_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/Mesh_2/Mesh_2_plugin.cpp index f289245a996..6c9e1f0a8f4 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Mesh_2/Mesh_2_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/Mesh_2/Mesh_2_plugin.cpp @@ -169,7 +169,7 @@ public: bool applicable(QAction*) const { - Q_FOREACH(int index, scene->selectionIndices()) + for(int index : scene->selectionIndices()) { //if one polyhedron is found in the selection, it's fine if (qobject_cast(scene->item(index))) @@ -229,8 +229,8 @@ private: { // extract seeds std::vector seeds; - Q_FOREACH(Scene_points_with_normal_item* points_item, points_items) - Q_FOREACH(Point_set_3::Index it, *points_item->point_set()) + for(Scene_points_with_normal_item* points_item : points_items) + for(Point_set_3::Index it : *points_item->point_set()) seeds.push_back(points_item->point_set()->point(it)); // Create dialog box @@ -275,8 +275,8 @@ private: double constant_coordinate = polylines_items.back()->polylines.back().back()[constant_coordinate_index]; try{ - Q_FOREACH(Scene_polylines_item* polylines_item, polylines_items) - Q_FOREACH(const std::vector& points, + for(Scene_polylines_item* polylines_item : polylines_items) + for(const std::vector& points : polylines_item->polylines) cdt.insert_constraint(points.begin(),points.end()); }catch(std::runtime_error&) @@ -357,10 +357,10 @@ private: { int res=-1; Kernel::Point_3 ref = polylines_items.front()->polylines.front().front(); - Q_FOREACH(Scene_polylines_item* polylines_item, polylines_items) - Q_FOREACH(const std::vector& points, + for(Scene_polylines_item* polylines_item : polylines_items) + for(const std::vector& points : polylines_item->polylines) - Q_FOREACH(const Kernel::Point_3& pt, points) + for(const Kernel::Point_3& pt : points) { int nbe=0, candidate=-1; for (int i=0; i<3; ++i) @@ -377,8 +377,8 @@ private: } } if (res==-1) return res; - Q_FOREACH(Scene_points_with_normal_item* points_item, points_items) - Q_FOREACH(Point_set_3::Index pt, *points_item->point_set()) + for(Scene_points_with_normal_item* points_item : points_items) + for(Point_set_3::Index pt : *points_item->point_set()) if (points_item->point_set()->point(pt)[res]!=ref[res]) return -1; return res; @@ -394,7 +394,7 @@ public Q_SLOTS: std::vector points_items; double inf = std::numeric_limits::infinity(); CGAL::Three::Scene_interface::Bbox bbox(inf,inf,inf,-inf,-inf,-inf); - Q_FOREACH(int index, scene->selectionIndices()) + for(int index : scene->selectionIndices()) { Scene_polylines_item* polylines_item = qobject_cast(scene->item(index)); diff --git a/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Io_image_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Io_image_plugin.cpp index ca542e80e26..27a258882ba 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Io_image_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Io_image_plugin.cpp @@ -313,7 +313,7 @@ public: // Look for action just after "Load..." action QAction* actionAfterLoad = nullptr; for(QList::iterator it_action = menuFileActions.begin(), - end = menuFileActions.end() ; it_action != end ; ++ it_action ) //Q_FOREACH( QAction* action, menuFileActions) + end = menuFileActions.end() ; it_action != end ; ++ it_action ) //for( QAction* action : menuFileActions) { if(NULL != *it_action && (*it_action)->text().contains("Load...")) { @@ -594,7 +594,7 @@ public Q_SLOTS: void connectNewViewer(QObject* o) { - Q_FOREACH(Controls c, group_map.values()) + for(Controls c : group_map.values()) { o->installEventFilter(c.x_item); o->installEventFilter(c.y_item); @@ -827,7 +827,7 @@ private: x_item->setColor(QColor("red")); y_item->setColor(QColor("green")); z_item->setColor(QColor("blue")); - Q_FOREACH(CGAL::QGLViewer* viewer, CGAL::QGLViewer::QGLViewerPool()) + for(CGAL::QGLViewer* viewer : CGAL::QGLViewer::QGLViewerPool()) { viewer->installEventFilter(x_item); viewer->installEventFilter(y_item); @@ -927,7 +927,7 @@ private Q_SLOTS: CGAL::Three::Scene_group_item* group_item = qobject_cast(sender()); if(group_item) { - Q_FOREACH(CGAL::Three::Scene_item* key, group_map.keys()) + for(CGAL::Three::Scene_item* key : group_map.keys()) { if(group_map[key].group == group_item) { @@ -966,7 +966,7 @@ private Q_SLOTS: group_map.remove(img_item); QList deletion; - Q_FOREACH(Scene_interface::Item_id id, group->getChildren()) + for(Scene_interface::Item_id id : group->getChildren()) { Scene_item* child = group->getChild(id); group->unlockChild(child); diff --git a/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Io_implicit_function_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Io_implicit_function_plugin.cpp index 16bffeffa22..7f31055cf59 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Io_implicit_function_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Io_implicit_function_plugin.cpp @@ -104,7 +104,7 @@ init(QMainWindow* mainWindow, CGAL::Three::Scene_interface* scene_interface, Mes // Look for action just after "Load..." action QAction* actionAfterLoad = NULL; for ( QList::iterator it_action = menuFileActions.begin(), - end = menuFileActions.end() ; it_action != end ; ++ it_action ) //Q_FOREACH( QAction* action, menuFileActions) + end = menuFileActions.end() ; it_action != end ; ++ it_action ) //for( QAction* action : menuFileActions) { if ( NULL != *it_action && (*it_action)->text().contains("Load") ) { @@ -139,7 +139,7 @@ load_function() const // Add loaded functions to the dialog int i=0; - Q_FOREACH( Implicit_function_interface* f, functions_ ) + for( Implicit_function_interface* f : functions_ ) { ui.functionList->insertItem(i++,f->name()); } @@ -180,7 +180,7 @@ load_function_plugins() if( !pluginsDir.cd(newDir) ) return; } - Q_FOREACH (QString fileName, pluginsDir.entryList(QDir::Files)) + for (QString fileName : pluginsDir.entryList(QDir::Files)) { if ( fileName.contains("plugin") && QLibrary::isLibrary(fileName) ) { diff --git a/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Mesh_3_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Mesh_3_plugin.cpp index a146afb007a..f490c0da691 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Mesh_3_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Mesh_3_plugin.cpp @@ -992,7 +992,7 @@ meshing_done(Meshing_thread* thread) .arg(source_item_name_) .arg(thread->time()); - Q_FOREACH( QString param, thread->parameters_log() ) + for( QString param : thread->parameters_log() ) { str.append(QString("( %1 )
").arg(param)); } @@ -1042,7 +1042,7 @@ treat_result(Scene_item& source_item, result_item->setRenderingMode(source_item.renderingMode()); result_item->set_data_item(&source_item); - Q_FOREACH(int ind, scene->selectionIndices()) { + for(int ind : scene->selectionIndices()) { scene->item(ind)->setVisible(false); } const Scene_interface::Item_id index = scene->mainSelectionIndex(); @@ -1056,7 +1056,7 @@ treat_result(Scene_item& source_item, Scene_surface_mesh_item* new_item = new Scene_surface_mesh_item; CGAL::facets_in_complex_3_to_triangle_mesh(result_item->c3t3(), *new_item->face_graph()); new_item->setName(tr("%1 [Remeshed]").arg(source_item_name_)); - Q_FOREACH(int ind, scene->selectionIndices()) { + for(int ind : scene->selectionIndices()) { scene->item(ind)->setVisible(false); } const Scene_interface::Item_id index = scene->mainSelectionIndex(); diff --git a/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Offset_meshing_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Offset_meshing_plugin.cpp index 8b0e0bab57b..d4a5dc15ffb 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Offset_meshing_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Offset_meshing_plugin.cpp @@ -512,7 +512,7 @@ offset_meshing() Scene_polylines_item* polylines_item = nullptr; bool mesh_or_soup_item_found = false; - Q_FOREACH(Scene_interface::Item_id index, scene->selectionIndices()) + for(Scene_interface::Item_id index : scene->selectionIndices()) { if(!mesh_or_soup_item_found) { diff --git a/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Optimization_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Optimization_plugin.cpp index 3c0a56a87f3..6454a6f4cde 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Optimization_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Optimization_plugin.cpp @@ -561,7 +561,7 @@ optimization_done(Optimizer_thread* thread) .arg(thread->time()) .arg(translate(return_code)); - Q_FOREACH( QString param, thread->parameters_log() ) + for( QString param : thread->parameters_log() ) { str.append(QString("( %1 )
").arg(param)); } diff --git a/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Volume_plane.h b/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Volume_plane.h index d54505abb1b..6dbe84a28e8 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Volume_plane.h +++ b/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Volume_plane.h @@ -515,7 +515,7 @@ void Volume_plane::draw(Viewer_interface *viewer) const { updateCurrentCube(); if(cur_cube != currentCube) { - Q_FOREACH(CGAL::QGLViewer*v, CGAL::QGLViewer::QGLViewerPool()){ + for(CGAL::QGLViewer*v : CGAL::QGLViewer::QGLViewerPool()){ v->setProperty("need_update", true); } } diff --git a/Polyhedron/demo/Polyhedron/Plugins/Operations_on_polyhedra/Clip_polyhedron_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/Operations_on_polyhedra/Clip_polyhedron_plugin.cpp index 02af6fc0272..a78cd1150ba 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Operations_on_polyhedra/Clip_polyhedron_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/Operations_on_polyhedra/Clip_polyhedron_plugin.cpp @@ -157,7 +157,7 @@ if it has a closed contour on the clipping polyhedron. Otherwise, it will be lef } bool applicable(QAction*) const { - Q_FOREACH(int id, scene->selectionIndices()) + for(int id : scene->selectionIndices()) { if(qobject_cast(scene->item(id))) return true; @@ -396,7 +396,7 @@ public Q_SLOTS: } } //apply the clipping function - Q_FOREACH(Scene_item* item, polyhedra) + for(Scene_item* item : polyhedra) { Scene_surface_mesh_item *sm_item = qobject_cast(item); if(!ui_widget.do_not_modify_CheckBox->isChecked() && CGAL::Polygon_mesh_processing::does_self_intersect(*sm_item->face_graph())) diff --git a/Polyhedron/demo/Polyhedron/Plugins/PCA/Affine_transform_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/PCA/Affine_transform_plugin.cpp index d9fbc5a094b..1a0a9e34f35 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/PCA/Affine_transform_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/PCA/Affine_transform_plugin.cpp @@ -126,7 +126,7 @@ public: QList lineEdits; lineEdits << ui.lineEditA << ui.lineEditX << ui.lineEditY << ui.lineEditZ; - Q_FOREACH(QLineEdit* widget, lineEdits) + for(QLineEdit* widget : lineEdits) { QSizePolicy sp_retain = widget->sizePolicy(); sp_retain.setRetainSizeWhenHidden(true); diff --git a/Polyhedron/demo/Polyhedron/Plugins/PCA/Basic_generator_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/PCA/Basic_generator_plugin.cpp index 4397d8f9362..51355a07b5f 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/PCA/Basic_generator_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/PCA/Basic_generator_plugin.cpp @@ -128,7 +128,7 @@ public : this, SLOT(on_actionPolyline_triggered())); _actions << actionPolyline; - Q_FOREACH(QAction* action, _actions) + for(QAction* action : _actions) { menu->addAction(action); } @@ -689,7 +689,7 @@ void Basic_generator_plugin::generatePoints() return; } - Q_FOREACH(QString s, list) + for(QString s : list) { if(!s.isEmpty()) { @@ -754,7 +754,7 @@ void Basic_generator_plugin::generateLines() msgBox->exec(); return; } - Q_FOREACH(QString s, list) + for(QString s : list) { if(!s.isEmpty()) { diff --git a/Polyhedron/demo/Polyhedron/Plugins/PCA/Clipping_box_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/PCA/Clipping_box_plugin.cpp index a2dd4f79139..aa32c500594 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/PCA/Clipping_box_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/PCA/Clipping_box_plugin.cpp @@ -144,7 +144,7 @@ void Clipping_box_plugin::clipbox() item->setName("Clipping box"); item->setRenderingMode(FlatPlusEdges); - Q_FOREACH(CGAL::QGLViewer* viewer, CGAL::QGLViewer::QGLViewerPool()) + for(CGAL::QGLViewer* viewer : CGAL::QGLViewer::QGLViewerPool()) viewer->installEventFilter(item); scene->addItem(item); @@ -182,7 +182,7 @@ void Clipping_box_plugin::do_clip(bool b) typedef CGAL::Epick Kernel; typedef CGAL::Polyhedron_3 Mesh; - Q_FOREACH(CGAL::QGLViewer* v, CGAL::QGLViewer::QGLViewerPool()) + for(CGAL::QGLViewer* v : CGAL::QGLViewer::QGLViewerPool()) { CGAL::Three::Viewer_interface* viewer = qobject_cast(v); diff --git a/Polyhedron/demo/Polyhedron/Plugins/PCA/Create_bbox_mesh_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/PCA/Create_bbox_mesh_plugin.cpp index 1fafba9d82c..ee591ddc04a 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/PCA/Create_bbox_mesh_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/PCA/Create_bbox_mesh_plugin.cpp @@ -29,7 +29,7 @@ public: bool applicable(QAction*) const { bool at_least_one_non_empty = false; - Q_FOREACH(int index, scene->selectionIndices()) + for(int index : scene->selectionIndices()) { Scene_item* item = scene->item(index); if(!item->isFinite()) @@ -108,7 +108,7 @@ bbox(bool extended) int item_count = 0; QString name; - Q_FOREACH(int index, scene->selectionIndices()) + for(int index : scene->selectionIndices()) { Scene_item* item = scene->item(index); if(item->isFinite() && !item->isEmpty()) diff --git a/Polyhedron/demo/Polyhedron/Plugins/PCA/Create_obb_mesh_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/PCA/Create_obb_mesh_plugin.cpp index 7ca4e060a92..cae392b0c94 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/PCA/Create_obb_mesh_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/PCA/Create_obb_mesh_plugin.cpp @@ -37,7 +37,7 @@ public: bool applicable(QAction*) const { bool at_least_one_non_empty = false; - Q_FOREACH(int index, scene->selectionIndices()) + for(int index : scene->selectionIndices()) { Scene_item* item = scene->item(index); if(!item->isFinite()) @@ -144,7 +144,7 @@ void Create_obb_mesh_plugin:: gather_mesh_points(std::vector& points) { - Q_FOREACH(int index, scene->selectionIndices()) + for(int index : scene->selectionIndices()) { Scene_item* item = scene->item(index); @@ -247,7 +247,7 @@ obb() << std::endl; QString name; - Q_FOREACH(int index, scene->selectionIndices()) + for(int index : scene->selectionIndices()) { Scene_item* item = scene->item(index); if(!item->isEmpty()) diff --git a/Polyhedron/demo/Polyhedron/Plugins/PCA/Edit_box_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/PCA/Edit_box_plugin.cpp index 29c0e731d3a..77569a7b810 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/PCA/Edit_box_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/PCA/Edit_box_plugin.cpp @@ -98,7 +98,7 @@ void Edit_box_plugin::bbox() this, SLOT(enableAction())); item->setName("Edit box"); item->setRenderingMode(FlatPlusEdges); - Q_FOREACH(CGAL::QGLViewer* viewer, CGAL::QGLViewer::QGLViewerPool()) + for(CGAL::QGLViewer* viewer : CGAL::QGLViewer::QGLViewerPool()) viewer->installEventFilter(item); scene->addItem(item); diff --git a/Polyhedron/demo/Polyhedron/Plugins/PCA/Pca_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/PCA/Pca_plugin.cpp index 20cce18487c..2fcecd22abd 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/PCA/Pca_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/PCA/Pca_plugin.cpp @@ -71,7 +71,7 @@ public: this, SLOT(on_actionFitLine_triggered())); _actions << actionFitPlane << actionFitLine; - Q_FOREACH(QAction* action, _actions) + for(QAction* action : _actions) action->setProperty("subMenuName", "Principal Component Analysis"); diff --git a/Polyhedron/demo/Polyhedron/Plugins/PCA/Scene_edit_box_item.cpp b/Polyhedron/demo/Polyhedron/Plugins/PCA/Scene_edit_box_item.cpp index cac1c7c3236..af7ae5a3145 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/PCA/Scene_edit_box_item.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/PCA/Scene_edit_box_item.cpp @@ -289,7 +289,7 @@ Scene_edit_box_item::Scene_edit_box_item(const Scene_interface *scene_interface) are_buffers_filled = false; - Q_FOREACH(CGAL::QGLViewer* v, CGAL::QGLViewer::QGLViewerPool()) + for(CGAL::QGLViewer* v : CGAL::QGLViewer::QGLViewerPool()) { v->setMouseTracking(true); } @@ -652,7 +652,7 @@ void Scene_edit_box_item::highlight(Viewer_interface *viewer) tc->setCenterSize(d->hl_vertex.size()); //draw d->hl_type = Scene_edit_box_item_priv::VERTEX; - Q_FOREACH(CGAL::QGLViewer* v, CGAL::QGLViewer::QGLViewerPool()) + for(CGAL::QGLViewer* v : CGAL::QGLViewer::QGLViewerPool()) { CGAL::Three::Viewer_interface* viewer = static_cast(v); @@ -681,7 +681,7 @@ void Scene_edit_box_item::highlight(Viewer_interface *viewer) ec->setFlatDataSize(d->hl_vertex.size()); //draw d->hl_type = Scene_edit_box_item_priv::EDGE; - Q_FOREACH(CGAL::QGLViewer* v, CGAL::QGLViewer::QGLViewerPool()) + for(CGAL::QGLViewer* v : CGAL::QGLViewer::QGLViewerPool()) { CGAL::Three::Viewer_interface* viewer = static_cast(v); @@ -719,7 +719,7 @@ void Scene_edit_box_item::highlight(Viewer_interface *viewer) tc->setFlatDataSize(d->hl_vertex.size()); //draw d->hl_type = Scene_edit_box_item_priv::FACE; - Q_FOREACH(CGAL::QGLViewer* v, CGAL::QGLViewer::QGLViewerPool()) + for(CGAL::QGLViewer* v : CGAL::QGLViewer::QGLViewerPool()) { CGAL::Three::Viewer_interface* viewer = static_cast(v); diff --git a/Polyhedron/demo/Polyhedron/Plugins/PMP/Degenerated_faces_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/PMP/Degenerated_faces_plugin.cpp index b3fa95830f3..7f490dc1f93 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/PMP/Degenerated_faces_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/PMP/Degenerated_faces_plugin.cpp @@ -112,7 +112,7 @@ void Degenerated_faces_plugin::on_actionDegenFaces_triggered() QApplication::setOverrideCursor(Qt::WaitCursor); bool found = false; std::vector selected_polys; - Q_FOREACH(Scene_interface::Item_id index, scene->selectionIndices()) + for(Scene_interface::Item_id index : scene->selectionIndices()) { Scene_facegraph_item* poly_item = qobject_cast(scene->item(index)); @@ -121,7 +121,7 @@ void Degenerated_faces_plugin::on_actionDegenFaces_triggered() selected_polys.push_back(poly_item); } } - Q_FOREACH(Scene_facegraph_item* poly_item, selected_polys) + for(Scene_facegraph_item* poly_item : selected_polys) { Face_graph* pMesh = poly_item->polyhedron(); std::vector facets; @@ -174,7 +174,7 @@ void Degenerated_faces_plugin::on_actionDegenEdges_triggered() QApplication::setOverrideCursor(Qt::WaitCursor); bool found = false; std::vector selected_polys; - Q_FOREACH(Scene_interface::Item_id index, scene->selectionIndices()) + for(Scene_interface::Item_id index : scene->selectionIndices()) { Scene_facegraph_item* poly_item = qobject_cast(scene->item(index)); @@ -183,7 +183,7 @@ void Degenerated_faces_plugin::on_actionDegenEdges_triggered() selected_polys.push_back(poly_item); } } - Q_FOREACH(Scene_facegraph_item* poly_item, selected_polys) + for(Scene_facegraph_item* poly_item : selected_polys) { Face_graph* pMesh = poly_item->polyhedron(); std::vector edges; diff --git a/Polyhedron/demo/Polyhedron/Plugins/PMP/Detect_sharp_edges_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/PMP/Detect_sharp_edges_plugin.cpp index 38dfc613c25..e8065f1ddb0 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/PMP/Detect_sharp_edges_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/PMP/Detect_sharp_edges_plugin.cpp @@ -41,7 +41,7 @@ public: } bool applicable(QAction*) const { - Q_FOREACH(int index, scene->selectionIndices()) + for(int index : scene->selectionIndices()) { Scene_facegraph_item* item = qobject_cast(scene->item(index)); @@ -82,7 +82,7 @@ void Polyhedron_demo_detect_sharp_edges_plugin::detectSharpEdges(bool input_dial // Get selected items QList polyhedrons; - Q_FOREACH(int index, scene->selectionIndices()) + for(int index : scene->selectionIndices()) { Scene_facegraph_item* item = qobject_cast(scene->item(index)); @@ -113,7 +113,7 @@ void Polyhedron_demo_detect_sharp_edges_plugin::detectSharpEdges(bool input_dial QApplication::setOverrideCursor(Qt::WaitCursor); QApplication::processEvents(); std::size_t first_patch = 1; - Q_FOREACH(Poly_tuple tuple, polyhedrons) + for(Poly_tuple tuple : polyhedrons) { Scene_facegraph_item* item = qobject_cast(scene->item(tuple.first)); diff --git a/Polyhedron/demo/Polyhedron/Plugins/PMP/Engrave_text_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/PMP/Engrave_text_plugin.cpp index c45bfdc619e..dc45cd9ce62 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/PMP/Engrave_text_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/PMP/Engrave_text_plugin.cpp @@ -556,8 +556,8 @@ public Q_SLOTS: float pxmin(8000),pxmax(-8000), pymin(8000), pymax(-8000); - Q_FOREACH(QPolygonF poly, polys){ - Q_FOREACH(QPointF pf, poly) + for(QPolygonF poly : polys){ + for(QPointF pf : poly) { EPICK::Point_2 v = EPICK::Point_2(pf.x(),-pf.y()); if(v.x() < pxmin) @@ -570,9 +570,9 @@ public Q_SLOTS: pymax = v.y(); } } - Q_FOREACH(QPolygonF poly, polys){ + for(QPolygonF poly : polys){ polylines.push_back(std::vector()); - Q_FOREACH(QPointF pf, poly) + for(QPointF pf : poly) { EPICK::Point_2 v = EPICK::Point_2(pf.x(),-pf.y()); polylines.back().push_back(EPICK::Point_2(v.x()*(xmax-xmin)/(pxmax-pxmin) +xmin , @@ -705,7 +705,7 @@ public Q_SLOTS: CGAL::Bbox_2 bbox= CGAL::bbox_2(local_polylines.front().begin(), local_polylines.front().end(), EPICK()); - Q_FOREACH(const std::vector& points, + for(const std::vector& points : local_polylines) { bbox += CGAL::bbox_2(points.begin(), points.end(), EPICK()); @@ -965,4 +965,3 @@ private: Navigation* navigation = nullptr; }; #include "Engrave_text_plugin.moc" - diff --git a/Polyhedron/demo/Polyhedron/Plugins/PMP/Extrude_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/PMP/Extrude_plugin.cpp index da2089147d3..f459ae84894 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/PMP/Extrude_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/PMP/Extrude_plugin.cpp @@ -91,7 +91,7 @@ public : } void invalidateOpenGLBuffers() Q_DECL_OVERRIDE { - Q_FOREACH(CGAL::QGLViewer* v, CGAL::QGLViewer::QGLViewerPool()) + for(CGAL::QGLViewer* v : CGAL::QGLViewer::QGLViewerPool()) { CGAL::Three::Viewer_interface* viewer = static_cast(v); @@ -419,7 +419,7 @@ private Q_SLOTS: oliver_queen->manipulatedFrame()->setConstraint(&constraint); oliver_queen->setColor(QColor(Qt::green)); oliver_queen->setName("Extrude item"); - Q_FOREACH(CGAL::QGLViewer* viewer, CGAL::QGLViewer::QGLViewerPool()) + for(CGAL::QGLViewer* viewer : CGAL::QGLViewer::QGLViewerPool()) viewer->installEventFilter(oliver_queen); mw->installEventFilter(oliver_queen); scene->addItem(oliver_queen); diff --git a/Polyhedron/demo/Polyhedron/Plugins/PMP/Hole_filling_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/PMP/Hole_filling_plugin.cpp index 06640c85b9c..98399be1d54 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/PMP/Hole_filling_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/PMP/Hole_filling_plugin.cpp @@ -109,7 +109,7 @@ public: get_holes(); active_hole = polyline_data_list.end(); - Q_FOREACH(CGAL::QGLViewer* viewer, CGAL::QGLViewer::QGLViewerPool()) + for(CGAL::QGLViewer* viewer : CGAL::QGLViewer::QGLViewerPool()) { viewer->installEventFilter(this); } @@ -435,7 +435,7 @@ private: ui_widget.Accept_button->setVisible(true); ui_widget.Reject_button->setVisible(true); - Q_FOREACH( QWidget* w, ui_widget.dockWidgetContents->findChildren() ) + for( QWidget* w : ui_widget.dockWidgetContents->findChildren() ) { w->setEnabled(false); } ui_widget.Accept_button->setEnabled(true); @@ -445,7 +445,7 @@ private: ui_widget.Accept_button->setVisible(false); ui_widget.Reject_button->setVisible(false); - Q_FOREACH( QWidget* w, ui_widget.dockWidgetContents->findChildren() ) + for( QWidget* w : ui_widget.dockWidgetContents->findChildren() ) { w->setEnabled(true); } } } @@ -882,7 +882,7 @@ void Polyhedron_demo_hole_filling_plugin::on_Fill_from_selection_button() { vertices.push_back(target(opposite(b_edges.back(),*poly), *poly)); boost::property_map::type vpm = get(CGAL::vertex_point,*poly); - Q_FOREACH(fg_vertex_descriptor vh, vertices) + for(fg_vertex_descriptor vh : vertices) { points.push_back(get(vpm,vh)); } diff --git a/Polyhedron/demo/Polyhedron/Plugins/PMP/Isotropic_remeshing_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/PMP/Isotropic_remeshing_plugin.cpp index 53693c31637..288c59c3627 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/PMP/Isotropic_remeshing_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/PMP/Isotropic_remeshing_plugin.cpp @@ -228,7 +228,7 @@ public: bool ok(true), found_poly(false); - Q_FOREACH(int index, scene->selectionIndices()) + for(int index : scene->selectionIndices()) { if (!qobject_cast(scene->item(index))) ok = false; diff --git a/Polyhedron/demo/Polyhedron/Plugins/PMP/Join_and_split_polyhedra_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/PMP/Join_and_split_polyhedra_plugin.cpp index 49e21cc6635..2688c4a8034 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/PMP/Join_and_split_polyhedra_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/PMP/Join_and_split_polyhedra_plugin.cpp @@ -62,7 +62,7 @@ public: bool applicable(QAction* a) const { - Q_FOREACH(int index, scene->selectionIndices()) + for(int index : scene->selectionIndices()) { if (qobject_cast(scene->item(index))) return true; @@ -94,7 +94,7 @@ void Polyhedron_demo_join_and_split_polyhedra_plugin::on_actionJoinPolyhedra_tri return; } std::vector indices_to_remove; - Q_FOREACH(int index, scene->selectionIndices()) { + for(int index : scene->selectionIndices()) { if (index == mainSelectionIndex) continue; @@ -113,7 +113,7 @@ void Polyhedron_demo_join_and_split_polyhedra_plugin::on_actionJoinPolyhedra_tri //remove the other items std::sort(indices_to_remove.begin(), indices_to_remove.end(), std::greater()); - Q_FOREACH(int index, indices_to_remove) + for(int index : indices_to_remove) { scene->erase(index); } @@ -137,7 +137,7 @@ bool operator()(const FaceGraph& mesh1, const FaceGraph& mesh2) void Polyhedron_demo_join_and_split_polyhedra_plugin::on_actionSplitPolyhedra_triggered() { - Q_FOREACH(int index, scene->selectionIndices()) { + for(int index : scene->selectionIndices()) { Scene_facegraph_item* item = qobject_cast(scene->item(index)); if(item) @@ -203,7 +203,7 @@ void Polyhedron_demo_join_and_split_polyhedra_plugin::on_actionColorConnectedCom std::set to_skip; - Q_FOREACH(int index, scene->selectionIndices()) + for(int index : scene->selectionIndices()) { Scene_facegraph_item* item = qobject_cast(scene->item(index)); diff --git a/Polyhedron/demo/Polyhedron/Plugins/PMP/Mean_curvature_flow_skeleton_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/PMP/Mean_curvature_flow_skeleton_plugin.cpp index 6684a48e7b7..81bd34ee997 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/PMP/Mean_curvature_flow_skeleton_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/PMP/Mean_curvature_flow_skeleton_plugin.cpp @@ -891,7 +891,7 @@ Polyhedron_demo_mean_curvature_flow_skeleton_plugin::createContractedItem(Scene_ Scene_mcf_item* Polyhedron_demo_mean_curvature_flow_skeleton_plugin::getMCFItem() { - Q_FOREACH(int index, scene->selectionIndices()) + for(int index : scene->selectionIndices()) { Scene_mcf_item* mcf = qobject_cast(scene->item(index)); if(mcf) diff --git a/Polyhedron/demo/Polyhedron/Plugins/PMP/Orient_soup_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/PMP/Orient_soup_plugin.cpp index 7ef5a3f2e58..de23c0ac471 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/PMP/Orient_soup_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/PMP/Orient_soup_plugin.cpp @@ -34,7 +34,7 @@ public: CGAL::Three::Scene_interface* scene_interface, Messages_interface* m); bool applicable(QAction* action) const { - Q_FOREACH(CGAL::Three::Scene_interface::Item_id index, scene->selectionIndices()) { + for(CGAL::Three::Scene_interface::Item_id index : scene->selectionIndices()) { if(qobject_cast(scene->item(index))) return true; else @@ -139,7 +139,7 @@ void set_fcolors(SMesh* smesh, std::vector colors) void Polyhedron_demo_orient_soup_plugin::orientSM() { - Q_FOREACH(CGAL::Three::Scene_interface::Item_id index, scene->selectionIndices()) + for(CGAL::Three::Scene_interface::Item_id index : scene->selectionIndices()) { Scene_polygon_soup_item* item = qobject_cast(scene->item(index)); @@ -335,4 +335,3 @@ void Polyhedron_demo_orient_soup_plugin::cleanSoup() item->itemChanged(); } #include "Orient_soup_plugin.moc" - diff --git a/Polyhedron/demo/Polyhedron/Plugins/PMP/Point_inside_polyhedron_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/PMP/Point_inside_polyhedron_plugin.cpp index 85238d26ff4..61e15f68eb3 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/PMP/Point_inside_polyhedron_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/PMP/Point_inside_polyhedron_plugin.cpp @@ -108,7 +108,7 @@ public Q_SLOTS: std::vectorinside_smesh_testers; std::vector point_sets; - Q_FOREACH(CGAL::Three::Scene_interface::Item_id id, scene->selectionIndices()) { + for(CGAL::Three::Scene_interface::Item_id id : scene->selectionIndices()) { Scene_surface_mesh_item* sm_item = qobject_cast(scene->item(id)); if (sm_item){ inside_smesh_testers.push_back(new Point_inside_smesh(*(sm_item->polyhedron()))); @@ -171,7 +171,7 @@ public Q_SLOTS: bool found = false; // for repaint - Q_FOREACH(CGAL::Three::Scene_interface::Item_id id, scene->selectionIndices()) { + for(CGAL::Three::Scene_interface::Item_id id : scene->selectionIndices()) { Scene_points_with_normal_item* point_item = qobject_cast(scene->item(id)); if(point_item) { found = true; @@ -196,7 +196,7 @@ public Q_SLOTS: // warning about '*bbox' not being initialized. // -- Laurent Rineau, 2014/10/30 - Q_FOREACH(CGAL::Three::Scene_interface::Item_id id, scene->selectionIndices()) { + for(CGAL::Three::Scene_interface::Item_id id : scene->selectionIndices()) { Scene_surface_mesh_item* sm_item = qobject_cast(scene->item(id)); if(sm_item) { if(!bbox) { @@ -254,7 +254,7 @@ public Q_SLOTS: private Q_SLOTS: void resetGeneratedPoints(QObject* o) { - Q_FOREACH(Scene_points_with_normal_item* item , generated_points) + for(Scene_points_with_normal_item* item : generated_points) if(item == o) { generated_points.removeAll(item); diff --git a/Polyhedron/demo/Polyhedron/Plugins/PMP/Polyhedron_stitching_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/PMP/Polyhedron_stitching_plugin.cpp index 7244edde87e..6bedf046e85 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/PMP/Polyhedron_stitching_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/PMP/Polyhedron_stitching_plugin.cpp @@ -52,7 +52,7 @@ public: } bool applicable(QAction*) const { - Q_FOREACH(int index, scene->selectionIndices()) + for(int index : scene->selectionIndices()) { if ( qobject_cast(scene->item(index)) ) return true; @@ -120,7 +120,7 @@ void Polyhedron_demo_polyhedron_stitching_plugin::on_actionDetectBorders_trigger void Polyhedron_demo_polyhedron_stitching_plugin::on_actionDetectBorders_triggered() { - Q_FOREACH(int index, scene->selectionIndices()){ + for(int index : scene->selectionIndices()){ on_actionDetectBorders_triggered(index); } } @@ -142,7 +142,7 @@ void Polyhedron_demo_polyhedron_stitching_plugin::on_actionStitchBorders_trigger void Polyhedron_demo_polyhedron_stitching_plugin::on_actionStitchBorders_triggered() { - Q_FOREACH(int index, scene->selectionIndices()){ + for(int index : scene->selectionIndices()){ on_actionStitchBorders_triggered(index); } } @@ -177,14 +177,14 @@ void Polyhedron_demo_polyhedron_stitching_plugin::on_actionMergeReversibleCCs_tr void Polyhedron_demo_polyhedron_stitching_plugin::on_actionStitchByCC_triggered() { - Q_FOREACH(int index, scene->selectionIndices()){ + for(int index : scene->selectionIndices()){ on_actionStitchByCC_triggered(index); } } void Polyhedron_demo_polyhedron_stitching_plugin::on_actionMergeReversibleCCs_triggered() { - Q_FOREACH(int index, scene->selectionIndices()){ + for(int index : scene->selectionIndices()){ on_actionMergeReversibleCCs_triggered(index); } } diff --git a/Polyhedron/demo/Polyhedron/Plugins/PMP/Remesh_planar_patches_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/PMP/Remesh_planar_patches_plugin.cpp index 1ea142c0795..067f2c8fe72 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/PMP/Remesh_planar_patches_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/PMP/Remesh_planar_patches_plugin.cpp @@ -88,7 +88,7 @@ public: if (scene->selectionIndices().size() == 1) return qobject_cast(scene->item(scene->mainSelectionIndex())); - Q_FOREACH(int index, scene->selectionIndices()) + for(int index : scene->selectionIndices()) { if (qobject_cast(scene->item(index))) return true; diff --git a/Polyhedron/demo/Polyhedron/Plugins/PMP/Repair_polyhedron_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/PMP/Repair_polyhedron_plugin.cpp index 5ecc8921433..c4c68388d8c 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/PMP/Repair_polyhedron_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/PMP/Repair_polyhedron_plugin.cpp @@ -273,7 +273,7 @@ void Polyhedron_demo_repair_polyhedron_plugin::on_actionSnapBorders_triggered() { std::vector tolerances/* = 0.005, 0.0125, 0.025, 0.05, 0.07 */; bool ok; - Q_FOREACH(QString tol_text, ui.tolerances->text().split(",")) + for(QString tol_text : ui.tolerances->text().split(",")) { double d = tol_text.toDouble(&ok); if (ok) diff --git a/Polyhedron/demo/Polyhedron/Plugins/PMP/Scene_facegraph_item_k_ring_selection.h b/Polyhedron/demo/Polyhedron/Plugins/PMP/Scene_facegraph_item_k_ring_selection.h index 46d4c02ac9d..e25a9ee1510 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/PMP/Scene_facegraph_item_k_ring_selection.h +++ b/Polyhedron/demo/Polyhedron/Plugins/PMP/Scene_facegraph_item_k_ring_selection.h @@ -112,7 +112,7 @@ public: void setEditMode(bool b) { is_edit_mode = b; - Q_FOREACH(CGAL::QGLViewer* viewer,CGAL::QGLViewer::QGLViewerPool()){ + for(CGAL::QGLViewer* viewer :CGAL::QGLViewer::QGLViewerPool()){ //for highlighting viewer->setMouseTracking(true); } @@ -132,7 +132,7 @@ public: is_ready_to_paint_select = true; is_lasso_active = false; - Q_FOREACH(CGAL::QGLViewer* viewer,CGAL::QGLViewer::QGLViewerPool()){ + for(CGAL::QGLViewer* viewer :CGAL::QGLViewer::QGLViewerPool()){ viewer->installEventFilter(this); viewer->setMouseBindingDescription(Qt::Key_D, Qt::ShiftModifier, Qt::LeftButton, "(When in selection plugin) Removes the clicked primitive from the selection. "); } diff --git a/Polyhedron/demo/Polyhedron/Plugins/PMP/Selection_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/PMP/Selection_plugin.cpp index f4134ecfd15..b1ffae6e97b 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/PMP/Selection_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/PMP/Selection_plugin.cpp @@ -1201,7 +1201,7 @@ void Polyhedron_demo_selection_plugin::on_actionSelfIntersection_triggered() CGAL::Three::Three::CursorScopeGuard guard(tmp_cursor); bool found = false; std::vector selected_polys; - Q_FOREACH(Scene_interface::Item_id index, scene->selectionIndices()) + for(Scene_interface::Item_id index : scene->selectionIndices()) { Scene_face_graph_item* poly_item = qobject_cast(scene->item(index)); @@ -1210,7 +1210,7 @@ void Polyhedron_demo_selection_plugin::on_actionSelfIntersection_triggered() selected_polys.push_back(poly_item); } } - Q_FOREACH(Scene_face_graph_item* poly_item, selected_polys) + for(Scene_face_graph_item* poly_item : selected_polys) { Face_graph* mesh = poly_item->face_graph(); std::vector > faces; diff --git a/Polyhedron/demo/Polyhedron/Plugins/PMP/Surface_intersection_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/PMP/Surface_intersection_plugin.cpp index 036cdc43026..968a270f706 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/PMP/Surface_intersection_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/PMP/Surface_intersection_plugin.cpp @@ -109,7 +109,7 @@ public Q_SLOTS: void Polyhedron_demo_intersection_plugin::intersectionSurfaces() { Scene_face_graph_item* itemA = nullptr; - Q_FOREACH(CGAL::Three::Scene_interface::Item_id index, scene->selectionIndices()) + for(CGAL::Three::Scene_interface::Item_id index : scene->selectionIndices()) { Scene_face_graph_item* itemB = qobject_cast(scene->item(index)); @@ -175,7 +175,7 @@ void Polyhedron_demo_intersection_plugin::intersectionPolylines() std::pair > Poly_intersection; Scene_polylines_item* itemA = nullptr; - Q_FOREACH(CGAL::Three::Scene_interface::Item_id index, scene->selectionIndices()) + for(CGAL::Three::Scene_interface::Item_id index : scene->selectionIndices()) { Scene_polylines_item* itemB = qobject_cast(scene->item(index)); @@ -196,11 +196,11 @@ void Polyhedron_demo_intersection_plugin::intersectionPolylines() QElapsedTimer time; time.start(); std::vector polyA, polyB; - Q_FOREACH(const Polyline_3& poly, itemA->polylines) + for(const Polyline_3& poly : itemA->polylines) { polyA.push_back(poly); } - Q_FOREACH(const Polyline_3& poly, itemB->polylines) + for(const Polyline_3& poly : itemB->polylines) { polyB.push_back(poly); } @@ -208,7 +208,7 @@ void Polyhedron_demo_intersection_plugin::intersectionPolylines() std::vector poly_intersections; PMP::internal::compute_polylines_polylines_intersection(polyA, polyB,std::back_inserter(poly_intersections) , Kernel()); - Q_FOREACH(const Poly_intersection& inter, poly_intersections) + for(const Poly_intersection& inter : poly_intersections) { Kernel::Segment_3 segA(polyA[inter.first.first][inter.first.second], polyA[inter.first.first][inter.first.second +1]); Kernel::Segment_3 segB(polyB[inter.second.first][inter.second.second], polyB[inter.second.first][inter.second.second+1]); @@ -293,7 +293,7 @@ void Polyhedron_demo_intersection_plugin::intersectionSurfacePolyline() time.start(); Scene_face_graph_item::Face_graph tm = *itemA->face_graph(); std::vector Afaces; - Q_FOREACH(face_descriptor f, faces(tm)) + for(face_descriptor f : faces(tm)) { Afaces.push_back(f); } @@ -302,7 +302,7 @@ void Polyhedron_demo_intersection_plugin::intersectionSurfacePolyline() std::vector polylines; //Polyline_3 polyline; - Q_FOREACH(const Polyline_3 &pol, itemB->polylines) + for(const Polyline_3 &pol : itemB->polylines) { polylines.push_back(pol); } @@ -313,7 +313,7 @@ void Polyhedron_demo_intersection_plugin::intersectionSurfacePolyline() std::back_inserter(poly_intersections), CGAL::parameters::default_values()); - Q_FOREACH(const Poly_intersection& inter, poly_intersections) + for(const Poly_intersection& inter : poly_intersections) { Kernel::Segment_3 segment(polylines[inter.second.first][inter.second.second], polylines[inter.second.first][inter.second.second+1]); diff --git a/Polyhedron/demo/Polyhedron/Plugins/PMP/Triangulate_facets_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/PMP/Triangulate_facets_plugin.cpp index 6b85c6fb45b..cd91bd1a6eb 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/PMP/Triangulate_facets_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/PMP/Triangulate_facets_plugin.cpp @@ -65,7 +65,7 @@ public: } bool applicable(QAction*) const { - Q_FOREACH(CGAL::Three::Scene_interface::Item_id index, scene->selectionIndices()){ + for(CGAL::Three::Scene_interface::Item_id index : scene->selectionIndices()){ if ( qobject_cast(scene->item(index)) ) return true; if ( qobject_cast(scene->item(index))) @@ -80,7 +80,7 @@ public Q_SLOTS: void triangulate() { QApplication::setOverrideCursor(Qt::WaitCursor); - Q_FOREACH(CGAL::Three::Scene_interface::Item_id index, scene->selectionIndices()) + for(CGAL::Three::Scene_interface::Item_id index : scene->selectionIndices()) { Scene_surface_mesh_item* sm_item = qobject_cast(scene->item(index)); diff --git a/Polyhedron/demo/Polyhedron/Plugins/Point_set/Alpha_shape_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/Point_set/Alpha_shape_plugin.cpp index 429781b2000..572f2a698a0 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Point_set/Alpha_shape_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/Point_set/Alpha_shape_plugin.cpp @@ -363,7 +363,7 @@ void Scene_alpha_shape_item::invalidateOpenGLBuffers() { getTriangleContainer(0)->reset_vbos(ALL); setBuffersFilled(false); - Q_FOREACH(CGAL::QGLViewer* v, CGAL::QGLViewer::QGLViewerPool()) + for(CGAL::QGLViewer* v : CGAL::QGLViewer::QGLViewerPool()) { Viewer_interface* viewer = static_cast(v); if(viewer == NULL) diff --git a/Polyhedron/demo/Polyhedron/Plugins/Point_set/Merge_point_sets_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/Point_set/Merge_point_sets_plugin.cpp index 5a5c58b4153..694ce765c3b 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Point_set/Merge_point_sets_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/Point_set/Merge_point_sets_plugin.cpp @@ -39,7 +39,7 @@ public: if (scene->selectionIndices().size() < 2) return false; - Q_FOREACH(int index, scene->selectionIndices()) + for(int index : scene->selectionIndices()) { if ( qobject_cast(scene->item(index)) ) return true; @@ -62,7 +62,7 @@ void Polyhedron_demo_merge_point_sets_plugin::on_actionMergePointSets_triggered( = qobject_cast(scene->item(mainSelectionIndex)); QList indices_to_remove; - Q_FOREACH(int index, scene->selectionIndices()) + for(int index : scene->selectionIndices()) { if (index == mainSelectionIndex) continue; @@ -82,7 +82,7 @@ void Polyhedron_demo_merge_point_sets_plugin::on_actionMergePointSets_triggered( scene->itemChanged(mainSelectionIndex); //remove the other items - Q_FOREACH(int index, indices_to_remove) + for(int index : indices_to_remove) { scene->erase(index); } diff --git a/Polyhedron/demo/Polyhedron/Plugins/Point_set/Point_set_selection_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/Point_set/Point_set_selection_plugin.cpp index 634ae8c699b..9281c202af2 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Point_set/Point_set_selection_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/Point_set/Point_set_selection_plugin.cpp @@ -54,7 +54,7 @@ using namespace CGAL::Three; Viewer_interface* getActiveViewer() { - Q_FOREACH(CGAL::QGLViewer* v, CGAL::QGLViewer::QGLViewerPool()) + for(CGAL::QGLViewer* v : CGAL::QGLViewer::QGLViewerPool()) { if(v->hasFocus()) { @@ -606,7 +606,7 @@ public: shift_pressing = false; ctrl_pressing = false; - Q_FOREACH(CGAL::QGLViewer* viewer, CGAL::QGLViewer::QGLViewerPool()) + for(CGAL::QGLViewer* viewer : CGAL::QGLViewer::QGLViewerPool()) { viewer->installEventFilter(this); } @@ -952,7 +952,7 @@ public Q_SLOTS: connect(edit_box, &Scene_edit_box_item::aboutToBeDestroyed, this, &Polyhedron_demo_point_set_selection_plugin::reset_editbox); scene->addItem(edit_box); - Q_FOREACH(CGAL::QGLViewer* v, CGAL::QGLViewer::QGLViewerPool()){ + for(CGAL::QGLViewer* v : CGAL::QGLViewer::QGLViewerPool()){ v->installEventFilter(edit_box); } connect(mw, SIGNAL(newViewerCreated(QObject*)), diff --git a/Polyhedron/demo/Polyhedron/Plugins/Point_set/Point_set_shape_detection_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/Point_set/Point_set_shape_detection_plugin.cpp index e79f43e02d6..5648125b774 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Point_set/Point_set_shape_detection_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/Point_set/Point_set_shape_detection_plugin.cpp @@ -481,7 +481,7 @@ private: ++index; } - Q_FOREACH(Scene_group_item* group, groups) + for(Scene_group_item* group : groups) if(group && group->getChildren().empty()) delete group; @@ -841,7 +841,7 @@ private: ++index; } - Q_FOREACH(Scene_group_item* group, groups) + for(Scene_group_item* group : groups) if(group && group->getChildren().empty()) delete group; diff --git a/Polyhedron/demo/Polyhedron/Plugins/Point_set/Point_set_to_mesh_distance_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/Point_set/Point_set_to_mesh_distance_plugin.cpp index 68b777f9ab8..ca915ab64cb 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Point_set/Point_set_to_mesh_distance_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/Point_set/Point_set_to_mesh_distance_plugin.cpp @@ -133,7 +133,7 @@ public: return false; Scene_surface_mesh_item* sm = nullptr; Scene_points_with_normal_item* pn = nullptr; - Q_FOREACH(Scene_interface::Item_id i,scene->selectionIndices()) + for(Scene_interface::Item_id i :scene->selectionIndices()) { if(!sm) sm = qobject_cast(scene->item(i)); @@ -203,7 +203,7 @@ private Q_SLOTS: { Scene_surface_mesh_item* sm = nullptr; Scene_points_with_normal_item* pn = nullptr; - Q_FOREACH(Scene_interface::Item_id i,scene->selectionIndices()) + for(Scene_interface::Item_id i :scene->selectionIndices()) { if(!sm) sm = qobject_cast(scene->item(i)); diff --git a/Polyhedron/demo/Polyhedron/Plugins/Point_set/Register_point_sets_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/Point_set/Register_point_sets_plugin.cpp index 037e8510daf..70f44f0c3dc 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Point_set/Register_point_sets_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/Point_set/Register_point_sets_plugin.cpp @@ -125,7 +125,7 @@ public: { std::vector items; - Q_FOREACH(int index, scene->selectionIndices()) + for(int index : scene->selectionIndices()) { Scene_points_with_normal_item* item = qobject_cast(scene->item(index)); diff --git a/Polyhedron/demo/Polyhedron/Plugins/Subdivision_methods/Subdivision_methods_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/Subdivision_methods/Subdivision_methods_plugin.cpp index 87bb50fd96f..9b1ff600672 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Subdivision_methods/Subdivision_methods_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/Subdivision_methods/Subdivision_methods_plugin.cpp @@ -48,7 +48,7 @@ public: << actionCatmullClark << actionSqrt3 << actionDooSabin; - Q_FOREACH(QAction* action, _actions) + for(QAction* action : _actions) action->setProperty("subMenuName", "3D Surface Subdivision Methods"); autoConnectActions(); diff --git a/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh/Offset_meshing_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh/Offset_meshing_plugin.cpp index 42957269481..eb9be7db96e 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh/Offset_meshing_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh/Offset_meshing_plugin.cpp @@ -437,7 +437,7 @@ public: return false; } - Q_FOREACH(CGAL::Three::Scene_interface::Item_id index, scene->selectionIndices()) + for(CGAL::Three::Scene_interface::Item_id index : scene->selectionIndices()) { if ( qobject_cast(scene->item(index)) || qobject_cast(scene->item(index)) ) @@ -513,7 +513,7 @@ void Polyhedron_demo_offset_meshing_plugin::offset_meshing() bool mesh_or_soup_item_found = false; - Q_FOREACH(CGAL::Three::Scene_interface::Item_id index, scene->selectionIndices()) + for(CGAL::Three::Scene_interface::Item_id index : scene->selectionIndices()) { if (!mesh_or_soup_item_found) { diff --git a/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh/Parameterization_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh/Parameterization_plugin.cpp index fffd332a832..fc3ab82204f 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh/Parameterization_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh/Parameterization_plugin.cpp @@ -363,7 +363,7 @@ public: << actionMVC << actionOTE; autoConnectActions(); - Q_FOREACH(QAction *action, _actions) + for(QAction *action : _actions) action->setProperty("subMenuName", "Triangulated Surface Mesh Parameterization" ); @@ -396,7 +396,7 @@ public: || qobject_cast(scene->item(scene->mainSelectionIndex())); } - Q_FOREACH(CGAL::Three::Scene_interface::Item_id id, scene->selectionIndices()) + for(CGAL::Three::Scene_interface::Item_id id : scene->selectionIndices()) { //if one facegraph is found in the selection, it's fine if (qobject_cast(scene->item(id))) @@ -432,7 +432,7 @@ public Q_SLOTS: int id = scene->mainSelectionIndex(); - Q_FOREACH(UVItem* pl, projections) + for(UVItem* pl : projections) { if(pl==nullptr || pl != projections[scene->item(id)]) continue; @@ -467,7 +467,7 @@ public Q_SLOTS: void destroyPolyline(CGAL::Three::Scene_item* item) { - Q_FOREACH(UVItem* pli, projections) + for(UVItem* pli : projections) { if(projections.key(pli) != item) continue; @@ -506,7 +506,7 @@ private: void Polyhedron_demo_parameterization_plugin::on_prevButton_pressed() { int id = scene->mainSelectionIndex(); - Q_FOREACH(UVItem* pl, projections) + for(UVItem* pl : projections) { if(pl==nullptr || pl != projections[scene->item(id)]) @@ -524,7 +524,7 @@ void Polyhedron_demo_parameterization_plugin::on_prevButton_pressed() void Polyhedron_demo_parameterization_plugin::on_nextButton_pressed() { int id = scene->mainSelectionIndex(); - Q_FOREACH(UVItem* pl, projections) + for(UVItem* pl : projections) { if(pl==nullptr || pl != projections[scene->item(id)]) @@ -545,7 +545,7 @@ void Polyhedron_demo_parameterization_plugin::parameterize(const Parameterizatio // get active polyhedron Scene_facegraph_item* poly_item = nullptr; CGAL::Three::Scene_interface::Item_id index = scene->mainSelectionIndex(); - Q_FOREACH(CGAL::Three::Scene_interface::Item_id id, scene->selectionIndices()) + for(CGAL::Three::Scene_interface::Item_id id : scene->selectionIndices()) { poly_item = qobject_cast(scene->item(id)); if(!poly_item) @@ -573,7 +573,7 @@ void Polyhedron_demo_parameterization_plugin::parameterize(const Parameterizatio } Scene_polyhedron_selection_item* sel_item = nullptr; bool is_seamed = false; - Q_FOREACH(CGAL::Three::Scene_interface::Item_id id, scene->selectionIndices()) + for(CGAL::Three::Scene_interface::Item_id id : scene->selectionIndices()) { sel_item = qobject_cast(scene->item(id)); if(!sel_item) diff --git a/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh/Scene_polyhedron_shortest_path_item.cpp b/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh/Scene_polyhedron_shortest_path_item.cpp index b961a47da1d..f32bef66a0f 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh/Scene_polyhedron_shortest_path_item.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh/Scene_polyhedron_shortest_path_item.cpp @@ -269,7 +269,7 @@ void Scene_polyhedron_shortest_path_item::invalidateOpenGLBuffers() compute_bbox(); setBuffersFilled(false); getPointContainer(0)->reset_vbos(ALL); - Q_FOREACH(CGAL::QGLViewer* v, CGAL::QGLViewer::QGLViewerPool()) + for(CGAL::QGLViewer* v : CGAL::QGLViewer::QGLViewerPool()) { CGAL::Three::Viewer_interface* viewer = static_cast(v); if(viewer == nullptr) @@ -621,7 +621,7 @@ void Scene_polyhedron_shortest_path_item::initialize( d->m_sceneInterface = sceneInterface; connect(polyhedronItem, SIGNAL(item_is_about_to_be_changed()), this, SLOT(poly_item_changed())); - Q_FOREACH(CGAL::QGLViewer* viewer, CGAL::QGLViewer::QGLViewerPool()) + for(CGAL::QGLViewer* viewer : CGAL::QGLViewer::QGLViewerPool()) viewer->installEventFilter(this); connect(d->m_mainWindow, SIGNAL(newViewerCreated(QObject*)), this, SLOT(connectNewViewer(QObject*))); diff --git a/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh/UVProjector.h b/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh/UVProjector.h index 4de499eda0f..fa776d38848 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh/UVProjector.h +++ b/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh/UVProjector.h @@ -47,7 +47,7 @@ protected: painter.drawRect(QRect(QPoint(0,0), QPoint(this->width(),this->height()))); painter.setPen(QPen(Qt::black)); - Q_FOREACH(QPointF p, points) + for(QPointF p : points) { /*Translation(-w/2, -h/2) to recenter the scene, then * Scaling then Rotation and finally the Translation diff --git a/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh_deformation/Edit_polyhedron_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh_deformation/Edit_polyhedron_plugin.cpp index 3e94a0adea3..9f1c6b3ffb9 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh_deformation/Edit_polyhedron_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh_deformation/Edit_polyhedron_plugin.cpp @@ -90,7 +90,7 @@ QList Polyhedron_demo_edit_polyhedron_plugin::actions() const { return QList() << actionDeformation; } bool Polyhedron_demo_edit_polyhedron_plugin::applicable(QAction*) const { - Q_FOREACH(CGAL::Three::Scene_interface::Item_id i, scene->selectionIndices()) + for(CGAL::Three::Scene_interface::Item_id i : scene->selectionIndices()) { if(qobject_cast(scene->item(i))) return true; @@ -385,7 +385,7 @@ void Polyhedron_demo_edit_polyhedron_plugin::dock_widget_visibility_changed(bool else selection_item = nullptr; } - Q_FOREACH(CGAL::Three::Scene_interface::Item_id i , scene->selectionIndices()) + for(CGAL::Three::Scene_interface::Item_id i : scene->selectionIndices()) { Scene_facegraph_item* poly_item = qobject_cast(scene->item(i)); if (poly_item && @@ -499,7 +499,7 @@ Scene_edit_polyhedron_item* edit_item = nullptr; bool need_sel(true), need_edit(true); // find selection_item and edit_item in selection - Q_FOREACH(Item_id id, scene->selectionIndices()) + for(Item_id id : scene->selectionIndices()) { if(need_sel) { @@ -536,9 +536,9 @@ void Polyhedron_demo_edit_polyhedron_plugin::importSelection(Scene_polyhedron_se //converts the selection in selected points QVector sel_to_import; - Q_FOREACH(Scene_polyhedron_selection_item::fg_vertex_descriptor vh, selection_item->selected_vertices) + for(Scene_polyhedron_selection_item::fg_vertex_descriptor vh : selection_item->selected_vertices) sel_to_import.push_back(vh); - Q_FOREACH(Scene_polyhedron_selection_item::fg_edge_descriptor ed, selection_item->selected_edges) + for(Scene_polyhedron_selection_item::fg_edge_descriptor ed : selection_item->selected_edges) { Scene_polyhedron_selection_item::fg_vertex_descriptor vh = source(halfedge(ed, *selection_item->polyhedron()),*selection_item->polyhedron()); if(!sel_to_import.contains(vh)) @@ -549,7 +549,7 @@ void Polyhedron_demo_edit_polyhedron_plugin::importSelection(Scene_polyhedron_se sel_to_import.push_back(vh); } - Q_FOREACH(Scene_polyhedron_selection_item::fg_face_descriptor fh, selection_item->selected_facets) + for(Scene_polyhedron_selection_item::fg_face_descriptor fh : selection_item->selected_facets) { CGAL::Halfedge_around_face_circulator hafc(halfedge(fh, *selection_item->polyhedron()), *selection_item->polyhedron()); CGAL::Halfedge_around_face_circulator end = hafc; @@ -561,7 +561,7 @@ void Polyhedron_demo_edit_polyhedron_plugin::importSelection(Scene_polyhedron_se } //makes the selected points ROI - Q_FOREACH(Scene_polyhedron_selection_item::fg_vertex_descriptor vh, sel_to_import) + for(Scene_polyhedron_selection_item::fg_vertex_descriptor vh : sel_to_import) { edit_item->insert_roi_vertex(vh); } @@ -571,7 +571,7 @@ void Polyhedron_demo_edit_polyhedron_plugin::importSelection(Scene_polyhedron_se selection_item->set_highlighting(false); } selection_item->setVisible(false); - Q_FOREACH(CGAL::QGLViewer* v, CGAL::QGLViewer::QGLViewerPool()) + for(CGAL::QGLViewer* v : CGAL::QGLViewer::QGLViewerPool()) v->update(); } diff --git a/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh_deformation/Scene_edit_polyhedron_item.cpp b/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh_deformation/Scene_edit_polyhedron_item.cpp index c4a060696cd..86cd884ed14 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh_deformation/Scene_edit_polyhedron_item.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh_deformation/Scene_edit_polyhedron_item.cpp @@ -1137,7 +1137,7 @@ void Scene_edit_polyhedron_item::invalidateOpenGLBuffers() } getEdgeContainer(2)->reset_vbos(ALL); setBuffersFilled(false); - Q_FOREACH(CGAL::QGLViewer* v, CGAL::QGLViewer::QGLViewerPool()) + for(CGAL::QGLViewer* v : CGAL::QGLViewer::QGLViewerPool()) { CGAL::Three::Viewer_interface* viewer = static_cast(v); if(viewer == nullptr) diff --git a/Polyhedron/demo/Polyhedron/Polyhedron_demo.cpp b/Polyhedron/demo/Polyhedron/Polyhedron_demo.cpp index 05f30fa3da6..ce8046a360f 100644 --- a/Polyhedron/demo/Polyhedron/Polyhedron_demo.cpp +++ b/Polyhedron/demo/Polyhedron/Polyhedron_demo.cpp @@ -134,7 +134,7 @@ Polyhedron_demo::Polyhedron_demo(int& argc, char **argv, if(!parser.isSet(no_autostart) && autostart_js.exists()) { mainWindow.loadScript(autostart_js); } - Q_FOREACH(QString filename, parser.positionalArguments()) { + for(QString filename : parser.positionalArguments()) { mainWindow.open(filename); } @@ -155,7 +155,7 @@ bool Polyhedron_demo::notify(QObject* receiver, QEvent* event) return QApplication::notify(receiver, event); } catch (std::exception &e) { // find the mainwindow to spawn an error message - Q_FOREACH (QWidget *widget, QApplication::topLevelWidgets()) { + for (QWidget *widget : QApplication::topLevelWidgets()) { if(MainWindow* mw = qobject_cast(widget)) { QMessageBox::critical(mw, tr("Unhandled exception"), diff --git a/Polyhedron/demo/Polyhedron/Polyhedron_demo_plugin_helper.cpp b/Polyhedron/demo/Polyhedron/Polyhedron_demo_plugin_helper.cpp index 51a425f57f0..10d78ec8583 100644 --- a/Polyhedron/demo/Polyhedron/Polyhedron_demo_plugin_helper.cpp +++ b/Polyhedron/demo/Polyhedron/Polyhedron_demo_plugin_helper.cpp @@ -12,7 +12,7 @@ void CGAL::Three::Polyhedron_demo_plugin_helper::addDockWidget(QDockWidget* dock dock_widget->setFeatures(QDockWidget::DockWidgetClosable | QDockWidget::DockWidgetFloatable); QList dockWidgets = mw->findChildren(); int counter = 0; - Q_FOREACH(QDockWidget* dock, dockWidgets) { + for(QDockWidget* dock : dockWidgets) { if( mw->dockWidgetArea(dock) != ::Qt::LeftDockWidgetArea || dock == dock_widget ) { continue; } @@ -45,7 +45,7 @@ void CGAL::Three::Polyhedron_demo_plugin_helper::autoConnectActions() methods << metaObject->method(i); } - Q_FOREACH(QAction* action, actions()) + for(QAction* action : actions()) { bool success = false; // qDebug("Autoconnecting action \"%s\"...", diff --git a/Polyhedron/demo/Polyhedron/Scene.cpp b/Polyhedron/demo/Polyhedron/Scene.cpp index feb5ab6f002..b3f20ef8ef8 100644 --- a/Polyhedron/demo/Polyhedron/Scene.cpp +++ b/Polyhedron/demo/Polyhedron/Scene.cpp @@ -113,7 +113,7 @@ Scene::replaceItem(Scene::Item_id index, CGAL::Three::Scene_item* item, bool emi if(group) { m_groups.removeAll(index); - Q_FOREACH(Item_id id, group->getChildren()) + for(Item_id id : group->getChildren()) { CGAL::Three::Scene_item* child = group->getChild(id); group->unlockChild(child); @@ -161,7 +161,7 @@ Scene::replaceItem(Scene::Item_id index, CGAL::Three::Scene_item* item, bool emi Q_EMIT restoreCollapsedState(); redraw_model(); Q_EMIT selectionChanged(index); - Q_FOREACH(Scene_item* child, group_children) + for(Scene_item* child : group_children) { erase(item_id(child)); } @@ -202,7 +202,7 @@ Scene::erase(Scene::Item_id index) item->deleteLater(); selected_item = -1; //re-creates the Scene_view - Q_FOREACH(Item_id id, children) + for(Item_id id : children) { organize_items(this->item(id), invisibleRootItem(), 0); } @@ -224,7 +224,7 @@ Scene::erase(QList indices) return -1; std::unordered_set to_be_removed; int max_index = -1; - Q_FOREACH(int index, indices) { + for(int index : indices) { if(index < 0 || index >= m_entries.size()) continue; @@ -237,7 +237,7 @@ Scene::erase(QList indices) Scene_group_item* group = qobject_cast(item); if(group) { - Q_FOREACH(Item_id id, group->getChildren()) + for(Item_id id : group->getChildren()) { CGAL::Three::Scene_item* child = group->getChild(id); to_be_removed.insert(child); @@ -264,7 +264,7 @@ Scene::erase(QList indices) clear(); index_map.clear(); selected_item = -1; - Q_FOREACH(Item_id id, children) + for(Item_id id : children) { organize_items(item(id), invisibleRootItem(), 0); } @@ -296,17 +296,17 @@ void Scene::remove_item_from_groups(Scene_item* item) } Scene::~Scene() { - Q_FOREACH(CGAL::QGLViewer* viewer, CGAL::QGLViewer::QGLViewerPool()) + for(CGAL::QGLViewer* viewer : CGAL::QGLViewer::QGLViewerPool()) { removeViewer(static_cast(viewer)); viewer->setProperty("is_destroyed", true); } - Q_FOREACH(QOpenGLVertexArrayObject* vao, vaos.values()) + for(QOpenGLVertexArrayObject* vao : vaos.values()) { vao->destroy(); delete vao; } - Q_FOREACH(CGAL::Three::Scene_item* item_ptr, m_entries) + for(CGAL::Three::Scene_item* item_ptr : m_entries) { item_ptr->deleteLater(); } @@ -490,7 +490,7 @@ void Scene::initializeGL(CGAL::Three::Viewer_interface* viewer) void Scene::s_itemAboutToBeDestroyed(CGAL::Three::Scene_item *rmv_itm) { - Q_FOREACH(CGAL::Three::Scene_item* item, m_entries) + for(CGAL::Three::Scene_item* item : m_entries) { if(item == rmv_itm) item->itemAboutToBeDestroyed(item); @@ -500,7 +500,7 @@ bool Scene::keyPressEvent(QKeyEvent* e) { bool res = false; - Q_FOREACH(int i, selected_items_list) + for(int i : selected_items_list) { CGAL::Three::Scene_item* item = m_entries[i]; res |= item->keyPressEvent(e); @@ -542,7 +542,7 @@ void Scene::renderScene(const QList &items, viewer->setCurrentPass(pass); viewer->setDepthWriting(writing_depth); viewer->setDepthPeelingFbo(fbo); - Q_FOREACH(Scene_interface::Item_id index, items) + for(Scene_interface::Item_id index : items) { CGAL::Three::Scene_item& item = *m_entries[index]; CGAL::Three::Scene_group_item* group = @@ -586,7 +586,7 @@ void Scene::renderWireScene(const QList &items, QMap& picked_item_IDs, bool with_names) { - Q_FOREACH(Scene_interface::Item_id index, items) + for(Scene_interface::Item_id index : items) { CGAL::Three::Scene_item& item = *m_entries[index]; CGAL::Three::Scene_group_item* group = @@ -651,7 +651,7 @@ void Scene::renderPointScene(const QList &items, QMap& picked_item_IDs, bool with_names) { - Q_FOREACH(Scene_interface::Item_id index, items) + for(Scene_interface::Item_id index : items) { CGAL::Three::Scene_item& item = *m_entries[index]; CGAL::Three::Scene_group_item* group = @@ -691,7 +691,7 @@ void Scene::renderPointScene(const QList &items, bool Scene::has_alpha() { - Q_FOREACH(Scene_item* item, m_entries) + for(Scene_item* item : m_entries) if(item->alpha() != 1.0f) return true; return false; @@ -708,7 +708,7 @@ Scene::draw_aux(bool with_names, CGAL::Three::Viewer_interface* viewer) //the item stays opaque QList opaque_items; QList transparent_items; - Q_FOREACH(Item_id id, children) + for(Item_id id : children) { Scene_item* item = m_entries[id]; Scene_group_item* group = qobject_cast(item); @@ -1049,7 +1049,7 @@ Scene::setData(const QModelIndex &index, break; case ColorColumn: if(selectionIndices().contains(item_id(item))) - Q_FOREACH(Item_id item_index, selectionIndices()) + for(Item_id item_index : selectionIndices()) this->item(item_index)->setColor(value.value()); else item->setColor(value.value()); @@ -1095,13 +1095,13 @@ bool Scene::dropMimeData(const QMimeData * /*data*/, QList groups_children; //get IDs of all children of selected groups - Q_FOREACH(int i, selected_items_list) + for(int i : selected_items_list) { CGAL::Three::Scene_group_item* group = qobject_cast(item(i)); if(group) { - Q_FOREACH(Item_id id, group->getChildren()) + for(Item_id id : group->getChildren()) { CGAL::Three::Scene_item* child = item(id); groups_children << item_id(child); @@ -1109,7 +1109,7 @@ bool Scene::dropMimeData(const QMimeData * /*data*/, } } // Insure that children of selected groups will not be added twice - Q_FOREACH(int i, selected_items_list) + for(int i : selected_items_list) { if(!groups_children.contains(i)) { @@ -1123,7 +1123,7 @@ bool Scene::dropMimeData(const QMimeData * /*data*/, bool one_contained = false; if(group) { - Q_FOREACH(int id, selected_items_list) + for(int id : selected_items_list) { if(group->getChildren().contains(id)) { @@ -1139,7 +1139,7 @@ bool Scene::dropMimeData(const QMimeData * /*data*/, //unless the drop zone is empty, which means the item should be removed from all groups. if(!parent.isValid()) { - Q_FOREACH(Scene_item* item, items) + for(Scene_item* item : items) { if(item->parentGroup()) { @@ -1152,7 +1152,7 @@ bool Scene::dropMimeData(const QMimeData * /*data*/, } return false; } - Q_FOREACH(Scene_item* item, items) + for(Scene_item* item : items) changeGroup(item, group); redraw_model(); return true; @@ -1162,7 +1162,7 @@ bool Scene::dropMimeData(const QMimeData * /*data*/, bool Scene::sort_lists(QVector >&sorted_lists, bool up) { QVector group_found; - Q_FOREACH(int i, selectionIndices()) + for(int i : selectionIndices()) { Scene_item* item = this->item(i); if(item->has_group == 0) @@ -1359,7 +1359,7 @@ QItemSelection Scene::createSelection(int i) QItemSelection Scene::createSelection(QList is) { QItemSelection sel; - Q_FOREACH(int i, is) + for(int i : is) sel.select(index_map.keys(i).at(0), index_map.keys(i).at(4)); return sel; @@ -1610,7 +1610,7 @@ Scene::Bbox Scene::bbox() const bool bbox_initialized = false; Bbox bbox = Bbox(0,0,0,0,0,0); - Q_FOREACH(CGAL::Three::Scene_item* item, m_entries) + for(CGAL::Three::Scene_item* item : m_entries) { if(item->isFinite() && !item->isEmpty() && item->visible()) { if(bbox_initialized) { @@ -1639,7 +1639,7 @@ void Scene::redraw_model() clear(); index_map.clear(); //fills the model - Q_FOREACH(Item_id id, children) + for(Item_id id : children) { organize_items(m_entries[id], invisibleRootItem(), 0); } @@ -1778,7 +1778,7 @@ void Scene::organize_items(Scene_item* item, QStandardItem* root, int loop) qobject_cast(item); if(group) { - Q_FOREACH(Item_id id, group->getChildren()) + for(Item_id id : group->getChildren()) { CGAL::Three::Scene_item* child = group->getChild(id); organize_items(child, list.first(), loop+1); @@ -1832,7 +1832,7 @@ findItem(const CGAL::Three::Scene_interface* scene_interface, QString name, Scene_item_name_fn_ptr fn) { const Scene* scene = dynamic_cast(scene_interface); if(!scene) return nullptr; - Q_FOREACH(CGAL::Three::Scene_item* item, scene->entries()) { + for(CGAL::Three::Scene_item* item : scene->entries()) { CGAL::Three::Scene_item* ptr = qobject_cast(metaobj.cast(item)); if(ptr && ((ptr->*fn)() == name)) return ptr; } @@ -1850,7 +1850,7 @@ findItems(const CGAL::Three::Scene_interface* scene_interface, QList list; if(!scene) return list; - Q_FOREACH(CGAL::Three::Scene_item* item, scene->entries()) { + for(CGAL::Three::Scene_item* item : scene->entries()) { CGAL::Three::Scene_item* ptr = qobject_cast(item); if(ptr && ((ptr->*fn)() == name)) { list << ptr; @@ -1899,7 +1899,7 @@ void Scene::computeBbox() bool bbox_initialized = false; Bbox bbox = Bbox(0,0,0,0,0,0); - Q_FOREACH(CGAL::Three::Scene_item* item, m_entries) + for(CGAL::Three::Scene_item* item : m_entries) { if(item->isFinite() && !item->isEmpty() ) { if(bbox_initialized) { @@ -1920,7 +1920,7 @@ void Scene::computeBbox() void Scene::newViewer(Viewer_interface *viewer) { initGL(viewer); - Q_FOREACH(Scene_item* item, m_entries) + for(Scene_item* item : m_entries) { item->newViewer(viewer); } @@ -1936,7 +1936,7 @@ void Scene::removeViewer(Viewer_interface *viewer) vaos[viewer]->destroy(); vaos[viewer]->deleteLater(); vaos.remove(viewer); - Q_FOREACH(Scene_item* item, m_entries) + for(Scene_item* item : m_entries) { item->removeViewer(viewer); } @@ -1965,7 +1965,7 @@ void Scene::initGL(Viewer_interface *viewer) } void Scene::callDraw(){ - Q_FOREACH(CGAL::QGLViewer* v, CGAL::QGLViewer::QGLViewerPool()) + for(CGAL::QGLViewer* v : CGAL::QGLViewer::QGLViewerPool()) { qobject_cast(v)->update(); } diff --git a/Polyhedron/demo/Polyhedron/Scene.h b/Polyhedron/demo/Polyhedron/Scene.h index f9d6f90805b..7c42806b23f 100644 --- a/Polyhedron/demo/Polyhedron/Scene.h +++ b/Polyhedron/demo/Polyhedron/Scene.h @@ -185,7 +185,7 @@ public Q_SLOTS: void setSelectedItem(CGAL::Three::Scene_item* item_to_select) { int i=0; - Q_FOREACH(CGAL::Three::Scene_item* item, m_entries) + for(CGAL::Three::Scene_item* item : m_entries) { if (item==item_to_select) { @@ -200,14 +200,14 @@ public Q_SLOTS: const QList& setSelectedItemIndices(QList l, const bool do_emit = true) { - Q_FOREACH(int i,l) + for(int i :l) { CGAL::Three::Scene_group_item* group = qobject_cast(item(i)); if(group) { QList list; - Q_FOREACH(Item_id id, group->getChildrenForSelection()) + for(Item_id id : group->getChildrenForSelection()) list << id; l << setSelectedItemIndices(list, false /*do not emit*/); } @@ -223,14 +223,14 @@ public Q_SLOTS: const QList& setSelectedItemList(QList l, const bool do_emit = true) { - Q_FOREACH(int i,l) + for(int i :l) { CGAL::Three::Scene_group_item* group = qobject_cast(item(i)); if(group) { QList list; - Q_FOREACH(Item_id id, group->getChildrenForSelection()) + for(Item_id id : group->getChildrenForSelection()) list << id; l << setSelectedItemList(list, false /*do not emit*/); } @@ -373,5 +373,3 @@ private: }; // end class SceneDelegate #endif // SCENE_H - - diff --git a/Polyhedron/demo/Polyhedron/Scene_find_items.h b/Polyhedron/demo/Polyhedron/Scene_find_items.h index 9b2cc9b1881..7f7ed1e6da7 100644 --- a/Polyhedron/demo/Polyhedron/Scene_find_items.h +++ b/Polyhedron/demo/Polyhedron/Scene_find_items.h @@ -45,7 +45,7 @@ QList findItems(const CGAL::Three::Scene_interface* scene, QString name, findItems(scene, reinterpret_cast(0)->staticMetaObject, name, fn); QList list; - Q_FOREACH(CGAL::Three::Scene_item* ptr, void_list) { + for(CGAL::Three::Scene_item* ptr : void_list) { list << qobject_cast(ptr); } return list; @@ -106,7 +106,7 @@ QList findItemsByObjectName(const CGAL::Three::Scene_interface* scene, // scene_findItems(scene, name, fn, // reinterpret_cast(0)->staticMetaObject()); // QList list; -// Q_FOREACH(void* ptr, void_list) { +// for(void* ptr : void_list) { // list << static_cast(ptr); // } // return list; diff --git a/Polyhedron/demo/Polyhedron/Scene_group_item.cpp b/Polyhedron/demo/Polyhedron/Scene_group_item.cpp index b064cf4573f..e0c382f32f5 100644 --- a/Polyhedron/demo/Polyhedron/Scene_group_item.cpp +++ b/Polyhedron/demo/Polyhedron/Scene_group_item.cpp @@ -91,7 +91,7 @@ void Scene_group_item::update_group_number(Scene_item * new_item, int n) qobject_cast(new_item); if(group) { - Q_FOREACH(Scene_interface::Item_id id, group->getChildren()){ + for(Scene_interface::Item_id id : group->getChildren()){ update_group_number(getChild(id),n+1); } diff --git a/Polyhedron/demo/Polyhedron/Scene_points_with_normal_item.cpp b/Polyhedron/demo/Polyhedron/Scene_points_with_normal_item.cpp index 75bea895cfa..0423a7d99b9 100644 --- a/Polyhedron/demo/Polyhedron/Scene_points_with_normal_item.cpp +++ b/Polyhedron/demo/Polyhedron/Scene_points_with_normal_item.cpp @@ -905,7 +905,7 @@ void Scene_points_with_normal_item::invalidateOpenGLBuffers() getPointContainer(Priv::Shaded_points)->reset_vbos(Scene_item_rendering_helper::ALL); getEdgeContainer(0)->reset_vbos(Scene_item_rendering_helper::ALL); - Q_FOREACH(CGAL::QGLViewer* v, CGAL::QGLViewer::QGLViewerPool()) + for(CGAL::QGLViewer* v : CGAL::QGLViewer::QGLViewerPool()) { CGAL::Three::Viewer_interface* viewer = static_cast(v); if(viewer == nullptr) diff --git a/Polyhedron/demo/Polyhedron/Scene_polyhedron_selection_item.cpp b/Polyhedron/demo/Polyhedron/Scene_polyhedron_selection_item.cpp index b986582fa00..ef867028ac1 100644 --- a/Polyhedron/demo/Polyhedron/Scene_polyhedron_selection_item.cpp +++ b/Polyhedron/demo/Polyhedron/Scene_polyhedron_selection_item.cpp @@ -1636,7 +1636,7 @@ void Scene_polyhedron_selection_item::selectPath(fg_vertex_descriptor vh) return; } bool found = false; - Q_FOREACH(Scene_polyhedron_selection_item_priv::vertex_on_path vop, d->path) + for(Scene_polyhedron_selection_item_priv::vertex_on_path vop : d->path) { if(vop.vertex == vh) { @@ -1843,7 +1843,7 @@ Scene_polyhedron_selection_item::Scene_polyhedron_selection_item(Scene_face_grap Scene_polyhedron_selection_item::~Scene_polyhedron_selection_item() { delete d; - Q_FOREACH(CGAL::QGLViewer* v, CGAL::QGLViewer::QGLViewerPool()){ + for(CGAL::QGLViewer* v : CGAL::QGLViewer::QGLViewerPool()){ CGAL::Three::Viewer_interface* viewer = dynamic_cast(v); viewer->setBindingSelect(); } @@ -1887,7 +1887,7 @@ void Scene_polyhedron_selection_item::invalidateOpenGLBuffers() { getPointContainer(Priv::Temp_points)->reset_vbos(ALL); getPointContainer(Priv::Fixed_points)->reset_vbos(ALL); - Q_FOREACH(CGAL::QGLViewer* v, CGAL::QGLViewer::QGLViewerPool()) + for(CGAL::QGLViewer* v : CGAL::QGLViewer::QGLViewerPool()) { CGAL::Three::Viewer_interface* viewer = static_cast(v); @@ -1907,14 +1907,14 @@ void Scene_polyhedron_selection_item::invalidateOpenGLBuffers() { void Scene_polyhedron_selection_item::add_to_selection() { - Q_FOREACH(fg_edge_descriptor ed, temp_selected_edges) + for(fg_edge_descriptor ed : temp_selected_edges) { selected_edges.insert(ed); temp_selected_edges.erase(ed); } on_Ctrlz_pressed(); invalidateOpenGLBuffers(); - Q_FOREACH(CGAL::QGLViewer* v, CGAL::QGLViewer::QGLViewerPool()) + for(CGAL::QGLViewer* v : CGAL::QGLViewer::QGLViewerPool()) v->update(); d->tempInstructions("Path added to selection.", "Select two vertices to create the path between them. (1/2)"); @@ -2217,7 +2217,7 @@ void Scene_polyhedron_selection_item::init(Scene_face_graph_item* poly_item, QMa redraw(); }); d->manipulated_frame = new ManipulatedFrame(); - Q_FOREACH(CGAL::QGLViewer* v, CGAL::QGLViewer::QGLViewerPool()) + for(CGAL::QGLViewer* v : CGAL::QGLViewer::QGLViewerPool()) v->installEventFilter(this); mw->installEventFilter(this); connect(mw, SIGNAL(newViewerCreated(QObject*)), @@ -2241,12 +2241,12 @@ void Scene_polyhedron_selection_item::selection_changed(bool) Three::scene()->item(Three::scene()->mainSelectionIndex()))) do_bind_select = false; if(do_bind_select) - Q_FOREACH(CGAL::QGLViewer* v, CGAL::QGLViewer::QGLViewerPool()){ + for(CGAL::QGLViewer* v : CGAL::QGLViewer::QGLViewerPool()){ CGAL::Three::Viewer_interface* viewer = dynamic_cast(v); viewer->setBindingSelect(); } else - Q_FOREACH(CGAL::QGLViewer* v, CGAL::QGLViewer::QGLViewerPool()){ + for(CGAL::QGLViewer* v : CGAL::QGLViewer::QGLViewerPool()){ CGAL::Three::Viewer_interface* viewer = dynamic_cast(v); viewer->setNoBinding(); } diff --git a/Polyhedron/demo/Polyhedron/Scene_polylines_item.cpp b/Polyhedron/demo/Polyhedron/Scene_polylines_item.cpp index c931ba6da3e..5a39c029f8a 100644 --- a/Polyhedron/demo/Polyhedron/Scene_polylines_item.cpp +++ b/Polyhedron/demo/Polyhedron/Scene_polylines_item.cpp @@ -568,7 +568,7 @@ void Scene_polylines_item::change_corner_radii(double r) { scene->addItem(d->spheres); scene->changeGroup(d->spheres, this); lockChild(d->spheres); - Q_FOREACH(CGAL::QGLViewer* v, CGAL::QGLViewer::QGLViewerPool()) + for(CGAL::QGLViewer* v : CGAL::QGLViewer::QGLViewerPool()) { d->spheres->gl_initialization(qobject_cast(v)); } diff --git a/Polyhedron/demo/Polyhedron/Scene_surface_mesh_item.cpp b/Polyhedron/demo/Polyhedron/Scene_surface_mesh_item.cpp index 49e2da75e65..5dcd7cbc518 100644 --- a/Polyhedron/demo/Polyhedron/Scene_surface_mesh_item.cpp +++ b/Polyhedron/demo/Polyhedron/Scene_surface_mesh_item.cpp @@ -1146,7 +1146,7 @@ void* Scene_surface_mesh_item_priv::get_aabb_tree() if(!CGAL::is_triangle(halfedge(f, *sm), *sm)) { EPICK::Vector_3 normal = CGAL::Polygon_mesh_processing::compute_face_normal(f, *sm); - Q_FOREACH(EPICK::Triangle_3 triangle, triangulate_primitive(f,normal)) + for(EPICK::Triangle_3 triangle : triangulate_primitive(f,normal)) { Primitive primitive(triangle, f); tree->insert(primitive); @@ -1306,7 +1306,7 @@ void Scene_surface_mesh_item::invalidate(Gl_data_names name) d->flat_vertex_map_ready = false; } setBuffersFilled(false); - Q_FOREACH(CGAL::QGLViewer* v, CGAL::QGLViewer::QGLViewerPool()) + for(CGAL::QGLViewer* v : CGAL::QGLViewer::QGLViewerPool()) { CGAL::Three::Viewer_interface* viewer = static_cast(v); if(viewer == nullptr) @@ -2183,7 +2183,7 @@ void Scene_surface_mesh_item::printAllIds() s3(printFaceIds()); if((s1 && s2 && s3)) { - Q_FOREACH(CGAL::QGLViewer* viewer, CGAL::QGLViewer::QGLViewerPool()){ + for(CGAL::QGLViewer* viewer : CGAL::QGLViewer::QGLViewerPool()){ viewer->update(); } return; @@ -2230,7 +2230,7 @@ void Scene_surface_mesh_item::showVertices(bool b) } else { - Q_FOREACH(CGAL::QGLViewer* v, CGAL::QGLViewer::QGLViewerPool()){ + for(CGAL::QGLViewer* v : CGAL::QGLViewer::QGLViewerPool()){ CGAL::Three::Viewer_interface* viewer = dynamic_cast(v); TextRenderer *renderer = viewer->textRenderer(); renderer->addTextList(d->textVItems); @@ -2239,7 +2239,7 @@ void Scene_surface_mesh_item::showVertices(bool b) } else { - Q_FOREACH(CGAL::QGLViewer* v, CGAL::QGLViewer::QGLViewerPool()){ + for(CGAL::QGLViewer* v : CGAL::QGLViewer::QGLViewerPool()){ CGAL::Three::Viewer_interface* viewer = dynamic_cast(v); TextRenderer *renderer = viewer->textRenderer(); renderer->removeTextList(d->textVItems); @@ -2260,7 +2260,7 @@ void Scene_surface_mesh_item::showEdges(bool b) } else { - Q_FOREACH(CGAL::QGLViewer* v, CGAL::QGLViewer::QGLViewerPool()){ + for(CGAL::QGLViewer* v : CGAL::QGLViewer::QGLViewerPool()){ CGAL::Three::Viewer_interface* viewer = dynamic_cast(v); TextRenderer *renderer = viewer->textRenderer(); renderer->addTextList(d->textEItems); @@ -2270,7 +2270,7 @@ void Scene_surface_mesh_item::showEdges(bool b) } else { - Q_FOREACH(CGAL::QGLViewer* v, CGAL::QGLViewer::QGLViewerPool()){ + for(CGAL::QGLViewer* v : CGAL::QGLViewer::QGLViewerPool()){ CGAL::Three::Viewer_interface* viewer = dynamic_cast(v); TextRenderer *renderer = viewer->textRenderer(); renderer->removeTextList(d->textEItems); @@ -2291,7 +2291,7 @@ void Scene_surface_mesh_item::showFaces(bool b) } else { - Q_FOREACH(CGAL::QGLViewer* v, CGAL::QGLViewer::QGLViewerPool()){ + for(CGAL::QGLViewer* v : CGAL::QGLViewer::QGLViewerPool()){ CGAL::Three::Viewer_interface* viewer = dynamic_cast(v); TextRenderer *renderer = viewer->textRenderer(); renderer->addTextList(d->textFItems); @@ -2301,7 +2301,7 @@ void Scene_surface_mesh_item::showFaces(bool b) } else { - Q_FOREACH(CGAL::QGLViewer* v, CGAL::QGLViewer::QGLViewerPool()){ + for(CGAL::QGLViewer* v : CGAL::QGLViewer::QGLViewerPool()){ CGAL::Three::Viewer_interface* viewer = dynamic_cast(v); TextRenderer *renderer = viewer->textRenderer(); renderer->removeTextList(d->textFItems); diff --git a/Polyhedron/demo/Polyhedron/Scene_textured_surface_mesh_item.cpp b/Polyhedron/demo/Polyhedron/Scene_textured_surface_mesh_item.cpp index 0985491e445..d3fdcb2996d 100644 --- a/Polyhedron/demo/Polyhedron/Scene_textured_surface_mesh_item.cpp +++ b/Polyhedron/demo/Polyhedron/Scene_textured_surface_mesh_item.cpp @@ -326,7 +326,7 @@ Scene_textured_surface_mesh_item::selection_changed(bool p_is_selected) if(p_is_selected != is_selected) { is_selected = p_is_selected; - Q_FOREACH(CGAL::QGLViewer*v, CGAL::QGLViewer::QGLViewerPool()) + for(CGAL::QGLViewer*v : CGAL::QGLViewer::QGLViewerPool()) { setBuffersInit(qobject_cast(v), false); } @@ -421,4 +421,3 @@ void Scene_textured_surface_mesh_item::computeElements() const setBuffersFilled(true); QApplication::restoreOverrideCursor(); } - diff --git a/Polyhedron/demo/Polyhedron/Scene_triangulation_3_item.cpp b/Polyhedron/demo/Polyhedron/Scene_triangulation_3_item.cpp index cdf64cf32c9..b3bd8575b6a 100644 --- a/Polyhedron/demo/Polyhedron/Scene_triangulation_3_item.cpp +++ b/Polyhedron/demo/Polyhedron/Scene_triangulation_3_item.cpp @@ -1957,7 +1957,7 @@ void Scene_triangulation_3_item::invalidateOpenGLBuffers() getEdgeContainer(T3_edges)->reset_vbos(ALL); getEdgeContainer(Grid_edges)->reset_vbos(ALL); - Q_FOREACH(CGAL::QGLViewer* v, CGAL::QGLViewer::QGLViewerPool()) + for(CGAL::QGLViewer* v : CGAL::QGLViewer::QGLViewerPool()) { CGAL::Three::Viewer_interface* viewer = static_cast(v); if(viewer == NULL) @@ -2192,4 +2192,3 @@ void Scene_triangulation_3_item::set_cut_edge(bool b) } #include "Scene_triangulation_3_item.moc" - diff --git a/Polyhedron/demo/Polyhedron/TextRenderer.cpp b/Polyhedron/demo/Polyhedron/TextRenderer.cpp index 95dc1846371..1385c57aed6 100644 --- a/Polyhedron/demo/Polyhedron/TextRenderer.cpp +++ b/Polyhedron/demo/Polyhedron/TextRenderer.cpp @@ -10,14 +10,14 @@ void TextRenderer::draw(CGAL::Three::Viewer_interface *viewer, const QVector3D& QRect rect; CGAL::qglviewer::Camera* camera = viewer->camera(); //Display the items textItems - Q_FOREACH(TextListItem* list, textItems) + for(TextListItem* list : textItems) { CGAL::Three::Scene_print_item_interface* item = qobject_cast(scene->item(scene->mainSelectionIndex())); if( item && item->shouldDisplayIds(list->item()) ){ - Q_FOREACH(TextItem* item, list->textList()) + for(TextItem* item : list->textList()) { CGAL::qglviewer::Vec src(item->position().x(), item->position().y(),item->position().z()); if(viewer->testDisplayId(src.x, src.y, src.z)) @@ -52,7 +52,7 @@ void TextRenderer::draw(CGAL::Three::Viewer_interface *viewer, const QVector3D& } //Display the local TextItems - Q_FOREACH(TextItem* item, local_textItems) + for(TextItem* item : local_textItems) { CGAL::qglviewer::Vec src(item->position().x(), item->position().y(),item->position().z()); if(item->is_3D()) @@ -110,7 +110,7 @@ void TextRenderer::draw(CGAL::Three::Viewer_interface *viewer, const QVector3D& void TextRenderer::removeTextList(TextListItem *p_list) { - Q_FOREACH(TextListItem *list, textItems) + for(TextListItem *list : textItems) if(list == p_list) textItems.removeAll(list); } diff --git a/Polyhedron/demo/Polyhedron/Three.cpp b/Polyhedron/demo/Polyhedron/Three.cpp index 1d8470387d0..8e6b8943e15 100644 --- a/Polyhedron/demo/Polyhedron/Three.cpp +++ b/Polyhedron/demo/Polyhedron/Three.cpp @@ -83,7 +83,7 @@ Three::Three() template SceneType* Three::getSelectedItem(){ - Q_FOREACH(int item_id , scene()->selectionIndices()) + for(int item_id : scene()->selectionIndices()) { SceneType* scene_item = qobject_cast(scene()->item(item_id)); if(scene_item) @@ -99,7 +99,7 @@ void Three::addDockWidget(QDockWidget* dock_widget) QList dockWidgets = mainWindow()->findChildren(); int counter = 0; - Q_FOREACH(QDockWidget* dock, dockWidgets) { + for(QDockWidget* dock : dockWidgets) { if( mainWindow()->dockWidgetArea(dock) != ::Qt::LeftDockWidgetArea || dock == dock_widget ) { continue; } @@ -132,7 +132,7 @@ void Three::autoConnectActions(Polyhedron_demo_plugin_interface *plugin) methods << metaObject->method(i); } - Q_FOREACH(QAction* action, plugin->actions()) + for(QAction* action : plugin->actions()) { bool success = false; const QMetaObject* action_metaObject = action->metaObject(); @@ -273,4 +273,3 @@ bool& Three::isLocked() { return s_is_locked; } - diff --git a/Polyhedron/demo/Polyhedron/Viewer.cpp b/Polyhedron/demo/Polyhedron/Viewer.cpp index 53a6f3c8626..ac0ab4fb27f 100644 --- a/Polyhedron/demo/Polyhedron/Viewer.cpp +++ b/Polyhedron/demo/Polyhedron/Viewer.cpp @@ -1631,7 +1631,7 @@ void Viewer_impl::showDistance(QPoint pixel) QString(" distance: %1").arg(dist), true, font, Qt::red, true); distance_text.append(centerCoord); - Q_FOREACH(TextItem* ti, distance_text) + for(TextItem* ti : distance_text) textRenderer->addText(ti); Q_EMIT(viewer->sendMessage(QString("First point : A(%1,%2,%3), second point : B(%4,%5,%6), distance between them : %7") .arg(APoint.x/scaler.x()-viewer->offset().x) @@ -1648,7 +1648,7 @@ void Viewer_impl::showDistance(QPoint pixel) void Viewer_impl::clearDistancedisplay() { distance_is_displayed = false; - Q_FOREACH(TextItem* ti, distance_text) + for(TextItem* ti : distance_text) { textRenderer->removeText(ti); delete ti;
%1 %1 %1
%1 %1