ShowTempPage.h 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. #ifndef SHOWTEMPPAGE_H
  2. #define SHOWTEMPPAGE_H
  3. #include <QWidget>
  4. #include <QPointer>
  5. #include "ShowTemperatureWnd.h"
  6. #include "CManageDB.h"
  7. #include "QListWidget"
  8. namespace Ui {
  9. class ShowTempPage;
  10. }
  11. class ShowTempPage : public QWidget
  12. {
  13. Q_OBJECT
  14. public:
  15. explicit ShowTempPage(QWidget *parent = nullptr);
  16. ~ShowTempPage();
  17. private slots:
  18. void on_idListComboBox_currentIndexChanged(int index);
  19. void on_serialNumberList_itemSelectionChanged();
  20. void on_addBut_clicked();
  21. void on_saveAllBut_clicked();
  22. /**用于删除
  23. */
  24. void GetDelTemperatureListSlots(int iId, int iSerialNumber);
  25. /**修改
  26. */
  27. void GetModifyTemperatureListSlots(const ns_db::TEMPERATURE_LIST_STRUCT& temperaturePar);
  28. private:
  29. void Init();
  30. std::vector<ns_db::TEMPERATURE_LIST_STRUCT> FilterTemperatures(
  31. const std::vector<ns_db::TEMPERATURE_LIST_STRUCT>& originalList);
  32. void UpdataUi(int nIndex, int ncurrentGroupIndex, bool isClear = false);
  33. /**添加删除
  34. */
  35. void AddOrDel(int iId, int iSerialNumber,bool isDel);
  36. /**初始化列表控件
  37. */
  38. void InitSerialNumberList();
  39. /**更新显示参数
  40. */
  41. void UpDataParameter(bool isDel = false, const ns_db::TEMPERATURE_LIST_STRUCT temperaturePar = {});
  42. template <typename Y>
  43. void AddListItem(const ns_db::TEMPERATURE_LIST_STRUCT& temperaturePar,int nIndex,QListWidget* listWidget,const QSize& sizeHint);
  44. private:
  45. Ui::ShowTempPage *ui;
  46. std::map<int, std::vector<ns_db::TEMPERATURE_LIST_STRUCT>> m_groupedById;
  47. /**当前温度列表
  48. */
  49. std::vector<ns_db::TEMPERATURE_LIST_STRUCT> m_vecCurrentTemperatureList;
  50. /** 显示参数
  51. */
  52. QPointer<ShowTemperatureWnd> m_ShowTemperatureWnd;
  53. ns_db::CManageDB* m_manageDB = nullptr;
  54. ns_db::CProduct* m_pProduct = nullptr;
  55. };
  56. #endif // SHOWTEMPPAGE_H