Maki
Formally verfied low-code orchestration
Loading...
Searching...
No Matches
DraggableItem Class Reference

A draggable item in a graphical scene. More...

#include <draggable.h>

Inheritance diagram for DraggableItem:
NodeBase

Public Member Functions

 DraggableItem (const QString &id, std::shared_ptr< NodeConfig > config, QGraphicsItem *parent=nullptr)
 Constructs a new DraggableItem with the given ID, configuration, and parent.
virtual ~DraggableItem ()
 Destroys the DraggableItem.
int type () const override
 Returns the type of this item.
void adjustWidth (int width)
 Adjusts the width of the item.
void startDrag (QGraphicsSceneMouseEvent *event)
 Starts a drag operation based on the given mouse event.
void handleClick (QGraphicsSceneMouseEvent *event)
 Handles a click event based on the given mouse event.
QPainterPath shape () const override
 Returns the shape of this item for collision detection.
void paint (QPainter *painter, const QStyleOptionGraphicsItem *style, QWidget *widget) override
 Paints this item using the given painter and style options.
QRectF nodeRect () const override
 Returns the bounding rectangle of this item.
Public Member Functions inherited from NodeBase
 NodeBase (const QString &id, const QString &nodeId, std::shared_ptr< NodeConfig > config, QGraphicsItem *parent)
 Constructs a new NodeBase instance.
virtual ~NodeBase ()
 Destructor.
QString id () const
 Retrieves the unique identifier of the node.
virtual QString nodeId () const
 Retrieves the identifier of the node within its type.
virtual VoidResult start ()
 Starts the node.
virtual std::shared_ptr< NodeConfig > config () const
 Retrieves the configuration settings for the node.
virtual QRectF boundingRect () const override
 Returns the bounding rectangle of the node.
virtual QRectF labelBoundingRect () const
 Returns the bounding rectangle of the label.
virtual QRectF scaledRect () const
 Returns the scaled rectangle of the node.
virtual QRectF drawingRect (const QRectF &input) const
 Returns the drawing rectangle based on the input rectangle.
virtual QPainterPath nodeShape (const QRectF &bounds) const
 Returns the node shape as a QPainterPath.
void paintNode (const QRectF &bounds, const QColor &background, const QPen &text, QPainter *painter)
 Paints the node using the provided painter.
virtual QPixmap nodePixmap () const
 Retrieves the pixmap of the node.
virtual QString nodeIcon () const
 Retrieves the icon path of the node.
virtual void toggleLabelVisibility ()
 Toggles the visibility of the label.

Additional Inherited Members

Protected Member Functions inherited from NodeBase
virtual void setPixmap (const QPixmap &pixmap)
 Pointer to the SVG icon item.
virtual void setIcon (const QString &path, const QColor &iconColor)
 Sets the icon for the node.
virtual void setLabel (const QString &name, qreal fontSize)
 Sets the label text and font size.
virtual void setLabelName (const QString &name)
 Sets the label text.
virtual void setLabelSize (qreal fontSize, const QSizeF &boundingSize)
 Sets the font size and bounding size for the label.
virtual void paintLabel (QPainter *painter, const QRectF &area, const QPen &pen) const
 Paints the label using the provided painter.
virtual void paintPixmap (QPainter *painter) const
 Paints the pixmap using the provided painter.
Protected Attributes inherited from NodeBase
QGraphicsPixmapItem * mPixmapItem = nullptr
 Configuration settings for the node.
QString mIconPath = ""
 Pointer to the pixmap item.
QGraphicsSvgItem * mIconItem = nullptr
 Path to the icon image.

Detailed Description

A draggable item in a graphical scene.

Constructor & Destructor Documentation

◆ DraggableItem()

DraggableItem::DraggableItem ( const QString & id,
std::shared_ptr< NodeConfig > config,
QGraphicsItem * parent = nullptr )

Constructs a new DraggableItem with the given ID, configuration, and parent.

Parameters
idThe unique identifier for this item.
configThe configuration settings for this item.
parentThe parent QGraphicsItem.

Member Function Documentation

◆ adjustWidth()

void DraggableItem::adjustWidth ( int width)

Adjusts the width of the item.

Parameters
widthThe new width to set.

◆ handleClick()

void DraggableItem::handleClick ( QGraphicsSceneMouseEvent * event)

Handles a click event based on the given mouse event.

Parameters
eventThe QGraphicsSceneMouseEvent that triggered the click.

◆ nodeRect()

QRectF DraggableItem::nodeRect ( ) const
overridevirtual

Returns the bounding rectangle of this item.

Returns
The QRectF representing the bounding rectangle of this item.

Reimplemented from NodeBase.

◆ paint()

void DraggableItem::paint ( QPainter * painter,
const QStyleOptionGraphicsItem * style,
QWidget * widget )
override

Paints this item using the given painter and style options.

Parameters
painterThe QPainter to use for drawing.
styleThe QStyleOptionGraphicsItem containing style options.
widgetThe QWidget associated with the painting.

◆ shape()

QPainterPath DraggableItem::shape ( ) const
override

Returns the shape of this item for collision detection.

Returns
The QPainterPath representing the shape of this item.

◆ startDrag()

void DraggableItem::startDrag ( QGraphicsSceneMouseEvent * event)

Starts a drag operation based on the given mouse event.

Parameters
eventThe QGraphicsSceneMouseEvent that triggered the drag.

◆ type()

int DraggableItem::type ( ) const
overridevirtual

Returns the type of this item.

Returns
The type of this item.

Reimplemented from NodeBase.


The documentation for this class was generated from the following files:
  • /__w/maki/maki/app/elements/draggable.h
  • /__w/maki/maki/app/elements/draggable.cpp