Version: 8.3.0
YACS::HMI::AbstractSceneItem Class Referenceabstract

#include <SceneItem.hxx>

Inheritance diagram for YACS::HMI::AbstractSceneItem:
Collaboration diagram for YACS::HMI::AbstractSceneItem:

Public Member Functions

 AbstractSceneItem (QGraphicsScene *scene, SceneItem *parent, QString label)
 
virtual ~AbstractSceneItem ()
 
virtual QRectF boundingRect () const =0
 
virtual void paint (QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)=0
 
virtual void setTopLeft (QPointF topLeft)=0
 
int getLevel ()
 
void setLevel ()
 
virtual void checkGeometryChange ()=0
 
virtual void reorganize ()
 
virtual QString getLabel ()
 
virtual void addHeader ()
 
virtual void addProgressItem ()
 
virtual qreal getHeaderBottom ()
 
qreal getWidth ()
 
qreal getHeight ()
 
virtual void setWidth (qreal width)
 AbstractSceneItem cannot be resized (only ComposedNodeItem can) More...
 
virtual void setHeight (qreal height)
 AbstractSceneItem cannot be resized (only ComposedNodeItem can) More...
 
virtual void popupMenu (QWidget *caller, const QPoint &globalPos)=0
 
virtual void activateSelection (bool selected)
 
virtual void setGeometryOptimization (bool optimize)
 
SceneItemgetParent ()
 

Protected Member Functions

virtual QRectF childBoundingRect (AbstractSceneItem *child) const
 

Protected Attributes

SceneItem_parent
 
YACS::HMI::Scene_scene
 
QString _label
 
int _level
 
qreal _width
 
qreal _height
 
qreal _incHeight
 
QColor _penColor
 
QColor _brushColor
 
QColor _hiPenColor
 
QColor _hiBrushColor
 
bool _hasHeader
 
bool _optimize
 
bool _dragable
 
enum Qt::MouseButton _dragButton
 

Detailed Description

Base class for 2D graphics item, does not herit neither from QGraphicsItem, nor from GuiObserver. not instantiable. See derived classes.

Definition at line 64 of file SceneItem.hxx.

Constructor & Destructor Documentation

AbstractSceneItem::AbstractSceneItem ( QGraphicsScene scene,
SceneItem parent,
QString  label 
)

Definition at line 88 of file SceneItem.cxx.

References DEBTRACE, and getLevel().

90 {
91  _scene = dynamic_cast<Scene*>(scene);
92  _parent = parent;
93  _label = label;
94  _level = 1;
95  _width = 6;
96  _height = 4;
97  _incHeight = 0; // used in elementaryNode when ports added
102  _hasHeader = false;
103  _optimize = true; // to be set individually or globally by user (shrink items)
104  _dragable = false;
105  _dragButton = Qt::LeftButton;
106  if (_parent)
107  _level = _parent->getLevel() +1;
108  DEBTRACE("AbstractSceneItem::AbstractSceneItem "<<label.toStdString()
109  <<" "<<this<<" "<<_parent<<" "<< _level);
110 }
AbstractSceneItem::~AbstractSceneItem ( )
virtual

Definition at line 112 of file SceneItem.cxx.

113 {
114 }

Member Function Documentation

void AbstractSceneItem::activateSelection ( bool  selected)
virtual

Reimplemented in YACS::HMI::SceneObserverItem.

Definition at line 180 of file SceneItem.cxx.

Referenced by YACS::HMI::SceneItem::mousePressEvent().

181 {
182  if (_parent) _parent->activateSelection(selected);
183 }
void AbstractSceneItem::addHeader ( )
virtual

Reimplemented in YACS::HMI::SceneNodeItem.

Definition at line 140 of file SceneItem.cxx.

Referenced by YACS::HMI::SceneComposedNodeItem::update().

141 {
142 }
void AbstractSceneItem::addProgressItem ( )
virtual

Reimplemented in YACS::HMI::SceneNodeItem.

Definition at line 144 of file SceneItem.cxx.

Referenced by YACS::HMI::SceneComposedNodeItem::update().

145 {
146 }
virtual QRectF YACS::HMI::AbstractSceneItem::boundingRect ( ) const
pure virtual
virtual void YACS::HMI::AbstractSceneItem::checkGeometryChange ( )
pure virtual
QRectF AbstractSceneItem::childBoundingRect ( AbstractSceneItem child) const
protectedvirtual

Definition at line 173 of file SceneItem.cxx.

References YASSERT.

Referenced by YACS::HMI::SceneComposedNodeItem::autoPosNewChild(), and YACS::HMI::SceneComposedNodeItem::childrenBoundingRect().

174 {
175  QGraphicsItem *item = dynamic_cast<QGraphicsItem*>(child);
176  YASSERT(item);
177  return (item->mapToParent(item->boundingRect())).boundingRect();
178 }
qreal AbstractSceneItem::getHeaderBottom ( )
virtual

Reimplemented in YACS::HMI::SceneNodeItem.

Definition at line 148 of file SceneItem.cxx.

Referenced by YACS::HMI::SceneItem::setEventPos().

149 {
150  return 0;
151 }
int AbstractSceneItem::getLevel ( )

Definition at line 116 of file SceneItem.cxx.

Referenced by AbstractSceneItem(), and YACS::HMI::SceneItem::setParent().

117 {
118  return _level;
119 }
void AbstractSceneItem::reorganize ( )
virtual

Reimplemented in YACS::HMI::SceneComposedNodeItem, and YACS::HMI::SceneElementaryNodeItem.

Definition at line 131 of file SceneItem.cxx.

132 {
133 }
void AbstractSceneItem::setGeometryOptimization ( bool  optimize)
virtual

Definition at line 185 of file SceneItem.cxx.

186 {
187  _optimize = optimize;
188 }
void AbstractSceneItem::setHeight ( qreal  height)
virtual

AbstractSceneItem cannot be resized (only ComposedNodeItem can)

Reimplemented in YACS::HMI::SceneNodeItem, and YACS::HMI::SceneElementaryNodeItem.

Definition at line 169 of file SceneItem.cxx.

170 {
171 }
void AbstractSceneItem::setLevel ( )

Definition at line 121 of file SceneItem.cxx.

Referenced by YACS::HMI::SceneComposedNodeItem::update().

122 {
123  if (_parent)
124  _level = _parent->getLevel() +1;
125  if (SceneItem *item = dynamic_cast<SceneItem*>(this))
126  foreach (QGraphicsItem *child, item->childItems())
127  if (AbstractSceneItem *sci = dynamic_cast<AbstractSceneItem*>(child))
128  sci->setLevel();
129 }
void AbstractSceneItem::setWidth ( qreal  width)
virtual

AbstractSceneItem cannot be resized (only ComposedNodeItem can)

Reimplemented in YACS::HMI::SceneNodeItem, and YACS::HMI::SceneElementaryNodeItem.

Definition at line 164 of file SceneItem.cxx.

165 {
166 }

Member Data Documentation

qreal YACS::HMI::AbstractSceneItem::_incHeight
protected
bool YACS::HMI::AbstractSceneItem::_optimize
protected

Definition at line 109 of file SceneItem.hxx.

Referenced by YACS::HMI::SceneItem::checkGeometryChange().

SceneItem* YACS::HMI::AbstractSceneItem::_parent
protected

Definition at line 97 of file SceneItem.hxx.

Referenced by YACS::HMI::SceneHeaderNodeItem::adaptComposedNode(), YACS::HMI::SceneHeaderItem::adjustGeometry(), YACS::HMI::SceneProgressItem::adjustGeometry(), YACS::HMI::SceneHeaderNodeItem::adjustGeometry(), YACS::HMI::SceneHeaderNodeItem::adjustPosPorts(), YACS::HMI::SceneHeaderNodeItem::autoPosNewPort(), YACS::HMI::SceneItem::checkGeometryChange(), YACS::HMI::SceneNodeItem::getHeaderLabel(), YACS::HMI::SceneDataPortItem::getParent(), YACS::HMI::SceneNodeItem::getParent(), getParent(), YACS::HMI::SceneCtrlPortItem::getParentNode(), YACS::HMI::SceneNodeItem::mouseMoveEvent(), YACS::HMI::SceneTextItem::paint(), YACS::HMI::SceneProgressItem::paint(), YACS::HMI::SceneCtrlPortItem::paint(), YACS::HMI::SceneHeaderNodeItem::paint(), YACS::HMI::SceneHeaderItem::popupMenu(), YACS::HMI::SceneTextItem::popupMenu(), YACS::HMI::SceneProgressItem::popupMenu(), YACS::HMI::SceneHeaderNodeItem::popupMenu(), YACS::HMI::SceneHeaderNodeItem::reorganizePorts(), YACS::HMI::SceneHeaderItem::SceneHeaderItem(), YACS::HMI::SceneHeaderNodeItem::SceneHeaderNodeItem(), YACS::HMI::SceneItem::SceneItem(), YACS::HMI::SceneProgressItem::SceneProgressItem(), YACS::HMI::SceneTextItem::SceneTextItem(), YACS::HMI::SceneHeaderNodeItem::setEdited(), YACS::HMI::SceneHeaderNodeItem::setExecState(), YACS::HMI::SceneNodeItem::setMoving(), YACS::HMI::SceneItem::setParent(), YACS::HMI::SceneNodeItem::setTopLeft(), YACS::HMI::SceneItem::setTopLeft(), and YACS::HMI::SceneHeaderNodeItem::setValid().


The documentation for this class was generated from the following files: