OpenWalnut  1.5.0dev
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
WQtNetworkItemActivator Class Reference

Small graphics item that respresents whether a module in the network editor is active or not. More...

#include <WQtNetworkItemActivator.h>

+ Inheritance diagram for WQtNetworkItemActivator:
+ Collaboration diagram for WQtNetworkItemActivator:

Public Types

enum  { Type = UserType + 13 }
 This customize the return value of type() More...
 

Public Member Functions

 WQtNetworkItemActivator (std::shared_ptr< WModule > module)
 Constructor for indicator showing if module is active. More...
 
 ~WQtNetworkItemActivator ()
 Destructor. More...
 
virtual int type () const
 Reimplementation from QGraphicsItem. More...
 
virtual void paint (QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
 Actually paints the port. More...
 

Protected Member Functions

void mousePressEvent (QGraphicsSceneMouseEvent *mouseEvent)
 Start drawing an arrow temporary. More...
 
void activeChangeNotifier ()
 Callback getting called by the module's active property to know about state changes. More...
 
void handleActiveState ()
 Setups tooltip and brush acccording to state. More...
 

Protected Attributes

std::shared_ptr< WModulem_module
 the module More...
 
QColor m_activeColor
 color used for active indicator More...
 
QColor m_inactiveColor
 color used for inactive indicator More...
 
boost::signals2::connection m_notifierConnection
 The connection used for notification. More...
 
bool m_needStateUpdate
 If true, the module state changed. More...
 

Detailed Description

Small graphics item that respresents whether a module in the network editor is active or not.

Clicking on it can toggle the state.

Definition at line 41 of file WQtNetworkItemActivator.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum

This customize the return value of type()

Definition at line 59 of file WQtNetworkItemActivator.h.

Constructor & Destructor Documentation

◆ WQtNetworkItemActivator()

WQtNetworkItemActivator::WQtNetworkItemActivator ( std::shared_ptr< WModule module)
explicit

Constructor for indicator showing if module is active.

Parameters
moduleThe module whose state is represented by this indicator.

Definition at line 39 of file WQtNetworkItemActivator.cpp.

References activeChangeNotifier(), m_module, m_needStateUpdate, and m_notifierConnection.

+ Here is the call graph for this function:

◆ ~WQtNetworkItemActivator()

WQtNetworkItemActivator::~WQtNetworkItemActivator ( )

Destructor.

Definition at line 68 of file WQtNetworkItemActivator.cpp.

Member Function Documentation

◆ activeChangeNotifier()

void WQtNetworkItemActivator::activeChangeNotifier ( )
protected

Callback getting called by the module's active property to know about state changes.

Definition at line 77 of file WQtNetworkItemActivator.cpp.

References m_needStateUpdate.

Referenced by WQtNetworkItemActivator().

+ Here is the caller graph for this function:

◆ handleActiveState()

void WQtNetworkItemActivator::handleActiveState ( )
protected

Setups tooltip and brush acccording to state.

Definition at line 120 of file WQtNetworkItemActivator.cpp.

References m_activeColor, m_inactiveColor, and m_module.

Referenced by mousePressEvent(), and paint().

+ Here is the caller graph for this function:

◆ mousePressEvent()

void WQtNetworkItemActivator::mousePressEvent ( QGraphicsSceneMouseEvent *  mouseEvent)
protected

Start drawing an arrow temporary.

Parameters
mouseEventthe mouse event

Definition at line 95 of file WQtNetworkItemActivator.cpp.

References handleActiveState(), and m_module.

+ Here is the call graph for this function:

◆ paint()

void WQtNetworkItemActivator::paint ( QPainter *  painter,
const QStyleOptionGraphicsItem *  option,
QWidget *  widget 
)
virtual

Actually paints the port.

Parameters
painterthe painter
optionstyle options
widgetparent widget.

Definition at line 85 of file WQtNetworkItemActivator.cpp.

References handleActiveState(), and m_needStateUpdate.

+ Here is the call graph for this function:

◆ type()

int WQtNetworkItemActivator::type ( ) const
virtual

Reimplementation from QGraphicsItem.

Returns
the type of the item as int

Definition at line 72 of file WQtNetworkItemActivator.cpp.

Member Data Documentation

◆ m_activeColor

QColor WQtNetworkItemActivator::m_activeColor
protected

color used for active indicator

Definition at line 88 of file WQtNetworkItemActivator.h.

Referenced by handleActiveState().

◆ m_inactiveColor

QColor WQtNetworkItemActivator::m_inactiveColor
protected

color used for inactive indicator

Definition at line 89 of file WQtNetworkItemActivator.h.

Referenced by handleActiveState().

◆ m_module

std::shared_ptr< WModule > WQtNetworkItemActivator::m_module
protected

the module

Definition at line 86 of file WQtNetworkItemActivator.h.

Referenced by handleActiveState(), mousePressEvent(), and WQtNetworkItemActivator().

◆ m_needStateUpdate

bool WQtNetworkItemActivator::m_needStateUpdate
protected

If true, the module state changed.

Update the item.

Definition at line 104 of file WQtNetworkItemActivator.h.

Referenced by activeChangeNotifier(), paint(), and WQtNetworkItemActivator().

◆ m_notifierConnection

boost::signals2::connection WQtNetworkItemActivator::m_notifierConnection
protected

The connection used for notification.

Definition at line 94 of file WQtNetworkItemActivator.h.

Referenced by WQtNetworkItemActivator().


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