importtemplate.h 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. #ifndef IMPORTTEMPLATE_H
  2. #define IMPORTTEMPLATE_H
  3. #include <QDialog>
  4. #include <QCheckBox>
  5. class TemplateItem;
  6. class OneShadow;
  7. class OneTemplateInfo;
  8. namespace Ui {
  9. class ImportTemplate;
  10. }
  11. class ImportTemplate : public QDialog
  12. {
  13. Q_OBJECT
  14. public:
  15. explicit ImportTemplate(QWidget *parent = nullptr);
  16. ~ImportTemplate();
  17. /* 是否点下了OK */
  18. bool isOk() const { return m_isOk; }
  19. /* 获取选择的模板名称 */
  20. QString getTemplateName() const { return m_templateName; }
  21. /* 设置模版列表 */
  22. void setTemplateList(const QMultiMap<int, OneTemplateInfo>& mapTemplate);
  23. /* 获取选中的模板列表 */
  24. QList<OneTemplateInfo>& getSelectedTemplateList();
  25. /* 设置QSS */
  26. void setQSSPath(const QString& qssPath);
  27. signals:
  28. /* 选择一个模版 */
  29. void signal_templateName(QString name);
  30. private:
  31. /* 添加一行 */
  32. void createRow(const OneTemplateInfo& info);
  33. private slots:
  34. void do_ok();
  35. /* 点击了一个checkBox,取消其他同频率的checkBox */
  36. void do_checkBox_stateChanged(int state);
  37. protected:
  38. /* 显示事件 */
  39. void showEvent(QShowEvent *event) override;
  40. /* 事件过滤器 */
  41. bool eventFilter(QObject *watched, QEvent *event) override;
  42. /* 鼠标点击事件 */
  43. void mousePressEvent(QMouseEvent *event) override;
  44. /* 鼠标移动事件 */
  45. void mouseMoveEvent(QMouseEvent *event) override;
  46. /* 鼠标释放事件 */
  47. void mouseReleaseEvent(QMouseEvent *event) override;
  48. private:
  49. Ui::ImportTemplate *ui;
  50. bool m_isOk = false; /* 是否点下了OK */
  51. QString m_templateName; /* 模版名称 */
  52. int m_type = -1; /* 模版类型 */
  53. QPoint m_lastPos; /* 鼠标点击的位置 */
  54. const std::string m_propertyChnID = "ChannelID"; /* 属性名称 */
  55. const std::string m_propertytmpName = "TemplateName";/* 属性名称 */
  56. QList<QCheckBox*> m_listCheckBox; /* checkBox列表 */
  57. QList<OneTemplateInfo> m_listTemplate; /* 模版列表 */
  58. };
  59. #endif // IMPORTTEMPLATE_H