31 #include <QGraphicsSceneHoverEvent>
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;
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);
419 m.popupMenu(caller, globalPos);
424 QPointF localPoint = mapFromScene(point);
#define YASSERT(val)
YASSERT macro is always defined, used like assert, but throw a YACS::Exception instead of abort.
virtual void activateSelection(bool selected)
virtual qreal getHeaderBottom()
YACS::HMI::Scene * _scene
static QtGuiContext * getQtCurrent()
bool isLoadingPresentation()
virtual void hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
virtual void popupMenu(QWidget *caller, const QPoint &globalPos)
virtual void setTopLeft(QPointF topLeft)
virtual void shrinkExpandRecursive(bool isExpanding, bool fromHere, ShrinkMode theShrinkMode)
QColor hoverColor(QColor origColor)
virtual QRectF childrenBoundingRect() const
virtual void hoverEnterEvent(QGraphicsSceneHoverEvent *event)
virtual void mousePressEvent(QGraphicsSceneMouseEvent *event)
virtual QColor getBrushColor()
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
void setParent(SceneItem *parent)
virtual void shrinkExpandLink(bool se)
virtual QColor getPenColor()
virtual void updateChildItems()
virtual QString getToolTip()
virtual void updateLinks()
virtual QRectF boundingRect() const
void setEventPos(QPointF point)
virtual void hoverMoveEvent(QGraphicsSceneHoverEvent *event)
virtual void checkGeometryChange()
virtual void updateLinks()
virtual void adjustHeader()
virtual std::string getName()
virtual void attach(GuiObserver *obs)