31 #include <QGraphicsSceneHoverEvent>
43 using namespace YACS::ENGINE;
44 using namespace YACS::HMI;
54 RootSceneItem::~RootSceneItem()
60 DEBTRACE(
"RootSceneItem::update "<<eventName(event)<<
" "<<type<<
" "<<son);
68 guiEditor = QtGuiContext::getQtCurrent()->getGMain()->_guiEditor;
69 GuiContext::getCurrent()->getSubjectProc()->select(
true);
77 DEBTRACE(
"RootSceneItem::setNewRoot");
79 QString name = _root->
getName().c_str();
82 scene->addItem(procItem);
91 _scene =
dynamic_cast<Scene*
>(scene);
98 _penColor = Resource::Scene_pen;
99 _hiPenColor = Resource::Scene_hiPen;
100 _brushColor = Resource::Scene_brush;
101 _hiBrushColor = Resource::Scene_hiBrush;
105 _dragButton = Qt::LeftButton;
108 DEBTRACE(
"AbstractSceneItem::AbstractSceneItem "<<label.toStdString()
109 <<
" "<<
this<<
" "<<_parent<<
" "<< _level);
112 AbstractSceneItem::~AbstractSceneItem()
116 int AbstractSceneItem::getLevel()
121 void AbstractSceneItem::setLevel()
124 _level = _parent->getLevel() +1;
125 if (
SceneItem *item = dynamic_cast<SceneItem*>(
this))
131 void AbstractSceneItem::reorganize()
135 QString AbstractSceneItem::getLabel()
140 void AbstractSceneItem::addHeader()
144 void AbstractSceneItem::addProgressItem()
148 qreal AbstractSceneItem::getHeaderBottom()
153 qreal AbstractSceneItem::getWidth()
158 qreal AbstractSceneItem::getHeight()
164 void AbstractSceneItem::setWidth(qreal width)
169 void AbstractSceneItem::setHeight(qreal height)
177 return (item->mapToParent(item->boundingRect())).boundingRect();
180 void AbstractSceneItem::activateSelection(
bool selected)
182 if (_parent) _parent->activateSelection(selected);
185 void AbstractSceneItem::setGeometryOptimization(
bool optimize)
187 _optimize = optimize;
199 setFlag(QGraphicsItem::ItemIsSelectable);
200 setAcceptHoverEvents(
true);
209 setParentItem(parent);
220 return QRectF(- penWidth/2, - penWidth/2,
226 return QGraphicsItem::childrenBoundingRect();
230 const QStyleOptionGraphicsItem *option,
243 setPos(
int(topLeft.x()),
int(topLeft.y()));
268 DEBTRACE(
"elementaryNode resize true");
273 newWidth = childrenBox.width();
274 newHeight = childrenBox.height();
275 DEBTRACE(
"composedNode newWidth= " << newWidth <<
" newHeight=" << newHeight);
278 bool wider = (newWidth >
_width + 0.5);
280 bool higher = (newHeight >
_height + 0.5);
282 bool changeWidth = (fabs(newWidth -
_width) > 0.5);
286 deltaW = newWidth -
_width;
301 DEBTRACE(
"SceneItem::checkGeometryChange "<<
_label.toStdString() <<
302 " " << wider <<
" " << higher <<
" " << changeWidth <<
" " << resize);
306 prepareGeometryChange();
316 QPointF oldPos(pos().x() - deltaW, pos().y() - deltaH);
318 bloc->collisionResolv(aNode, oldPos);
375 origColor.getRgbF(&r, &g, &b, &a);
379 return QColor::fromRgbF(r, g, b, a);
424 QPointF localPoint = mapFromScene(point);