CANdevStudio
Development tool for CAN bus simulation
Loading...
Searching...
No Matches
ComponentModel< C, Derived > Class Template Reference

#include <componentmodel.h>

Inheritance diagram for ComponentModel< C, Derived >:
Collaboration diagram for ComponentModel< C, Derived >:

Public Member Functions

 ComponentModel ()=default
 
 ComponentModel (const QString &name)
 
virtual ~ComponentModel ()
 
virtual void initModel (QtNodes::Node &node, int nodeCnt, bool darkMode) override
 
virtual QString caption () const override
 Used to get node caption.
 
virtual void setCaption (const QString &caption) override
 Sets model caption and updates widget title.
 
virtual QString name () const override
 Used to identify model by data model name.
 
virtual std::unique_ptr< QtNodes::NodeDataModel > clone () const override
 Creates new node of the same type.
 
virtual QJsonObject save () const override
 Possibility to save node properties.
 
virtual void restore (QJsonObject const &json) override
 Used to restore node configurations.
 
virtual QWidget * embeddedWidget () override
 Used to get widget embedded in Node.
 
virtual bool resizable () const override
 Used to get information if node is resizable.
 
virtual ComponentInterfacegetComponent () override
 Component getter.
 
virtual bool restored () override
 
virtual void setColorMode (bool darkMode) override
 
virtual bool hasSeparateThread () const override
 
void simBcastRcv (const QJsonObject &msg, const QVariant &param) override
 
void simBcastSndSlot (const QJsonObject &msg, const QVariant &param) override
 
- Public Member Functions inherited from ComponentModelInterface
virtual ~ComponentModelInterface ()=default
 

Protected Attributes

C _component
 
QLabel * _label { new QLabel }
 
QString _caption
 
QString _name
 
bool _resizable { false }
 
bool _restored { false }
 
bool _darkMode { true }
 
QtNodes::NodeStyle _nodeStyle
 
std::unique_ptr< QThread > _thread
 
QUuid _id
 

Additional Inherited Members

- Signals inherited from ComponentModelInterface
void startSimulation ()
 
void stopSimulation ()
 
void handleDock (QWidget *widget)
 
void simBcastSnd (const QJsonObject &msg, const QVariant &param)
 

Constructor & Destructor Documentation

◆ ComponentModel() [1/2]

template<typename C , typename Derived >
ComponentModel< C, Derived >::ComponentModel ( )
default

◆ ComponentModel() [2/2]

template<typename C , typename Derived >
ComponentModel< C, Derived >::ComponentModel ( const QString &  name)
inline

◆ ~ComponentModel()

template<typename C , typename Derived >
virtual ComponentModel< C, Derived >::~ComponentModel ( )
inlinevirtual

Member Function Documentation

◆ caption()

template<typename C , typename Derived >
virtual QString ComponentModel< C, Derived >::caption ( ) const
inlineoverridevirtual

Used to get node caption.

Returns
Node caption

◆ clone()

template<typename C , typename Derived >
virtual std::unique_ptr< QtNodes::NodeDataModel > ComponentModel< C, Derived >::clone ( ) const
inlineoverridevirtual

Creates new node of the same type.

Returns
cloned node

◆ embeddedWidget()

template<typename C , typename Derived >
virtual QWidget * ComponentModel< C, Derived >::embeddedWidget ( )
inlineoverridevirtual

Used to get widget embedded in Node.

Returns
QLabel

◆ getComponent()

template<typename C , typename Derived >
virtual ComponentInterface & ComponentModel< C, Derived >::getComponent ( )
inlineoverridevirtual

Component getter.

Returns
Component managed by model

Implements ComponentModelInterface.

◆ hasSeparateThread()

template<typename C , typename Derived >
virtual bool ComponentModel< C, Derived >::hasSeparateThread ( ) const
inlineoverridevirtual

Implements ComponentModelInterface.

Reimplemented in CanDeviceModel, and CanRawPlayerModel.

◆ initModel()

template<typename C , typename Derived >
virtual void ComponentModel< C, Derived >::initModel ( QtNodes::Node &  node,
int  nodeCnt,
bool  darkMode 
)
inlineoverridevirtual

◆ name()

template<typename C , typename Derived >
virtual QString ComponentModel< C, Derived >::name ( ) const
inlineoverridevirtual

Used to identify model by data model name.

Returns
Node model name

◆ resizable()

template<typename C , typename Derived >
virtual bool ComponentModel< C, Derived >::resizable ( ) const
inlineoverridevirtual

Used to get information if node is resizable.

Returns
false

◆ restore()

template<typename C , typename Derived >
virtual void ComponentModel< C, Derived >::restore ( QJsonObject const &  json)
inlineoverridevirtual

Used to restore node configurations.

Parameters
jsonConstant reference to json object

◆ restored()

template<typename C , typename Derived >
virtual bool ComponentModel< C, Derived >::restored ( )
inlineoverridevirtual

◆ save()

template<typename C , typename Derived >
virtual QJsonObject ComponentModel< C, Derived >::save ( ) const
inlineoverridevirtual

Possibility to save node properties.

Returns
json object

◆ setCaption()

template<typename C , typename Derived >
virtual void ComponentModel< C, Derived >::setCaption ( const QString &  caption)
inlineoverridevirtual

Sets model caption and updates widget title.

Parameters
captionnew caption

Implements ComponentModelInterface.

◆ setColorMode()

template<typename C , typename Derived >
virtual void ComponentModel< C, Derived >::setColorMode ( bool  darkMode)
inlineoverridevirtual

◆ simBcastRcv()

template<typename C , typename Derived >
void ComponentModel< C, Derived >::simBcastRcv ( const QJsonObject &  msg,
const QVariant &  param 
)
inlineoverridevirtual

◆ simBcastSndSlot()

template<typename C , typename Derived >
void ComponentModel< C, Derived >::simBcastSndSlot ( const QJsonObject &  msg,
const QVariant &  param 
)
inlineoverridevirtual

Member Data Documentation

◆ _caption

template<typename C , typename Derived >
QString ComponentModel< C, Derived >::_caption
protected

◆ _component

template<typename C , typename Derived >
C ComponentModel< C, Derived >::_component
protected

◆ _darkMode

template<typename C , typename Derived >
bool ComponentModel< C, Derived >::_darkMode { true }
protected

◆ _id

template<typename C , typename Derived >
QUuid ComponentModel< C, Derived >::_id
protected

◆ _label

template<typename C , typename Derived >
QLabel* ComponentModel< C, Derived >::_label { new QLabel }
protected

◆ _name

template<typename C , typename Derived >
QString ComponentModel< C, Derived >::_name
protected

◆ _nodeStyle

template<typename C , typename Derived >
QtNodes::NodeStyle ComponentModel< C, Derived >::_nodeStyle
protected

◆ _resizable

template<typename C , typename Derived >
bool ComponentModel< C, Derived >::_resizable { false }
protected

◆ _restored

template<typename C , typename Derived >
bool ComponentModel< C, Derived >::_restored { false }
protected

◆ _thread

template<typename C , typename Derived >
std::unique_ptr<QThread> ComponentModel< C, Derived >::_thread
protected

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