settingnum.h 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. #ifndef SETTINGNUM_H
  2. #define SETTINGNUM_H
  3. #include <QDialog>
  4. #include "spdlog/spdlog.h"
  5. #include "EyeMapInfo.h"
  6. class OneShadow;
  7. class OneSettingItem;
  8. namespace Ui {
  9. class SettingNum;
  10. }
  11. class SettingNum : public QDialog
  12. {
  13. Q_OBJECT
  14. public:
  15. explicit SettingNum(QDialog *parent = nullptr);
  16. ~SettingNum();
  17. /* 设置行数和列数 */
  18. void setRowAndColumn(int row, int column);
  19. /* 设置每个项的信息 */
  20. void setEveryEyeMapInfo(const QList<OneEyeMapInfo> &listInfo);
  21. /* 设置可用的通道信息 */
  22. void setChannelList(const QList<OneChannelInfo> &listChannelInfo);
  23. /* 刷新布局 */
  24. void refreshLayout();
  25. /* 传入父指针 */
  26. void setParentPtr(QWidget *parent) { m_parent = parent; }
  27. signals:
  28. /* 执行了exec信号 */
  29. void signal_exec();
  30. protected:
  31. /* 事件过滤器 */
  32. bool eventFilter(QObject *watched, QEvent *event) override;
  33. /* 显示事件 */
  34. void showEvent(QShowEvent *event) override;
  35. /* 鼠标点击事件 */
  36. void mousePressEvent(QMouseEvent *event) override;
  37. /* 鼠标移动事件 */
  38. void mouseMoveEvent(QMouseEvent *event) override;
  39. /* 鼠标释放事件 */
  40. void mouseReleaseEvent(QMouseEvent *event) override;
  41. private slots:
  42. /* 关闭按钮槽函数 */
  43. void do_pBtn_close();
  44. /* 点击了OK按钮 */
  45. void do_pBtn_ok();
  46. /* 点击了取消按钮 */
  47. void do_pBtn_cancel();
  48. /* 选择行和列槽函数 */
  49. void do_selectRowAndColumn(int index);
  50. /* 通道选择槽函数,选择了一个通道,取消其他项可能已经选择的相同通道 */
  51. void do_selectChannel(const OscChnNum channel, const QString &channelName);
  52. /* 刷新listWidget */
  53. void do_layoutItem();
  54. /* 重新设置序号并刷新显示 */
  55. void do_setItemNum();
  56. private:
  57. /* 布局item */
  58. void layoutItem(int num);
  59. /* 重新设置Item序号 */
  60. void resetItemNum();
  61. /* 显示或隐藏选项 */
  62. void showOrHide(int num);
  63. public:
  64. int m_row = 0; /* 行 */
  65. int m_column = 0; /* 列 */
  66. bool isOk = false; /* 是否点击了OK按钮 */
  67. private:
  68. Ui::SettingNum *ui;
  69. std::shared_ptr<spdlog::logger> m_logger = nullptr;
  70. QPoint m_lastPos;
  71. QList<OneSettingItem*> m_listItem;
  72. QList<OneChannelInfo> m_listChannelInfo; /* 可用的通道信息 */
  73. QWidget* m_parent = nullptr;
  74. };
  75. #endif // SETTINGNUM_H