widget.h 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  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 setCH(int nIndex);
  54. void setPH(int nIndex,int nPhID);
  55. void SetStatus(QString strShow);
  56. //点击事件
  57. //void BtnDown(int nButtonID,int nDownType);
  58. //上翻页
  59. void pageUp();
  60. //下翻页
  61. void pageDown();
  62. //切换页面
  63. void ChangeView(int widgetType,int nIndex);
  64. //modbus设置
  65. void setSelectStatus(int nIndex);
  66. void CtrlBtnSet(int nIndex,int nData);
  67. int nMAXChildIndex;
  68. public:
  69. Ui::Widget *ui;
  70. private:
  71. UdpHelper* udpHelper;
  72. int device_type ;
  73. int device_chn ;
  74. QList<VolViewForm*> volView;
  75. //当前显示页面ID
  76. int nChidIndex;
  77. int nChidPHIndex;
  78. int m_nAngle;
  79. QGraphicsProxyWidget* m_pAngleCtrl;
  80. QGraphicsView* m_pView;
  81. int m_nWidth;
  82. int m_nHeight;
  83. };
  84. #endif // WIDGET_H