Version: 8.3.0
YACS::HMI::SceneTextItem Class Reference

#include <SceneTextItem.hxx>

Inheritance diagram for YACS::HMI::SceneTextItem:
Collaboration diagram for YACS::HMI::SceneTextItem:

Public Member Functions

 SceneTextItem (QGraphicsScene *scene, SceneItem *parent, QString label, bool center=false)
 
virtual ~SceneTextItem ()
 
virtual QRectF boundingRect () const
 
virtual void paint (QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
 
virtual void setTopLeft (QPointF topLeft)
 
virtual void setPlainTextTrunc (QString label)
 
virtual void checkGeometryChange ()
 
virtual void popupMenu (QWidget *caller, const QPoint &globalPos)
 
virtual QString getToolTip ()
 
void setEventPos (QPointF point)
 
- Public Member Functions inherited from YACS::HMI::AbstractSceneItem
 AbstractSceneItem (QGraphicsScene *scene, SceneItem *parent, QString label)
 
virtual ~AbstractSceneItem ()
 
int getLevel ()
 
void setLevel ()
 
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 activateSelection (bool selected)
 
virtual void setGeometryOptimization (bool optimize)
 
SceneItemgetParent ()
 

Protected Attributes

QPointF _eventPos
 
bool _center
 
- Protected Attributes inherited from YACS::HMI::AbstractSceneItem
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
 

Additional Inherited Members

- Protected Member Functions inherited from YACS::HMI::AbstractSceneItem
virtual QRectF childBoundingRect (AbstractSceneItem *child) const
 

Detailed Description

Definition at line 29 of file SceneTextItem.hxx.

Constructor & Destructor Documentation

SceneTextItem::SceneTextItem ( QGraphicsScene scene,
SceneItem parent,
QString  label,
bool  center = false 
)

Definition at line 39 of file SceneTextItem.cxx.

References _center, YACS::HMI::AbstractSceneItem::_level, YACS::HMI::AbstractSceneItem::_parent, and DEBTRACE.

41  : QGraphicsTextItem(parent), AbstractSceneItem(scene, parent, label)
42 {
43  setToolTip(label);
44  _center = center;
45  DEBTRACE("SceneTextItem::SceneTextItem "<<label.toStdString()<<" "<<this<<" "<<_parent<<" "<< _level);
46 }
SceneTextItem::~SceneTextItem ( )
virtual

Definition at line 48 of file SceneTextItem.cxx.

49 {
50 }

Member Function Documentation

QRectF SceneTextItem::boundingRect ( ) const
virtual

Implements YACS::HMI::AbstractSceneItem.

Definition at line 52 of file SceneTextItem.cxx.

53 {
54  return QGraphicsTextItem::boundingRect();
55 }
void SceneTextItem::checkGeometryChange ( )
virtual

Implements YACS::HMI::AbstractSceneItem.

Definition at line 81 of file SceneTextItem.cxx.

82 {
83 }
QString SceneTextItem::getToolTip ( )
virtual

generic behaviour for headers: obtain the tooltip from parent.

Definition at line 94 of file SceneTextItem.cxx.

References YACS::HMI::AbstractSceneItem::_label, YACS::HMI::AbstractSceneItem::getParent(), and YACS::HMI::SceneItem::getToolTip().

Referenced by YACS::HMI::Scene::helpEvent().

95 {
96  QString tooltip = _label;
97  SceneItem *parent = getParent();
98  if (parent)
99  tooltip = parent->getToolTip();
100  return tooltip;
101 }
void SceneTextItem::paint ( QPainter *  painter,
const QStyleOptionGraphicsItem *  option,
QWidget widget 
)
virtual

Implements YACS::HMI::AbstractSceneItem.

Definition at line 56 of file SceneTextItem.cxx.

References _center, YACS::HMI::AbstractSceneItem::_label, YACS::HMI::AbstractSceneItem::_parent, YACS::HMI::AbstractSceneItem::getHeight(), YACS::HMI::AbstractSceneItem::getWidth(), and YACS::HMI::Resource::Text_DX.

59 {
60  QGraphicsTextItem::paint(painter, option, widget);
61 
62  int dx, fl;
63  if (_center) {
64  dx = 0;
65  fl = Qt::AlignCenter;
66  } else {
67  dx = Resource::Text_DX;
68  fl = Qt::AlignLeft | Qt::AlignVCenter;
69  };
70  painter->drawText(dx, 0, _parent->getWidth()-dx*2, _parent->getHeight(), fl, _label);
71 }
void SceneTextItem::popupMenu ( QWidget caller,
const QPoint &  globalPos 
)
virtual

Implements YACS::HMI::AbstractSceneItem.

Definition at line 85 of file SceneTextItem.cxx.

References YACS::HMI::AbstractSceneItem::_parent, DEBTRACE, and YACS::HMI::SceneItem::popupMenu().

Referenced by YACS::HMI::GraphicsView::contextMenuEvent().

86 {
87  DEBTRACE("SceneTextItem::popupMenu " << _parent);
88  if (_parent) _parent->popupMenu(caller, globalPos);
89 }
void SceneTextItem::setEventPos ( QPointF  point)

Definition at line 103 of file SceneTextItem.cxx.

References _eventPos.

Referenced by YACS::HMI::GraphicsView::contextMenuEvent().

104 {
105  _eventPos = mapFromScene(point);
106 }
void SceneTextItem::setPlainTextTrunc ( QString  label)
virtual
void SceneTextItem::setTopLeft ( QPointF  topLeft)
virtual

Implements YACS::HMI::AbstractSceneItem.

Definition at line 73 of file SceneTextItem.cxx.

74 {
75 }

Member Data Documentation

bool YACS::HMI::SceneTextItem::_center
protected

Definition at line 48 of file SceneTextItem.hxx.

Referenced by paint(), and SceneTextItem().

QPointF YACS::HMI::SceneTextItem::_eventPos
protected

Definition at line 47 of file SceneTextItem.hxx.

Referenced by setEventPos().


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