diff --git a/Polyhedron/demo/Polyhedron/Plugins/PMP/Surface_intersection_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/PMP/Surface_intersection_plugin.cpp index ea3e20e3db0..e4f35aa56ba 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/PMP/Surface_intersection_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/PMP/Surface_intersection_plugin.cpp @@ -30,11 +30,9 @@ class Polyhedron_demo_intersection_plugin : public: bool applicable(QAction*) const { - int nb_selected=0; - Q_FOREACH(CGAL::Three::Scene_interface::Item_id index, scene->selectionIndices()) - if ( qobject_cast(scene->item(index)) ) - ++nb_selected; - return nb_selected==2; + return scene->selectionIndices().size() == 2 && + qobject_cast(scene->item(scene->selectionIndices().first())) && + qobject_cast(scene->item(scene->selectionIndices().last())); } QList actions() const { diff --git a/Polyhedron/demo/Polyhedron/Plugins/PMP/Surface_intersection_sm_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/PMP/Surface_intersection_sm_plugin.cpp index 91976aba2cd..5e628939185 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/PMP/Surface_intersection_sm_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/PMP/Surface_intersection_sm_plugin.cpp @@ -29,12 +29,10 @@ class Polyhedron_demo_intersection_plugin : public: - bool applicable(QAction*) const { - int nb_selected=0; - Q_FOREACH(CGAL::Three::Scene_interface::Item_id index, scene->selectionIndices()) - if ( qobject_cast(scene->item(index)) ) - ++nb_selected; - return nb_selected==2; + bool applicable(QAction*) const { + return scene->selectionIndices().size() == 2 && + qobject_cast(scene->item(scene->selectionIndices().first())) && + qobject_cast(scene->item(scene->selectionIndices().last())); } QList actions() const {