4#include <QGraphicsItem>
5#include <QGraphicsSvgItem>
8#include "app_configs.h"
21 Type = Types::BASE_NODE
32 NodeBase(
const QString&
id,
const QString&
nodeId, std::shared_ptr<NodeConfig>
config, QGraphicsItem* parent);
51 virtual int type()
const override;
58 virtual QString
nodeId()
const;
65 virtual VoidResult
start();
72 virtual std::shared_ptr<NodeConfig>
config()
const;
88 virtual QRectF nodeRect()
const;
103 virtual QRectF
drawingRect(
const QRectF& input)
const;
111 virtual QPainterPath
nodeShape(
const QRectF& bounds)
const;
121 void paintNode(
const QRectF& bounds,
const QColor& background,
const QPen& text, QPainter* painter);
143 std::shared_ptr<NodeConfig> mConfig;
154 virtual void setPixmap(
const QPixmap& pixmap);
162 virtual void setIcon(
const QString& path,
const QColor& iconColor);
170 virtual void setLabel(
const QString& name, qreal fontSize);
185 virtual void setLabelSize(qreal fontSize,
const QSizeF& boundingSize);
193 virtual void paintLabel(QPainter* painter,
const QRectF& area,
const QPen& pen)
const;
208 bool mPaintLabel =
true;
209 QRectF mScaledBounds;
static const QFont Main
Font constants for the application.
Definition app_configs.h:68
virtual void setLabelSize(qreal fontSize, const QSizeF &boundingSize)
Sets the font size and bounding size for the label.
Definition node_base.cpp:195
virtual void setIcon(const QString &path, const QColor &iconColor)
Sets the icon for the node.
Definition node_base.cpp:212
virtual QString nodeId() const
Retrieves the identifier of the node within its type.
Definition node_base.cpp:47
qreal computeScaleFactor() const
Scaled bounding rectangle of the node.
Definition node_base.cpp:248
virtual QPainterPath nodeShape(const QRectF &bounds) const
Returns the node shape as a QPainterPath.
Definition node_base.cpp:126
QString mLabelText
Bounding rectangle of the node.
Definition node_base.h:206
virtual void setPixmap(const QPixmap &pixmap)
Pointer to the SVG icon item.
Definition node_base.cpp:207
virtual QRectF drawingRect(const QRectF &input) const
Returns the drawing rectangle based on the input rectangle.
Definition node_base.cpp:87
virtual void setLabel(const QString &name, qreal fontSize)
Sets the label text and font size.
Definition node_base.cpp:181
virtual QRectF labelBoundingRect() const
Returns the bounding rectangle of the label.
Definition node_base.cpp:72
virtual QString nodeIcon() const
Retrieves the icon path of the node.
Definition node_base.cpp:275
virtual void toggleLabelVisibility()
Toggles the visibility of the label.
Definition node_base.cpp:201
QGraphicsSvgItem * mIconItem
Path to the icon image.
Definition node_base.h:147
virtual std::shared_ptr< NodeConfig > config() const
Retrieves the configuration settings for the node.
Definition node_base.cpp:57
NodeBase(const QString &id, const QString &nodeId, std::shared_ptr< NodeConfig > config, QGraphicsItem *parent)
Constructs a new NodeBase instance.
Definition node_base.cpp:19
QString id() const
Retrieves the unique identifier of the node.
Definition node_base.cpp:37
virtual QRectF scaledRect() const
Returns the scaled rectangle of the node.
Definition node_base.cpp:82
const QRectF mBounds
Unique identifier of the node.
Definition node_base.h:204
virtual QRectF boundingRect() const override
Returns the bounding rectangle of the node.
Definition node_base.cpp:62
virtual VoidResult start()
Starts the node.
Definition node_base.cpp:52
virtual void paintPixmap(QPainter *painter) const
Paints the pixmap using the provided painter.
Definition node_base.cpp:170
virtual void setLabelName(const QString &name)
Sets the label text.
Definition node_base.cpp:189
virtual void paintLabel(QPainter *painter, const QRectF &area, const QPen &pen) const
Paints the label using the provided painter.
Definition node_base.cpp:155
virtual QPixmap nodePixmap() const
Retrieves the pixmap of the node.
Definition node_base.cpp:261
virtual int type() const override
Returns the type of the node.
Definition node_base.cpp:42
QGraphicsPixmapItem * mPixmapItem
Configuration settings for the node.
Definition node_base.h:145
void paintNode(const QRectF &bounds, const QColor &background, const QPen &text, QPainter *painter)
Paints the node using the provided painter.
Definition node_base.cpp:92
QString mIconPath
Pointer to the pixmap item.
Definition node_base.h:146