widget.h 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. #ifndef WIDGET_H
  2. #define WIDGET_H
  3. #include "global.h"
  4. #include <QWidget>
  5. #include "udphelper.h"
  6. #include "volviewform.h"
  7. #include <QList>
  8. #include <QLabel>
  9. #include <QGraphicsProxyWidget>
  10. #include <QGraphicsView>
  11. namespace Ui {
  12. class Widget;
  13. }
  14. //ST7735驱动
  15. #define ST7735_ERROR
  16. #ifdef ST7735_ERROR
  17. //ST7735 驱动使用GRB红色与蓝色位置相反
  18. #define LABEL_RED "QLabel{color: blue;}"
  19. #define LABEL_GREEN "QLabel{color: rgb(115, 210, 22);}"
  20. #define LABEL_SELECT "background-color:rgb(115, 210, 22);color: white;"
  21. #define LABEL_Defalut "background-color:rgb(0, 0, 0);color: rgb(115, 210, 22);"
  22. #else
  23. #define LABEL_RED "QLabel{color: red;}"
  24. #define LABEL_GREEN "QLabel{color: rgb(115, 210, 22);}"
  25. #define LABEL_SELECT "background-color:rgb(115, 210, 22);color: white;"
  26. #define LABEL_Defalut "background-color:rgb(85, 87, 83);color: rgb(115, 210, 22);"
  27. #endif
  28. class Widget : public QWidget
  29. {
  30. Q_OBJECT
  31. public:
  32. explicit Widget(QWidget *parent = 0);
  33. ~Widget();
  34. void setInitData(QGraphicsProxyWidget* pAngleCtrl, QGraphicsView* pView, int nWidget,int nHight);
  35. //是否显示详细数据
  36. int getShowModeIndex();
  37. int getShowPagIndex();
  38. int getShowSubIndex();
  39. int getShowPHIndex();
  40. void setShowPHIndex(int nIndex);
  41. //更新日期IP
  42. void UpdateDate();
  43. QString ReadIP();
  44. void SetData(QLabel* pLab,QString strShow);
  45. void SetV(QString strShow);
  46. void SetA(QString strShow);
  47. void SetW(QString strShow);
  48. void SetF(QString strShow);
  49. void SetSUM(QString strShow);
  50. void SetIP(QString strIP);
  51. void SetT(QString strShow);
  52. void SetH(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