DialogBlockProperty.h 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. #pragma once
  2. #include <QDialog>
  3. #include "ui_DialogBlockProperty.h"
  4. #include "Common.h"
  5. // 功能块的属性信息(用于更新和显示)
  6. typedef struct _tagBlockProperty
  7. {
  8. // 接口的显示与隐藏配置
  9. // QHash<const _INTERFACE*, bool> infShowInfo;
  10. QVector<bool> infEnables;
  11. // 工具的Info信息
  12. QString strInfo;
  13. // 工具的实例名称(需要保存旧名字和新名字以备用)
  14. QString strOldInstanceName;
  15. QString strNewInstanceName;
  16. // 工具的其他相关参数
  17. bool bToolEnable; // 是否启用本工具
  18. int nInDelay; // 进入函数时候延时(ms)
  19. int nOutDelay; // 离开函数时的延时(ms)
  20. // 2022-9-28,增加工具新的索引号设置
  21. int nNewIndex;
  22. _tagBlockProperty()
  23. {
  24. bToolEnable = true;
  25. nInDelay = 0;
  26. nOutDelay = 0;
  27. nNewIndex = -1;
  28. }
  29. } BLOCK_PROPERTY, *LPBLOCK_PROPERTY;
  30. /// <summary>
  31. /// 功能块右键弹出的属性对话框
  32. /// </summary>
  33. class POU;
  34. class DialogBlockProperty : public QDialog
  35. {
  36. Q_OBJECT
  37. public:
  38. DialogBlockProperty(TOOL* tool, POU* Pou, QWidget *parent = Q_NULLPTR);
  39. ~DialogBlockProperty();
  40. private:
  41. Ui::DialogBlockProperty ui;
  42. public:
  43. // 获取用户设置的Block参数
  44. BLOCK_PROPERTY getBlockSettings()
  45. {
  46. return blockSettings;
  47. }
  48. private:
  49. // 对话框初始化
  50. void initUI();
  51. // 绘制工具的图像(以及CheckBox)
  52. void initToolBlock();
  53. // 2022-9-28 初始化设置工具Index的ComboBox
  54. void initComboToolIndex();
  55. // 保存用户的设置项
  56. void saveBlockSettings();
  57. private slots:
  58. // Ok按钮
  59. void onButtonOkClicked();
  60. private:
  61. // 本对话框绑定的工具信息
  62. TOOL* m_toolInfo;
  63. // 对话框的配置信息
  64. BLOCK_PROPERTY blockSettings;
  65. // 接口的Checkbox
  66. QVector<QCheckBox*> infCheckBoxs;
  67. // 本Tool所归属的Pou
  68. POU* m_pPou;
  69. };