1 // Copyright (C) 2006-2008 CEA/DEN, EDF R&D
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 #include "SceneItem.hxx"
21 #include "QtGuiContext.hxx"
23 #include <QGraphicsSceneMouseEvent>
29 #include "YacsTrace.hxx"
32 using namespace YACS::HMI;
34 bool Scene::_autoComputeLinks = true;
35 bool Scene::_simplifyLinks = true;
36 bool Scene::_force2NodesLink = true;
38 Scene::Scene(QObject *parent): QGraphicsScene(parent)
47 /*! to notify scene when mouse actions must not be used for selection
48 * or node displacement, typically when mouse is used to adjust the view,
49 * like zoom or recenter of the view.
51 void Scene::setZoom(bool zooming)
56 /*! check if mouse move event can be used for selection or node
57 * displacement. @see setZoom()
59 bool Scene::isZooming()
64 void Scene::mousePressEvent(QGraphicsSceneMouseEvent *mouseEvent)
66 //DEBTRACE("Scene::mousePressEvent");
67 QGraphicsScene::mousePressEvent(mouseEvent);
68 QGraphicsItem *qit = mouseGrabberItem();
72 SceneItem *item = dynamic_cast<SceneItem*>(qit);
74 DEBTRACE("mouseGrabberItem " <<item->handlesChildEvents()
75 << " " << item->getLabel().toStdString());
77 // QList<QGraphicsItem*> selItems = items(mouseEvent->scenePos());
80 void Scene::mouseReleaseEvent(QGraphicsSceneMouseEvent* mouseEvent)
83 QGraphicsScene::mouseReleaseEvent(mouseEvent);
86 void Scene::mouseMoveEvent(QGraphicsSceneMouseEvent* mouseEvent)
88 //QGraphicsScene::mouseMoveEvent(mouseEvent);
89 QGraphicsScene::mouseMoveEvent(mouseEvent);