1 // Copyright (C) 2006-2014 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, or (at your option) any later version.
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
21 #include "SceneItem.hxx"
22 #include "SceneTextItem.hxx"
23 #include "QtGuiContext.hxx"
25 #include <QGraphicsSceneMouseEvent>
32 #include "YacsTrace.hxx"
35 using namespace YACS::HMI;
37 bool Scene::_straightLinks = false;
38 bool Scene::_autoComputeLinks = true;
39 bool Scene::_simplifyLinks = true;
40 bool Scene::_force2NodesLink = true;
41 bool Scene::_addRowCols = true;
43 Scene::Scene(QObject *parent): QGraphicsScene(parent)
52 /*! to notify scene when mouse actions must not be used for selection
53 * or node displacement, typically when mouse is used to adjust the view,
54 * like zoom or recenter of the view.
56 void Scene::setZoom(bool zooming)
61 /*! check if mouse move event can be used for selection or node
62 * displacement. @see setZoom()
64 bool Scene::isZooming()
69 void Scene::helpEvent(QGraphicsSceneHelpEvent *event)
71 DEBTRACE("Scene::helpEvent");
72 QGraphicsItem *qit = itemAt(event->scenePos());
73 SceneItem * item = dynamic_cast<SceneItem*>(qit);
76 QToolTip::showText(event->screenPos(), item->getToolTip());
79 SceneTextItem * itemt = dynamic_cast<SceneTextItem*>(qit);
82 QToolTip::showText(event->screenPos(), itemt->getToolTip());
88 void Scene::mousePressEvent(QGraphicsSceneMouseEvent *mouseEvent)
90 //DEBTRACE("Scene::mousePressEvent");
91 QGraphicsScene::mousePressEvent(mouseEvent);
92 QGraphicsItem *qit = mouseGrabberItem();
96 SceneItem *item = dynamic_cast<SceneItem*>(qit);
98 DEBTRACE("mouseGrabberItem " <<item->handlesChildEvents()
99 << " " << item->getLabel().toStdString());
101 // QList<QGraphicsItem*> selItems = items(mouseEvent->scenePos());
104 void Scene::mouseReleaseEvent(QGraphicsSceneMouseEvent* mouseEvent)
107 QGraphicsScene::mouseReleaseEvent(mouseEvent);
110 void Scene::mouseMoveEvent(QGraphicsSceneMouseEvent* mouseEvent)
112 //QGraphicsScene::mouseMoveEvent(mouseEvent);
113 QGraphicsScene::mouseMoveEvent(mouseEvent);