1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 |
- #pragma once
- #include "WindowAppBlockStandardBase.h"
- // Goto工具的接口序号
- #define GOTO_INPUT_INDX 0
- #define GOTO_OUTPUT_INDX 1
- /// <summary>
- /// Goto类型的工具功能块图
- /// </summary>
- class WindowAppBlockGoto : public WindowAppBlockStandardBase
- {
- Q_OBJECT
- // 添加这一行,否则会出现警告:Warning: qobject_cast to QGraphicsItem will not work!
- Q_INTERFACES(QGraphicsItem)
- public:
- WindowAppBlockGoto(TOOL* pNewTool, POU* Pou, bool bShowOnly = false, QGraphicsObject*parent = nullptr);
- ~WindowAppBlockGoto();
- // 绑定输出接口(注意此处是Output绑定到Tool中)
- void bindOutputInterface(const TOOL* pTool);
- // 设定本Item的自定义类型
- enum { Type = ITEM_TYPE_GOTO };
- int type() const
- {
- // 针对该 item 启用 qgraphicsitem_cast
- return Type;
- }
- // 是否bool输入接口取反
- bool m_bNegation;
- protected slots:
- // 绘制Goto控件
- void paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget) override;
- // 双击弹出配置对话框
- void mouseDoubleClickEvent(QGraphicsSceneMouseEvent* event);
- protected:
- // 绘制功能块
- void DrawBlock(QPainter* painter);
- // 更新矩形区域的尺寸
- virtual void updateRect();
- protected:
- // 输出接口的指针
- _INTERFACE* m_pGotoInf;
- };
|