transmitterswitch.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. #ifndef TRANSMITTERSWITCH_H
  2. #define TRANSMITTERSWITCH_H
  3. #include <QWidget>
  4. #include <QVector>
  5. #include <QPushButton>
  6. #include <QLabel>
  7. class WidgetItems;
  8. namespace Ui {
  9. class TransmitterSwitch;
  10. }
  11. class TransmitterSwitch : public QWidget
  12. {
  13. Q_OBJECT
  14. public:
  15. explicit TransmitterSwitch(QWidget *parent = nullptr);
  16. ~TransmitterSwitch();
  17. /* 设置样式表 */
  18. void setQSS(const QString &qssPath);
  19. /* 设置WebAPI信息 */
  20. void setWebAPIInfo(const QString &url, const QString &serverID, const QString &serverKey);
  21. private slots:
  22. /* 每周几的按钮点击了,设置stackedWidegt页面 */
  23. void do_weekpBtn_clicked();
  24. /* 点击了添加计划按钮 */
  25. void do_pBtnAddExecPlan();
  26. /* 添加一项正常日计划 */
  27. void do_addNormalOneItem(QString devName, QString action, QTime execTime);
  28. private:
  29. /* 创建一周8天的item页面 */
  30. void createWeekWidget();
  31. protected:
  32. /* 事件过滤器 */
  33. bool eventFilter(QObject *watched, QEvent *event);
  34. private:
  35. Ui::TransmitterSwitch *ui;
  36. QLabel* m_tipText = nullptr; /* 提示文本 */
  37. QString m_styleSheet; /* 样式表 */
  38. QVector<QPushButton*> m_vecWeeks; /* 存储一周8天的按钮指针,方便后续操作 */
  39. QVector<WidgetItems*> m_vecWidgetItems; /* 存储每周8天的item页面 */
  40. QVector<QLayout*> m_vecLayouts; /* 存储每周8天的layout,item都添加到这里面 */
  41. };
  42. #endif // TRANSMITTERSWITCH_H