This commit is contained in:
Maxime Gimeno 2016-10-17 09:31:36 +02:00
parent 29d7a375bc
commit 3ba5277d97
2 changed files with 9 additions and 36 deletions

View File

@ -390,7 +390,6 @@ struct Set_show_tetrahedra {
Scene_c3t3_item_priv* priv; Scene_c3t3_item_priv* priv;
Set_show_tetrahedra(Scene_c3t3_item_priv* priv) : priv(priv) {} Set_show_tetrahedra(Scene_c3t3_item_priv* priv) : priv(priv) {}
void operator()(bool b) { void operator()(bool b) {
qDebug()<<"coucou";
priv->show_tetrahedra = b; priv->show_tetrahedra = b;
priv->item->show_intersection(b); priv->item->show_intersection(b);
} }
@ -1484,23 +1483,13 @@ Scene_c3t3_item::setColor(QColor c)
void Scene_c3t3_item::show_grid(bool b) void Scene_c3t3_item::show_grid(bool b)
{ {
d->is_grid_shown = b; d->is_grid_shown = b;
Q_FOREACH(QAction* action, contextMenu()->actions()) contextMenu()->findChild<QAction*>("actionShowGrid")->setChecked(b);
if(action->objectName() == "actionShowGrid")
{
action->setChecked(b);
break;
}
itemChanged(); itemChanged();
} }
void Scene_c3t3_item::show_spheres(bool b) void Scene_c3t3_item::show_spheres(bool b)
{ {
d->spheres_are_shown = b; d->spheres_are_shown = b;
Q_FOREACH(QAction* action, contextMenu()->actions()) contextMenu()->findChild<QAction*>("actionShowSpheres")->setChecked(b);
if(action->objectName() == "actionShowSpheres")
{
action->setChecked(b);
break;
}
if(b && !d->spheres) if(b && !d->spheres)
{ {
d->spheres = new Scene_spheres_item(this, true); d->spheres = new Scene_spheres_item(this, true);
@ -1522,12 +1511,7 @@ void Scene_c3t3_item::show_spheres(bool b)
} }
void Scene_c3t3_item::show_intersection(bool b) void Scene_c3t3_item::show_intersection(bool b)
{ {
Q_FOREACH(QAction* action, contextMenu()->actions()) contextMenu()->findChild<QAction*>("actionShowTets")->setChecked(b);
if(action->objectName() == "actionShowTets")
{
action->setChecked(b);
break;
}
if(b && !d->intersection) if(b && !d->intersection)
{ {
d->intersection = new Scene_intersection_item(this); d->intersection = new Scene_intersection_item(this);
@ -1554,12 +1538,7 @@ void Scene_c3t3_item::show_intersection(bool b)
void Scene_c3t3_item::show_cnc(bool b) void Scene_c3t3_item::show_cnc(bool b)
{ {
d->cnc_are_shown = b; d->cnc_are_shown = b;
Q_FOREACH(QAction* action, contextMenu()->actions()) contextMenu()->findChild<QAction*>("actionShowCNC")->setChecked(b);
if(action->objectName() == "actionShowCNC")
{
action->setChecked(b);
break;
}
Q_EMIT redraw(); Q_EMIT redraw();
} }
@ -1587,7 +1566,7 @@ bool Scene_c3t3_item::has_grid()const { return d->is_grid_shown;}
bool Scene_c3t3_item::has_cnc()const { return d->cnc_are_shown;} bool Scene_c3t3_item::has_cnc()const { return d->cnc_are_shown;}
bool Scene_c3t3_item::has_tets()const { if(d->intersection) return true; else return false; } bool Scene_c3t3_item::has_tets()const { return d->intersection; }
void Scene_c3t3_item::setNormal(float x, float y, float z) { void Scene_c3t3_item::setNormal(float x, float y, float z) {
d->frame->setOrientation(x, y, z, 0.f); d->frame->setOrientation(x, y, z, 0.f);
@ -1601,18 +1580,12 @@ void Scene_c3t3_item::copyProperties(Scene_item *item)
d->frame->setPositionAndOrientation(c3t3_item->manipulatedFrame()->position(), d->frame->setPositionAndOrientation(c3t3_item->manipulatedFrame()->position(),
c3t3_item->manipulatedFrame()->orientation()); c3t3_item->manipulatedFrame()->orientation());
if(c3t3_item->has_tets()) show_intersection(c3t3_item->has_tets());
show_intersection(true);
if(c3t3_item->has_spheres()) show_spheres(c3t3_item->has_spheres());
show_spheres(true);
show_cnc(c3t3_item->has_cnc());
if(c3t3_item->has_cnc())
show_cnc(true);
show_grid(c3t3_item->has_grid()); show_grid(c3t3_item->has_grid());
} }
#include "Scene_c3t3_item.moc" #include "Scene_c3t3_item.moc"

View File

@ -29,7 +29,7 @@ class Scene_item_with_properties {
public: public:
virtual ~Scene_item_with_properties(){} virtual ~Scene_item_with_properties(){}
//!Copies properties from another Scene_item //!Copies properties from another Scene_item
virtual void copyProperties(Scene_item*){} virtual void copyProperties(Scene_item*)=0; //pure virtual method
}; };
} }
} }