widget.h 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. #ifndef WIDGET_H
  2. #define WIDGET_H
  3. #include <QWidget>
  4. #include "udphelper.h"
  5. #include "volviewform.h"
  6. #include <QList>
  7. #include <QLabel>
  8. #include <QGraphicsProxyWidget>
  9. #include <QGraphicsView>
  10. namespace Ui {
  11. class Widget;
  12. }
  13. //ST7735驱动
  14. #define ST7735_ERROR
  15. #ifdef ST7735_ERROR
  16. //ST7735 驱动使用GRB红色与蓝色位置相反
  17. #define LABEL_RED "QLabel{color: blue;}"
  18. #define LABEL_GREEN "QLabel{color: rgb(115, 210, 22);}"
  19. #define LABEL_SELECT "background-color:rgb(115, 210, 22);color: white;"
  20. #define LABEL_Defalut "background-color:rgb(85, 87, 83);color: rgb(115, 210, 22);"
  21. #else
  22. #define LABEL_RED "QLabel{color: red;}"
  23. #define LABEL_GREEN "QLabel{color: rgb(115, 210, 22);}"
  24. #define LABEL_SELECT "background-color:rgb(115, 210, 22);color: white;"
  25. #define LABEL_Defalut "background-color:rgb(85, 87, 83);color: rgb(115, 210, 22);"
  26. #endif
  27. class Widget : public QWidget
  28. {
  29. Q_OBJECT
  30. public:
  31. explicit Widget(QWidget *parent = 0);
  32. ~Widget();
  33. void setInitData(QGraphicsProxyWidget* pAngleCtrl, QGraphicsView* pView, int nWidget,int nHight);
  34. //是否显示详细数据
  35. int getShowModeIndex();
  36. int getShowPagIndex();
  37. int getShowSubIndex();
  38. int getShowPHIndex();
  39. void setShowPHIndex(int nIndex);
  40. //更新日期IP
  41. void UpdateDate();
  42. QString ReadIP();
  43. void SetData(QLabel* pLab,QString strShow);
  44. void SetV(QString strShow);
  45. void SetA(QString strShow);
  46. void SetW(QString strShow);
  47. void SetF(QString strShow);
  48. void SetSUM(QString strShow);
  49. void SetIP(QString strIP);
  50. void SetT(QString strShow);
  51. void SetH(QString strShow);
  52. void SetCO2(QString strShow);
  53. void SetVer(QString strShow);
  54. void setCH(int nIndex);
  55. void setPH(int nIndex,int nPhID);
  56. void SetStatus(QString strShow);
  57. //点击事件
  58. //void BtnDown(int nButtonID,int nDownType);
  59. //上翻页
  60. void pageUp();
  61. //下翻页
  62. void pageDown();
  63. //切换页面
  64. void ChangeView(int widgetType,int nIndex);
  65. //modbus设置
  66. void setSelectStatus(int nIndex);
  67. void CtrlBtnSet(int nIndex,int nData);
  68. int nMAXChildIndex;
  69. public:
  70. Ui::Widget *ui;
  71. private:
  72. UdpHelper* udpHelper;
  73. int device_type ;
  74. int device_chn ;
  75. QList<VolViewForm*> volView;
  76. //当前显示页面ID
  77. int nChidIndex;
  78. int nChidPHIndex;
  79. int m_nAngle;
  80. QGraphicsProxyWidget* m_pAngleCtrl;
  81. QGraphicsView* m_pView;
  82. int m_nWidth;
  83. int m_nHeight;
  84. };
  85. #endif // WIDGET_H