ChartsAndCamerasWnd.h 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. #ifndef CHARTSANDCAMERASWND_H
  2. #define CHARTSANDCAMERASWND_H
  3. #include <QMainWindow>
  4. #include <QSlider>
  5. #include <QLineEdit>
  6. #include <QSettings>
  7. #include "chartline.h"
  8. #include "CameraMaterialGroupWnd/MaterialWindow/Wafer.h"
  9. #include "CameraMaterialGroupWnd/MaterialWindow/Waffle.h"
  10. #include "CameraMaterialGroupWnd/MaterialWindow/MaterialBox.h"
  11. // enum OperateMode {
  12. // ModeImage, // 显示图片
  13. // ModeView // 显示 view
  14. // };
  15. namespace Ui {
  16. class ChartsAndCamerasWnd;
  17. }
  18. // struct SeriesInfo {
  19. // QString seriesName;
  20. // QColor lineColor;
  21. // QPixmap markerIcon;
  22. // QList<QPointF> data;
  23. // };
  24. class ChartsAndCamerasWnd : public QMainWindow
  25. {
  26. Q_OBJECT
  27. public:
  28. explicit ChartsAndCamerasWnd(QWidget *parent = nullptr);
  29. ~ChartsAndCamerasWnd();
  30. void initFrom();
  31. void connectSliderAndLineEdit(QSlider* slider, QLineEdit* lineEdit);
  32. void initLineEdits();
  33. void initSliders();
  34. void initProgressBar();
  35. void showAndHide();
  36. protected:
  37. void wheelEvent(QWheelEvent *event) override;
  38. void loadSettings();
  39. void checkSettings();
  40. void loadGroupSettings(int Id, int Index);
  41. void showEvent(QShowEvent *event) override;
  42. void hideEvent(QHideEvent *event) override;
  43. void clearLayout(); // 清除大窗口上当前的布局
  44. void WaferWidget(int Id); // 圆晶
  45. void WaffleWidget(); // 华夫盒
  46. void MaterialBoxWidget(); // 料盒
  47. public slots: // 确保这里声明了槽函数
  48. void handleDoubleClick();
  49. private slots:
  50. void on_ZoomUpButton_clicked();
  51. QPixmap getCurrentPixmap() const {
  52. return currentPixmap;
  53. }
  54. // 通用槽函数
  55. void on_CheckBox_clicked();
  56. void on_ZoomOutButton_clicked();
  57. // void on_GreenDiamondcheckBox_clicked();
  58. // void on_YellowDiamondcheckBox_clicked();
  59. // void on_BlackDiamondcheckBox_clicked();
  60. // void on_BlueDiamondcheckBox_clicked();
  61. // void on_BlueHorizontalLinecheckBox_clicked();
  62. // void on_BlueVerticalBarcheckBox_clicked();
  63. // void on_GreenVerticalBarcheckBox_clicked();
  64. // void on_PurpleVerticalBarcheckBox_clicked();
  65. // void on_RedDiamondcheckBox_clicked();
  66. // void on_RedHorizontalLinecheckBox_clicked();
  67. // void on_WhiteVerticalBarcheckBox_clicked();
  68. private:
  69. Ui::ChartsAndCamerasWnd *ui;
  70. // // 三个 ChartLine 实例
  71. // ChartLine *chartLine;
  72. // ChartLine *chartLine1;
  73. // ChartLine *chartLine2;
  74. // ChartLine 实例
  75. ChartLine *chartLine;
  76. ChartLine *chartLine1;
  77. ChartLine *chartLine2;
  78. // 存储所有系列信息
  79. QMap<QString, DataSeries> m_seriesMap;
  80. // 初始化系列信息
  81. void initializeSeriesInfo();
  82. QPixmap currentPixmap;
  83. qreal scaleFactor;
  84. double previousScaleFactor;
  85. int lastGroupId = -1;
  86. int lastIndex = -1;
  87. Wafer *wafer; // 声明Wafer指针
  88. Waffle *waffle; // 声明Waffle指针
  89. MaterialBox *materialbox; // 声明materialbox指针
  90. bool isShow;
  91. QMap<int, Wafer*> waferMap;
  92. OperateMode currentMode = ModeImage;
  93. QGraphicsView *currentView = nullptr;
  94. QPoint mousePos;
  95. void updateScale(double newScaleFactor); // 更新缩放比例
  96. void applyScale(); // 应用缩放
  97. };
  98. #endif // CHARTSANDCAMERASWND_H