25 #ifndef WQTNETWORKITEM_H
26 #define WQTNETWORKITEM_H
32 #include <QGraphicsItemAnimation>
33 #include <QGraphicsObject>
34 #include <QGraphicsTextItem>
36 #include <QtCore/QObject>
37 #include <QtCore/QTimeLine>
38 #include <QtCore/QTimer>
40 #include "WQtNetworkEditorGlobals.h"
41 #include "WQtNetworkInputPort.h"
42 #include "WQtNetworkOutputPort.h"
43 #include "core/kernel/WModule.h"
124 void fitLook(
float maximumWidth = WNETWORKITEM_MAXIMUM_WIDTH,
float minimumWidth = WNETWORKITEM_MINIMUM_WIDTH );
189 void moveTo( QPointF pos );
197 void moveTo( qreal x, qreal y );
248 virtual QVariant
itemChange( GraphicsItemChange change,
const QVariant& value );
256 virtual void mouseMoveEvent( QGraphicsSceneMouseEvent* mouseEvent );
301 virtual void paint( QPainter* painter,
const QStyleOptionGraphicsItem* option, QWidget* w );
308 void setText( std::string text );
Container widget to hold the WQtNetworkScene.
Small graphics item that respresents whether a module in the network editor is active or not.
This class represents a WModule as QGraphicsItem and contains a reference to its in- and outports.
virtual QVariant itemChange(GraphicsItemChange change, const QVariant &value)
If the item is changed we want to get notified.
void changeState(State state)
Update the visual state of the item.
QString getText()
Get the caption as QString.
void setLayedOut(bool layedOut=true)
Marks the item as already layed out.
State
Denotes the current state this item is in.
std::string m_subtitleFull
always contains the unclipped text of m_subtitle
void dead(WQtNetworkItem *item)
The item is now dead.
void runtimeNameChangedGT()
Update name as it has been changed.
WQtNetworkItemActivator * m_hidden
indicator showing if module's graphics are activated (allows to activate it)
void addOutputPort(WQtNetworkOutputPort *outPort)
Add a port to the item.
void addInputPort(WQtNetworkInputPort *inPort)
Add a port to the item.
void setManuallyPlaced(bool manual=true)
Mark item as manually placed.
bool m_noDrag
If true, the mouse events do not cause a drag and move operation.
virtual ~WQtNetworkItem()
Destructor.
bool m_busyIsDetermined
If true, a percentage is shown.
void activate(bool active)
Here the module can be enabled when the WModule is ready.
void animatedMoveTo(QPointF pos)
Move item to specified position smoothly, via animation.
float m_width
the width of the rect
bool m_isSelected
If true, the item is selected.
bool m_isHovered
If true, the item is hovered.
virtual void hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
If the cursor leaves the item, the item gets his default color.
bool m_busyIndicatorShow
If true, the busy indication is active.
virtual void updater()
Can be used for polling the module states.
boost::signals2::connection m_runtimeNameConnection
Keep track of runtime name changes of this module.
void moveFinished()
Called whenever a animated move was finished.
QColor m_itemColor
the color of the item. Depends on type (source, sink, ...).
virtual void mouseMoveEvent(QGraphicsSceneMouseEvent *mouseEvent)
If the WQtNetworkItem is moved, then the contained ports have to update the connected WQtNetworkArrow...
virtual void mousePressEvent(QGraphicsSceneMouseEvent *event)
Reimplemented from QGraphicsRectItem.
std::shared_ptr< WModule > getModule()
Get the WModule represented by this object.
void fitLook(float maximumWidth=WNETWORKITEM_MAXIMUM_WIDTH, float minimumWidth=WNETWORKITEM_MINIMUM_WIDTH)
This method aligns the in- and outports as well as the modulename in a regular way.
bool wasLayedOut() const
Checks whether the item was layed out earlier.
QGraphicsItemAnimation * m_animation
Animation for appearance and deletion.
void setTextItem(QGraphicsTextItem *text)
Set the QGraphicsTextItem ( the caption ) of the item.
QList< WQtNetworkInputPort * > getInPorts()
Returns the item inports.
WQtNetworkEditor * m_networkEditor
the related WQtNetworkEditor
void setCrashed()
Mark this module as crashed.
QTimeLine * m_removalAnimationTimer
Timer for the animation.
QList< WQtNetworkOutputPort * > m_outPorts
the output ports of the item
void removalAnimationDone()
Called when the m_removalAnimationTimer finishes.
std::string m_textFull
always contains the unclipped text of m_text
bool m_wasManuallyPlaced
Item has been placed manually.
bool m_wasLayedOut
Mark item as already positioned.
QGraphicsItemAnimation * m_removalAnimation
Animation for appearance and deletion.
void moveTo(QPointF pos)
Move item to specified position smoothly, no animation.
QGraphicsTextItem * m_subtitle
the caption
float m_itemBestWidth
Optimal width for this module.
int type() const
Reimplementation from QGraphicsItem.
void animationBlendOutTick(qreal value)
Called when the animation timers tick and progress in timeline.
bool m_forceUpdate
If true, the next call to update() will force a redraw.
virtual void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event)
Called upon double click.
QGraphicsTextItem * m_text
the caption
virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
Mouse was released.
void setText(std::string text)
Set the new title text.
State m_currentState
denotes the state the item currently is in
QWidget * m_propertyToolWindow
The property toolbox window if any.
void positionChanged()
Called whenever the item moves around.
WQtNetworkItem(WQtNetworkEditor *editor, std::shared_ptr< WModule > module)
Constructs new item in the network scene.
float m_height
the height of the rect
virtual void hoverEnterEvent(QGraphicsSceneHoverEvent *event)
If the cursor enters the item, the item gets a green color.
std::shared_ptr< WModule > m_module
the module
QPointF m_dragStartPosition
Keep track of the mouse dragging of this item.
QTimeLine * die()
Animate removal and finally, instruct the owning network editor to remove the item.
QList< WQtNetworkInputPort * > m_inPorts
the input ports of the item
QRectF m_rect
the size of the items rect
void animationBlendInTick(qreal value)
Called when the animation timers tick and progress in timeline.
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *w)
Draw some customized stuff in the scene.
QTimeLine * m_animationTimer
Timer for the animation.
bool wasManuallyPlaced() const
Item was placed by hand.
QList< WQtNetworkOutputPort * > getOutPorts()
Returns the item outports.
QPointF m_draggingStart
Start position of dragging.
virtual QRectF boundingRect() const
The bounding area of the item.
void runtimeNameChanged()
Update name as it has been changed.
float m_busyPercent
Counter used for busy indication.
This class represents the ports a module have.