mirror of
https://github.com/Palm1r/QodeAssist.git
synced 2025-07-19 05:24:59 -04:00
feat: Add basic task flow run and edit (#212)
This commit is contained in:
55
TaskFlow/Editor/TaskConnectionItem.hpp
Normal file
55
TaskFlow/Editor/TaskConnectionItem.hpp
Normal file
@ -0,0 +1,55 @@
|
||||
#pragma once
|
||||
|
||||
#include "TaskConnection.hpp"
|
||||
#include <QPointF>
|
||||
#include <QQuickItem>
|
||||
|
||||
namespace QodeAssist::TaskFlow {
|
||||
|
||||
class TaskConnectionItem : public QQuickItem
|
||||
{
|
||||
Q_OBJECT
|
||||
QML_ELEMENT
|
||||
|
||||
Q_PROPERTY(QPointF startPoint READ startPoint NOTIFY startPointChanged)
|
||||
Q_PROPERTY(QPointF endPoint READ endPoint NOTIFY endPointChanged)
|
||||
Q_PROPERTY(
|
||||
TaskConnection *connection READ connection WRITE setConnection NOTIFY connectionChanged)
|
||||
|
||||
Q_PROPERTY(QVariantList taskItems READ taskItems WRITE setTaskItems NOTIFY taskItemsChanged)
|
||||
|
||||
public:
|
||||
TaskConnectionItem(QQuickItem *parent = nullptr);
|
||||
|
||||
QPointF startPoint() const { return m_startPoint; }
|
||||
QPointF endPoint() const { return m_endPoint; }
|
||||
|
||||
TaskConnection *connection() const { return m_connection; }
|
||||
void setConnection(TaskConnection *connection);
|
||||
|
||||
Q_INVOKABLE void updatePositions();
|
||||
|
||||
QVariantList taskItems() const;
|
||||
void setTaskItems(const QVariantList &newTaskItems);
|
||||
|
||||
signals:
|
||||
void startPointChanged();
|
||||
void endPointChanged();
|
||||
void connectionChanged();
|
||||
|
||||
void taskItemsChanged();
|
||||
|
||||
private:
|
||||
void calculatePositions();
|
||||
QQuickItem *findTaskItem(BaseTask *task);
|
||||
QQuickItem *findTaskItemRecursive(QQuickItem *item, BaseTask *task);
|
||||
QQuickItem *findPortItem(QQuickItem *taskItem, TaskPort *port);
|
||||
|
||||
private:
|
||||
TaskConnection *m_connection = nullptr;
|
||||
QPointF m_startPoint;
|
||||
QPointF m_endPoint;
|
||||
QVariantList m_taskItems;
|
||||
};
|
||||
|
||||
} // namespace QodeAssist::TaskFlow
|
Reference in New Issue
Block a user