widget.h 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  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. #include "msgwidget.h"
  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(85, 87, 83);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 SetCO2(QString strShow);
  54. void SetVer(QString strShow);
  55. void setCH(int nIndex);
  56. void setPH(int nIndex,int nPhID);
  57. void SetStatus(QString strShow);
  58. //点击事件
  59. //void BtnDown(int nButtonID,int nDownType);
  60. //上翻页
  61. void pageUp();
  62. //下翻页
  63. void pageDown();
  64. //切换页面
  65. void ChangeView(int widgetType,int nIndex);
  66. //modbus设置
  67. void setSelectStatus(int nIndex);
  68. void CtrlBtnSet(int nIndex,int nData);
  69. int nMAXChildIndex;
  70. //显示msg窗口
  71. void ShowMSGWidget(QString strShowData);
  72. //是否显示MSG
  73. bool isHiddenMSGWidget(){
  74. if(m_pMSGWidget)
  75. return m_pMSGWidget->isHidden();
  76. return false;
  77. }
  78. //点击任意按钮确认
  79. void ClickMSGBtn();
  80. signals:
  81. void signal_ClickMSG();//报警确认
  82. public:
  83. Ui::Widget *ui;
  84. private:
  85. UdpHelper* udpHelper;
  86. int device_type ;
  87. int device_chn ;
  88. //QList<VolViewForm*> volView;
  89. //当前显示页面ID
  90. int nChidIndex;
  91. int nChidPHIndex;
  92. int m_nAngle;
  93. QGraphicsProxyWidget* m_pAngleCtrl;
  94. QGraphicsView* m_pView;
  95. int m_nWidth;
  96. int m_nHeight;
  97. MSGWidget* m_pMSGWidget;//提示界面
  98. int nIndexShow;
  99. };
  100. #endif // WIDGET_H