123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263 |
- #pragma once
- #include "WindowAppBlockStandardBase.h"
- // Parallel工具的接口序号
- #define PARALL_START_INF_INDX 0
- #define PARALL_END_INF_INDX 1
- /// <summary>
- /// 并行计算功能块的封装
- /// </summary>
- class WindowAppBlockParallel : public WindowAppBlockStandardBase
- {
- Q_OBJECT
- Q_INTERFACES(QGraphicsItem)
- public:
- WindowAppBlockParallel(TOOL* pNewTool, POU* Pou, bool bShowOnly = false, QGraphicsObject* parent = nullptr);
- ~WindowAppBlockParallel();
- // 设定本Item的自定义类型
- enum { Type = ITEM_TYPE_PARALLEL };
- int type() const
- {
- // 针对该 item 启用 qgraphicsitem_cast
- return Type;
- }
- // 添加接口(Parallel工具需要额外添加ToolInterface接口)
- virtual void addItemInterfaces();
- // 更新本功能块并行母线的位置
- void updateParallelLine();
- //// 根据移动功能块的Link更新并行母线的位置(Parallel功能块的输出接口)
- //void updateParallelLine(int refLineX);
- protected slots:
- // 绘制并行控件
- void paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget) override;
- // 功能块有变动时
- QVariant itemChange(GraphicsItemChange change, const QVariant& value) override;
- protected:
- // 绘制边框
- void drawFrame(QPainter* painter);
- // 更新矩形区域的尺寸
- virtual void updateRect();
- protected:
- // 并行母线的Item
- WindowAppItemInterface* m_ParallelLineItem;
- };
|