瀏覽代碼

GO 添加了另外两个界面的逻辑和风格化实现

Change-Id: Ib7c0f09034e9c9787e62f01c77eedd39ec9971c9
li_xingqi* 4 月之前
父節點
當前提交
8a6787f5f6
共有 100 個文件被更改,包括 3119 次插入222 次删除
  1. 10 10
      Group.cpp
  2. 14 6
      Group.ui
  3. 47 1
      ImageWidget.cpp
  4. 10 25
      ImageWidget.h
  5. 35 0
      ImageWidget_nodrag.cpp
  6. 31 0
      ImageWidget_nodrag.h
  7. 19 0
      ImageWidget_nodrag.ui
  8. 2 4
      Login.cpp
  9. 1 1
      Login.h
  10. 2 2
      Login.ui
  11. 60 60
      MainWnd.cpp
  12. 3 1
      MainWnd.h
  13. 12 12
      MainWnd.ui
  14. 257 0
      OriginalWnd/Demo001_1.cpp
  15. 27 0
      OriginalWnd/Demo001_1.h
  16. 576 8
      OriginalWnd/Demo001_1.ui
  17. 338 0
      OriginalWnd/Demo001_2.cpp
  18. 29 0
      OriginalWnd/Demo001_2.h
  19. 769 9
      OriginalWnd/Demo001_2.ui
  20. 81 19
      OriginalWnd/Demo001_3.cpp
  21. 13 3
      OriginalWnd/Demo001_3.h
  22. 17 17
      OriginalWnd/Demo001_3.ui
  23. 47 11
      OriginalWnd/OriginalWnd.cpp
  24. 10 10
      OriginalWnd/OriginalWnd.h
  25. 10 23
      OriginalWnd/OriginalWnd.ui
  26. 572 0
      OriginalWnd/treeviewmanager.cpp
  27. 106 0
      OriginalWnd/treeviewmanager.h
  28. 21 0
      build/Desktop_Qt_5_15_2_MinGW_64_bit-Debug/.qmake.stash
  29. 二進制
      build/Desktop_Qt_5_15_2_MinGW_64_bit-Debug/.qtc_clangd/.cache/clangd/index/Demo001_1.cpp.240723ABE1FC2C1B.idx
  30. 二進制
      build/Desktop_Qt_5_15_2_MinGW_64_bit-Debug/.qtc_clangd/.cache/clangd/index/Demo001_1.h.68728DEA7E9F2AB3.idx
  31. 二進制
      build/Desktop_Qt_5_15_2_MinGW_64_bit-Debug/.qtc_clangd/.cache/clangd/index/Demo001_2.cpp.2575B014FF9BDD6D.idx
  32. 二進制
      build/Desktop_Qt_5_15_2_MinGW_64_bit-Debug/.qtc_clangd/.cache/clangd/index/Demo001_2.h.0225BC5F9D1244D2.idx
  33. 二進制
      build/Desktop_Qt_5_15_2_MinGW_64_bit-Debug/.qtc_clangd/.cache/clangd/index/Demo001_3.cpp.B3367E8A71A4769A.idx
  34. 二進制
      build/Desktop_Qt_5_15_2_MinGW_64_bit-Debug/.qtc_clangd/.cache/clangd/index/Demo001_3.h.259B6AB845DF963D.idx
  35. 二進制
      build/Desktop_Qt_5_15_2_MinGW_64_bit-Debug/.qtc_clangd/.cache/clangd/index/Group.cpp.A1F5820AF438D13B.idx
  36. 二進制
      build/Desktop_Qt_5_15_2_MinGW_64_bit-Debug/.qtc_clangd/.cache/clangd/index/Group.h.5CE9D4A18E1DC6E3.idx
  37. 二進制
      build/Desktop_Qt_5_15_2_MinGW_64_bit-Debug/.qtc_clangd/.cache/clangd/index/ImageWidget.cpp.FF4AB04D1490A615.idx
  38. 二進制
      build/Desktop_Qt_5_15_2_MinGW_64_bit-Debug/.qtc_clangd/.cache/clangd/index/ImageWidget.h.9B7F833764F22487.idx
  39. 二進制
      build/Desktop_Qt_5_15_2_MinGW_64_bit-Debug/.qtc_clangd/.cache/clangd/index/ImageWidget_nodrag.cpp.2F3DE47BD880054D.idx
  40. 二進制
      build/Desktop_Qt_5_15_2_MinGW_64_bit-Debug/.qtc_clangd/.cache/clangd/index/ImageWidget_nodrag.h.01359DF0C05040E9.idx
  41. 二進制
      build/Desktop_Qt_5_15_2_MinGW_64_bit-Debug/.qtc_clangd/.cache/clangd/index/Login.cpp.18FDEEFCC2C6D7B6.idx
  42. 二進制
      build/Desktop_Qt_5_15_2_MinGW_64_bit-Debug/.qtc_clangd/.cache/clangd/index/Login.h.BF75476C75DAB116.idx
  43. 二進制
      build/Desktop_Qt_5_15_2_MinGW_64_bit-Debug/.qtc_clangd/.cache/clangd/index/MainWnd.cpp.6CC56E51F71517DE.idx
  44. 二進制
      build/Desktop_Qt_5_15_2_MinGW_64_bit-Debug/.qtc_clangd/.cache/clangd/index/MainWnd.h.B9509468BEC18C3E.idx
  45. 二進制
      build/Desktop_Qt_5_15_2_MinGW_64_bit-Debug/.qtc_clangd/.cache/clangd/index/OriginalWnd.cpp.43B66912F8C62F9C.idx
  46. 二進制
      build/Desktop_Qt_5_15_2_MinGW_64_bit-Debug/.qtc_clangd/.cache/clangd/index/OriginalWnd.h.989C5478F0CC3E94.idx
  47. 二進制
      build/Desktop_Qt_5_15_2_MinGW_64_bit-Debug/.qtc_clangd/.cache/clangd/index/QApplication.A93C160D4734A0BE.idx
  48. 二進制
      build/Desktop_Qt_5_15_2_MinGW_64_bit-Debug/.qtc_clangd/.cache/clangd/index/QButtonGroup.CFCE5B2A463A2320.idx
  49. 二進制
      build/Desktop_Qt_5_15_2_MinGW_64_bit-Debug/.qtc_clangd/.cache/clangd/index/QCheckBox.96F115A63B1D41CF.idx
  50. 二進制
      build/Desktop_Qt_5_15_2_MinGW_64_bit-Debug/.qtc_clangd/.cache/clangd/index/QCloseEvent.E4D2C68862FF6332.idx
  51. 二進制
      build/Desktop_Qt_5_15_2_MinGW_64_bit-Debug/.qtc_clangd/.cache/clangd/index/QComboBox.410383E0990DB52F.idx
  52. 二進制
      build/Desktop_Qt_5_15_2_MinGW_64_bit-Debug/.qtc_clangd/.cache/clangd/index/QDateTime.CE24CBEEEE400D46.idx
  53. 二進制
      build/Desktop_Qt_5_15_2_MinGW_64_bit-Debug/.qtc_clangd/.cache/clangd/index/QDebug.1CC754F61714111F.idx
  54. 二進制
      build/Desktop_Qt_5_15_2_MinGW_64_bit-Debug/.qtc_clangd/.cache/clangd/index/QFile.B2307BA2E3F5E29C.idx
  55. 二進制
      build/Desktop_Qt_5_15_2_MinGW_64_bit-Debug/.qtc_clangd/.cache/clangd/index/QFileDialog.B655E7C801A99988.idx
  56. 二進制
      build/Desktop_Qt_5_15_2_MinGW_64_bit-Debug/.qtc_clangd/.cache/clangd/index/QFrame.F5D7679CECCB49E9.idx
  57. 二進制
      build/Desktop_Qt_5_15_2_MinGW_64_bit-Debug/.qtc_clangd/.cache/clangd/index/QJsonArray.C077F93B166448FC.idx
  58. 二進制
      build/Desktop_Qt_5_15_2_MinGW_64_bit-Debug/.qtc_clangd/.cache/clangd/index/QJsonDocument.C35CC7F5A4FAC8E1.idx
  59. 二進制
      build/Desktop_Qt_5_15_2_MinGW_64_bit-Debug/.qtc_clangd/.cache/clangd/index/QJsonObject.B083B46CBFF9C454.idx
  60. 二進制
      build/Desktop_Qt_5_15_2_MinGW_64_bit-Debug/.qtc_clangd/.cache/clangd/index/QLabel.134BBA620E062EBA.idx
  61. 二進制
      build/Desktop_Qt_5_15_2_MinGW_64_bit-Debug/.qtc_clangd/.cache/clangd/index/QLineEdit.6D3E154C6486418E.idx
  62. 二進制
      build/Desktop_Qt_5_15_2_MinGW_64_bit-Debug/.qtc_clangd/.cache/clangd/index/QMainWindow.462130A3C4930C8A.idx
  63. 二進制
      build/Desktop_Qt_5_15_2_MinGW_64_bit-Debug/.qtc_clangd/.cache/clangd/index/QMap.9E85F4BD18F25DCF.idx
  64. 二進制
      build/Desktop_Qt_5_15_2_MinGW_64_bit-Debug/.qtc_clangd/.cache/clangd/index/QMouseEvent.03112649795D4EA2.idx
  65. 二進制
      build/Desktop_Qt_5_15_2_MinGW_64_bit-Debug/.qtc_clangd/.cache/clangd/index/QPainter.5664D055789979A8.idx
  66. 二進制
      build/Desktop_Qt_5_15_2_MinGW_64_bit-Debug/.qtc_clangd/.cache/clangd/index/QPixmap.E7298A4763622FA8.idx
  67. 二進制
      build/Desktop_Qt_5_15_2_MinGW_64_bit-Debug/.qtc_clangd/.cache/clangd/index/QPushButton.BA2ED29E58F574DE.idx
  68. 二進制
      build/Desktop_Qt_5_15_2_MinGW_64_bit-Debug/.qtc_clangd/.cache/clangd/index/QRadioButton.50451BEB931B0889.idx
  69. 二進制
      build/Desktop_Qt_5_15_2_MinGW_64_bit-Debug/.qtc_clangd/.cache/clangd/index/QScrollArea.B65B51F11723F11C.idx
  70. 二進制
      build/Desktop_Qt_5_15_2_MinGW_64_bit-Debug/.qtc_clangd/.cache/clangd/index/QSettings.7946B34C9BE002F7.idx
  71. 二進制
      build/Desktop_Qt_5_15_2_MinGW_64_bit-Debug/.qtc_clangd/.cache/clangd/index/QSlider.507C0577B962E468.idx
  72. 二進制
      build/Desktop_Qt_5_15_2_MinGW_64_bit-Debug/.qtc_clangd/.cache/clangd/index/QStackedWidget.9969D70315C16E27.idx
  73. 二進制
      build/Desktop_Qt_5_15_2_MinGW_64_bit-Debug/.qtc_clangd/.cache/clangd/index/QStandardItemModel.BAF084AADEAD86AD.idx
  74. 二進制
      build/Desktop_Qt_5_15_2_MinGW_64_bit-Debug/.qtc_clangd/.cache/clangd/index/QStatusBar.320C2FECF590F27C.idx
  75. 二進制
      build/Desktop_Qt_5_15_2_MinGW_64_bit-Debug/.qtc_clangd/.cache/clangd/index/QStyleFactory.85E29A082D5B0639.idx
  76. 二進制
      build/Desktop_Qt_5_15_2_MinGW_64_bit-Debug/.qtc_clangd/.cache/clangd/index/QTimer.5919EDDE18EADB9B.idx
  77. 二進制
      build/Desktop_Qt_5_15_2_MinGW_64_bit-Debug/.qtc_clangd/.cache/clangd/index/QToolButton.19517A9893BFA483.idx
  78. 二進制
      build/Desktop_Qt_5_15_2_MinGW_64_bit-Debug/.qtc_clangd/.cache/clangd/index/QTreeView.8838245AA30A31AD.idx
  79. 二進制
      build/Desktop_Qt_5_15_2_MinGW_64_bit-Debug/.qtc_clangd/.cache/clangd/index/QVBoxLayout.D3624E654C6AE2FA.idx
  80. 二進制
      build/Desktop_Qt_5_15_2_MinGW_64_bit-Debug/.qtc_clangd/.cache/clangd/index/QVariant.18E837BA0D1DC18A.idx
  81. 二進制
      build/Desktop_Qt_5_15_2_MinGW_64_bit-Debug/.qtc_clangd/.cache/clangd/index/QWidget.8BA1F7FF12C88F64.idx
  82. 二進制
      build/Desktop_Qt_5_15_2_MinGW_64_bit-Debug/.qtc_clangd/.cache/clangd/index/__stdarg___gnuc_va_list.h.927B679101421888.idx
  83. 二進制
      build/Desktop_Qt_5_15_2_MinGW_64_bit-Debug/.qtc_clangd/.cache/clangd/index/__stdarg___va_copy.h.EBC6A4864E90D5A7.idx
  84. 二進制
      build/Desktop_Qt_5_15_2_MinGW_64_bit-Debug/.qtc_clangd/.cache/clangd/index/__stdarg_va_arg.h.8AB7E6FF1CF58A89.idx
  85. 二進制
      build/Desktop_Qt_5_15_2_MinGW_64_bit-Debug/.qtc_clangd/.cache/clangd/index/__stdarg_va_copy.h.10CDF121A25BB1EB.idx
  86. 二進制
      build/Desktop_Qt_5_15_2_MinGW_64_bit-Debug/.qtc_clangd/.cache/clangd/index/__stdarg_va_list.h.7AACC11FC3EAC2D2.idx
  87. 二進制
      build/Desktop_Qt_5_15_2_MinGW_64_bit-Debug/.qtc_clangd/.cache/clangd/index/__stddef_max_align_t.h.146DF9454A8E4AC2.idx
  88. 二進制
      build/Desktop_Qt_5_15_2_MinGW_64_bit-Debug/.qtc_clangd/.cache/clangd/index/__stddef_null.h.D06DD619A41FB4CB.idx
  89. 二進制
      build/Desktop_Qt_5_15_2_MinGW_64_bit-Debug/.qtc_clangd/.cache/clangd/index/__stddef_nullptr_t.h.3E92F8CD65377B6B.idx
  90. 二進制
      build/Desktop_Qt_5_15_2_MinGW_64_bit-Debug/.qtc_clangd/.cache/clangd/index/__stddef_offsetof.h.E267E9870AF7329C.idx
  91. 二進制
      build/Desktop_Qt_5_15_2_MinGW_64_bit-Debug/.qtc_clangd/.cache/clangd/index/__stddef_ptrdiff_t.h.05B5A0C56F9AD276.idx
  92. 二進制
      build/Desktop_Qt_5_15_2_MinGW_64_bit-Debug/.qtc_clangd/.cache/clangd/index/__stddef_size_t.h.6A38DDE20820A133.idx
  93. 二進制
      build/Desktop_Qt_5_15_2_MinGW_64_bit-Debug/.qtc_clangd/.cache/clangd/index/__stddef_wchar_t.h.656391B36E25A28F.idx
  94. 二進制
      build/Desktop_Qt_5_15_2_MinGW_64_bit-Debug/.qtc_clangd/.cache/clangd/index/__stddef_wint_t.h.DDE87AC288F574EA.idx
  95. 二進制
      build/Desktop_Qt_5_15_2_MinGW_64_bit-Debug/.qtc_clangd/.cache/clangd/index/_mingw.h.8492550075D5A494.idx
  96. 二進制
      build/Desktop_Qt_5_15_2_MinGW_64_bit-Debug/.qtc_clangd/.cache/clangd/index/_mingw_ddk.h.D39B7B0EBFAADDBE.idx
  97. 二進制
      build/Desktop_Qt_5_15_2_MinGW_64_bit-Debug/.qtc_clangd/.cache/clangd/index/_mingw_directx.h.28495A5C2E8B5030.idx
  98. 二進制
      build/Desktop_Qt_5_15_2_MinGW_64_bit-Debug/.qtc_clangd/.cache/clangd/index/_mingw_mac.h.CE8B52168943178B.idx
  99. 二進制
      build/Desktop_Qt_5_15_2_MinGW_64_bit-Debug/.qtc_clangd/.cache/clangd/index/_mingw_off_t.h.439CF20ACEF2F913.idx
  100. 二進制
      build/Desktop_Qt_5_15_2_MinGW_64_bit-Debug/.qtc_clangd/.cache/clangd/index/_mingw_print_pop.h.DF4C76A1FDC7CAAF.idx

+ 10 - 10
Group.cpp

@@ -10,13 +10,13 @@ Group::Group(int Id, const QString& imagePath1, const QString& imagePath2, const
 
     QPixmap pixmap1(imagePath1);
     QPixmap pixmap2(imagePath2);
-    ui->widget_4->setPixmap(pixmap1);
-    ui->widget_5->setPixmap(pixmap2);
+    ui->Imagewidget_left->setPixmap(pixmap1);
+    ui->Imagewidget_right->setPixmap(pixmap2);
 
-    ui->comboBox_3->addItems(textList);
+    ui->DatacomboBox->addItems(textList);
 
-    ui->widget_4->setProperty("groupId", Id);
-    ui->widget_5->setProperty("groupId", Id);
+    ui->Imagewidget_left->setProperty("groupId", Id);
+    ui->Imagewidget_right->setProperty("groupId", Id);
 
     // 存储参数到 QSettings
     saveGroupSettings(Id, imagePath1, imagePath2, textList);
@@ -29,21 +29,21 @@ Group::~Group() {
 }
 
 void Group::initForm() {
-    ui->widget_4->installEventFilter(this);
-    ui->widget_5->installEventFilter(this);
+    ui->Imagewidget_left->installEventFilter(this);
+    ui->Imagewidget_right->installEventFilter(this);
 }
 
 bool Group::eventFilter(QObject *obj, QEvent *event) {
-    if (event->type() == QEvent::MouseButtonPress) {
+    if (event->type() == QEvent::MouseButtonDblClick) {
         QMouseEvent* mouseEvent = static_cast<QMouseEvent*>(event);
         if (mouseEvent->button() == Qt::LeftButton) {
             int groupId = obj->property("groupId").toInt();
             QSettings settings("YourCompany", "YourApplication_");
             settings.setValue("GroupId", groupId);
 
-            if (obj == this->ui->widget_4) {
+            if (obj == this->ui->Imagewidget_left) {
                 settings.setValue("Index", 1);
-            } else if (obj == this->ui->widget_5) {
+            } else if (obj == this->ui->Imagewidget_right) {
                 settings.setValue("Index", 2);
             }
             return true;

+ 14 - 6
Group.ui

@@ -13,7 +13,7 @@
   <property name="windowTitle">
    <string>Form</string>
   </property>
-  <widget class="ImageWidget" name="widget_4" native="true">
+  <widget class="ImageWidget_nodrag" name="Imagewidget_left" native="true">
    <property name="geometry">
     <rect>
      <x>0</x>
@@ -26,7 +26,7 @@
     <string notr="true">background-color: rgb(0, 170, 127);</string>
    </property>
   </widget>
-  <widget class="QComboBox" name="comboBox_3">
+  <widget class="QComboBox" name="DatacomboBox">
    <property name="geometry">
     <rect>
      <x>0</x>
@@ -35,8 +35,12 @@
      <height>32</height>
     </rect>
    </property>
+   <property name="styleSheet">
+    <string notr="true">background-color: rgb(255, 255, 255);</string>
+   </property>
   </widget>
-  <widget class="QPushButton" name="pushButton_2">
+  <widget class="QPushButton" name="GroupButton">
+
    <property name="geometry">
     <rect>
      <x>184</x>
@@ -49,7 +53,9 @@
     <string/>
    </property>
   </widget>
-  <widget class="ImageWidget" name="widget_5" native="true">
+
+  <widget class="ImageWidget_nodrag" name="Imagewidget_right" native="true">
+
    <property name="geometry">
     <rect>
      <x>130</x>
@@ -65,9 +71,11 @@
  </widget>
  <customwidgets>
   <customwidget>
-   <class>ImageWidget</class>
+
+   <class>ImageWidget_nodrag</class>
    <extends>QWidget</extends>
-   <header location="global">ImageWidget.h</header>
+   <header location="global">ImageWidget_nodrag.h</header>
+
    <container>1</container>
   </customwidget>
  </customwidgets>

+ 47 - 1
ImageWidget.cpp

@@ -1,9 +1,12 @@
 #include "ImageWidget.h"
 #include "ui_ImageWidget.h"
+#include <QPainter>
 
 ImageWidget::ImageWidget(QWidget *parent) :
     QWidget(parent),
-    ui(new Ui::ImageWidget)
+    ui(new Ui::ImageWidget),
+    isDragging(false),
+    imageOffset(0, 0)
 {
     ui->setupUi(this);
 }
@@ -12,3 +15,46 @@ ImageWidget::~ImageWidget()
 {
     delete ui;
 }
+
+void ImageWidget::setPixmap(const QPixmap& newPixmap) {
+    this->pixmap = newPixmap;
+    imageOffset = QPoint(0, 0); // 重置图片偏移量为(0, 0)
+    update(); // 触发重绘
+}
+
+void ImageWidget::paintEvent(QPaintEvent *event) {
+    QPainter painter(this);
+    if (!pixmap.isNull()) {
+        // 计算图片左上角坐标,使得图片中心与控件中心对齐
+        int centerX = width() / 2;
+        int centerY = height() / 2;
+        int pixmapCenterX = pixmap.width() / 2;
+        int pixmapCenterY = pixmap.height() / 2;
+        int x = centerX - pixmapCenterX + imageOffset.x();
+        int y = centerY - pixmapCenterY + imageOffset.y();
+        painter.drawPixmap(x, y, pixmap);
+    }
+}
+
+void ImageWidget::mousePressEvent(QMouseEvent *event) {
+    if (event->button() == Qt::LeftButton) {
+        lastMousePos = event->pos(); // 记录鼠标按下时的位置
+        isDragging = true; // 设置正在拖动的标志
+    }
+}
+
+void ImageWidget::mouseMoveEvent(QMouseEvent *event) {
+    if (isDragging && (event->buttons() & Qt::LeftButton)) {
+        QPoint delta = event->pos() - lastMousePos; // 计算鼠标移动的偏移量
+        imageOffset += delta; // 更新图片的偏移量
+        lastMousePos = event->pos(); // 更新鼠标位置
+        update();
+    }
+}
+
+void ImageWidget::mouseReleaseEvent(QMouseEvent *event) {
+    if (event->button() == Qt::LeftButton) {
+        isDragging = false; // 重置正在拖动的标志
+    }
+}
+

+ 10 - 25
ImageWidget.h

@@ -2,8 +2,8 @@
 #define IMAGEWIDGET_H
 
 #include <QWidget>
-#include <QStyleOption>
-#include <QPainter>
+#include <QPixmap>
+#include <QMouseEvent>
 
 namespace Ui {
 class ImageWidget;
@@ -17,35 +17,20 @@ public:
     explicit ImageWidget(QWidget *parent = nullptr);
     ~ImageWidget();
 
-    void setPixmap(const QPixmap& pixmap) {
-        this->pixmap = pixmap;
-        update(); // 触发重绘
-    }
+    void setPixmap(const QPixmap& pixmap);
 
 protected:
-    void paintEvent(QPaintEvent* event) override {
-        QPainter painter(this);
-        if (!pixmap.isNull()) {
-            // 获取窗口的中心点坐标
-            int centerX = width() / 2;
-            int centerY = height() / 2;
-
-            // 计算pixmap的中心点坐标
-            int pixmapCenterX = pixmap.width() / 2;
-            int pixmapCenterY = pixmap.height() / 2;
-
-            // 计算pixmap左上角的坐标,使其中心与窗口中心对齐
-            int x = centerX - pixmapCenterX;
-            int y = centerY - pixmapCenterY;
-
-            // 在计算出的位置绘制 pixmap
-            painter.drawPixmap(x, y, pixmap);
-        }
-    }
+    void paintEvent(QPaintEvent *event) override;
+    void mousePressEvent(QMouseEvent *event) override;
+    void mouseMoveEvent(QMouseEvent *event) override;
+    void mouseReleaseEvent(QMouseEvent *event) override;
 
 private:
     Ui::ImageWidget *ui;
     QPixmap pixmap;
+    QPoint lastMousePos;  // 上一次鼠标的位置
+    QPoint imageOffset;  // 图片的偏移量
+    bool isDragging;     // 是否正在拖动
 };
 
 #endif // IMAGEWIDGET_H

+ 35 - 0
ImageWidget_nodrag.cpp

@@ -0,0 +1,35 @@
+#include "ImageWidget_nodrag.h"
+#include "ui_ImageWidget_nodrag.h"
+#include <QPainter>
+
+ImageWidget_nodrag::ImageWidget_nodrag(QWidget *parent)
+    : QWidget(parent)
+    , ui(new Ui::ImageWidget_nodrag),
+    imageOffset(0, 0)
+{
+    ui->setupUi(this);
+}
+
+ImageWidget_nodrag::~ImageWidget_nodrag()
+{
+    delete ui;
+}
+
+void ImageWidget_nodrag::setPixmap(const QPixmap& newPixmap) {
+    this->pixmap = newPixmap;
+    imageOffset = QPoint(0, 0);
+    update();
+}
+
+void ImageWidget_nodrag::paintEvent(QPaintEvent *event) {
+    QPainter painter(this);
+    if (!pixmap.isNull()) {
+        int centerX = width() / 2;
+        int centerY = height() / 2;
+        int pixmapCenterX = pixmap.width() / 2;
+        int pixmapCenterY = pixmap.height() / 2;
+        int x = centerX - pixmapCenterX + imageOffset.x();
+        int y = centerY - pixmapCenterY + imageOffset.y();
+        painter.drawPixmap(x, y, pixmap);
+    }
+}

+ 31 - 0
ImageWidget_nodrag.h

@@ -0,0 +1,31 @@
+#ifndef IMAGEWIDGET_NODRAG_H
+#define IMAGEWIDGET_NODRAG_H
+
+#include <QWidget>
+
+namespace Ui {
+class ImageWidget_nodrag;
+}
+
+class ImageWidget_nodrag : public QWidget
+{
+    Q_OBJECT
+
+public:
+    explicit ImageWidget_nodrag(QWidget *parent = nullptr);
+    ~ImageWidget_nodrag();
+
+    void setPixmap(const QPixmap& pixmap);
+
+protected:
+    void paintEvent(QPaintEvent *event) override;
+
+
+private:
+    Ui::ImageWidget_nodrag *ui;
+    QPixmap pixmap;
+    QPoint imageOffset;  // 图片的偏移量
+
+};
+
+#endif // IMAGEWIDGET_NODRAG_H

+ 19 - 0
ImageWidget_nodrag.ui

@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>ImageWidget_nodrag</class>
+ <widget class="QWidget" name="ImageWidget_nodrag">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>400</width>
+    <height>300</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>Form</string>
+  </property>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>

+ 2 - 4
Login.cpp

@@ -23,7 +23,7 @@ void Login::initForm()
 {
     QPixmap pixmap(":/images/logo.png");
     QPixmap scaledPixmap = pixmap.scaled(283, 40, Qt::KeepAspectRatio);
-    ui->label->setPixmap(scaledPixmap);
+    ui->label_logo->setPixmap(scaledPixmap);
 
     ui->userNameLineEdit->setPlaceholderText("Please enter the account number");
     ui->passLineEdit->setPlaceholderText("Please enter your password");
@@ -36,7 +36,7 @@ void Login::onUserNameChanged(const QString &userName) {
     settings.setValue("userName", userName);
 }
 
-void Login::on_pushButton_clicked()
+void Login::on_SinginButton_clicked()
 {
     if (QStackedWidget *parent = qobject_cast<QStackedWidget*>(this->parentWidget())) {
         OriginalWnd *originalWnd = new OriginalWnd(this);
@@ -44,5 +44,3 @@ void Login::on_pushButton_clicked()
         parent->setCurrentIndex(parent->indexOf(originalWnd));
     }
 }
-
-

+ 1 - 1
Login.h

@@ -18,7 +18,7 @@ public:
     void initForm();
 
 private slots:
-    void on_pushButton_clicked();
+    void on_SinginButton_clicked();
     void onUserNameChanged(const QString &userName);
 
 private:

+ 2 - 2
Login.ui

@@ -56,7 +56,7 @@
       <enum>QLineEdit::Password</enum>
      </property>
     </widget>
-    <widget class="QPushButton" name="pushButton">
+    <widget class="QPushButton" name="SinginButton">
      <property name="geometry">
       <rect>
        <x>58</x>
@@ -69,7 +69,7 @@
       <string>Sing in</string>
      </property>
     </widget>
-    <widget class="QLabel" name="label">
+    <widget class="QLabel" name="label_logo">
      <property name="geometry">
       <rect>
        <x>134</x>

+ 60 - 60
MainWnd.cpp

@@ -33,29 +33,29 @@ void MainWnd::initForm()
     ui->label_logo->setPixmap(scaledPixmap);
 
     Login *login = new Login;
-    ui->stackedWidget_3->addWidget(login);
-    ui->stackedWidget_3->setCurrentIndex(ui->stackedWidget_3->indexOf(login));
+    ui->stackedWidget_UI->addWidget(login);
+    ui->stackedWidget_UI->setCurrentIndex(ui->stackedWidget_UI->indexOf(login));
 
     //登录监听
     ui->label_logo->installEventFilter(this);
 
-    ui->stackedWidget_3->installEventFilter(this);
+    ui->stackedWidget_UI->installEventFilter(this);
 
     //安装监听事件,点击左侧按钮图标变化
-    ui->tabBondBtn->installEventFilter(this);
-    ui->tabBondBtn_2->installEventFilter(this);
-    ui->tabBondBtn_3->installEventFilter(this);
-    ui->tabBondBtn_4->installEventFilter(this);
-    ui->tabBondBtn_5->installEventFilter(this);
-    ui->tabBondBtn_6->installEventFilter(this);
-    ui->tabBondBtn_7->installEventFilter(this);
-    ui->tabBondBtn_8->installEventFilter(this);
-    ui->tabBondBtn_9->installEventFilter(this);
+    ui->tabHomeBtn->installEventFilter(this);
+    ui->tabProductionBtn->installEventFilter(this);
+    ui->tabProgramBtn->installEventFilter(this);
+    ui->tabMessageBtn->installEventFilter(this);
+    ui->tabModuleBtn->installEventFilter(this);
+    ui->tabDispositionBtn->installEventFilter(this);
+    ui->tabDiagnosisBtn->installEventFilter(this);
+    ui->tabSystemBtn->installEventFilter(this);
+    ui->tabHelpBtn->installEventFilter(this);
 }
 
 bool MainWnd::eventFilter(QObject *obj, QEvent *event)
 {
-    if (obj == this->ui->stackedWidget_3)
+    if (obj == this->ui->stackedWidget_UI)
     {
         onCurrentWidgetChanged();
     }
@@ -71,8 +71,8 @@ bool MainWnd::eventFilter(QObject *obj, QEvent *event)
             if (mouseenevt->button() == Qt::LeftButton)
             {
                 Login *login = new Login;
-                ui->stackedWidget_3->addWidget(login);
-                ui->stackedWidget_3->setCurrentIndex(ui->stackedWidget_3->indexOf(login));
+                ui->stackedWidget_UI->addWidget(login);
+                ui->stackedWidget_UI->setCurrentIndex(ui->stackedWidget_UI->indexOf(login));
                 return true;
             }
         }
@@ -101,15 +101,15 @@ bool MainWnd::eventFilter(QObject *obj, QEvent *event)
             for (int i = 0; i < buttonNames.size(); ++i) {
                 QToolButton* currentButton = nullptr;
                 switch (i) {
-                case 0: currentButton = ui->tabBondBtn; break;
-                case 1: currentButton = ui->tabBondBtn_2; break;
-                case 2: currentButton = ui->tabBondBtn_3; break;
-                case 3: currentButton = ui->tabBondBtn_4; break;
-                case 4: currentButton = ui->tabBondBtn_5; break;
-                case 5: currentButton = ui->tabBondBtn_6; break;
-                case 6: currentButton = ui->tabBondBtn_7; break;
-                case 7: currentButton = ui->tabBondBtn_8; break;
-                case 8: currentButton = ui->tabBondBtn_9; break;
+                case 0: currentButton = ui->tabHomeBtn; break;
+                case 1: currentButton = ui->tabProductionBtn; break;
+                case 2: currentButton = ui->tabProgramBtn; break;
+                case 3: currentButton = ui->tabMessageBtn; break;
+                case 4: currentButton = ui->tabModuleBtn; break;
+                case 5: currentButton = ui->tabDispositionBtn; break;
+                case 6: currentButton = ui->tabDiagnosisBtn; break;
+                case 7: currentButton = ui->tabSystemBtn; break;
+                case 8: currentButton = ui->tabHelpBtn; break;
                 }
 
                 if (currentButton) {
@@ -159,58 +159,58 @@ bool MainWnd::eventFilter(QObject *obj, QEvent *event)
 }
 
 void MainWnd::onCurrentWidgetChanged() {
-    QWidget *currentWidget = ui->stackedWidget_3->currentWidget();
+    QWidget *currentWidget = ui->stackedWidget_UI->currentWidget();
     if (currentWidget) {
         QString currentWidgetName = currentWidget->objectName();
 
         if (currentWidgetName == "Login") {
             QString styleSheet = "QToolButton:disabled { color: #808080; }"; // 设置禁用状态下的文本颜色为灰色
-            ui->tabBondBtn->setDisabled(true);
-            ui->tabBondBtn->setStyleSheet(styleSheet);
-            ui->tabBondBtn_2->setDisabled(true);
-            ui->tabBondBtn_2->setStyleSheet(styleSheet);
-            ui->tabBondBtn_3->setDisabled(true);
-            ui->tabBondBtn_3->setStyleSheet(styleSheet);
-            ui->tabBondBtn_4->setDisabled(true);
-            ui->tabBondBtn_4->setStyleSheet(styleSheet);
-            ui->tabBondBtn_5->setDisabled(true);
-            ui->tabBondBtn_5->setStyleSheet(styleSheet);
-            ui->tabBondBtn_6->setDisabled(true);
-            ui->tabBondBtn_6->setStyleSheet(styleSheet);
-            ui->tabBondBtn_7->setDisabled(true);
-            ui->tabBondBtn_7->setStyleSheet(styleSheet);
-            ui->tabBondBtn_8->setDisabled(true);
-            ui->tabBondBtn_8->setStyleSheet(styleSheet);
-            ui->tabBondBtn_9->setDisabled(true);
-            ui->tabBondBtn_9->setStyleSheet(styleSheet);
+            ui->tabHomeBtn->setDisabled(true);
+            ui->tabHomeBtn->setStyleSheet(styleSheet);
+            ui->tabProductionBtn->setDisabled(true);
+            ui->tabProductionBtn->setStyleSheet(styleSheet);
+            ui->tabProgramBtn->setDisabled(true);
+            ui->tabProgramBtn->setStyleSheet(styleSheet);
+            ui->tabMessageBtn->setDisabled(true);
+            ui->tabMessageBtn->setStyleSheet(styleSheet);
+            ui->tabModuleBtn->setDisabled(true);
+            ui->tabModuleBtn->setStyleSheet(styleSheet);
+            ui->tabDispositionBtn->setDisabled(true);
+            ui->tabDispositionBtn->setStyleSheet(styleSheet);
+            ui->tabDiagnosisBtn->setDisabled(true);
+            ui->tabDiagnosisBtn->setStyleSheet(styleSheet);
+            ui->tabSystemBtn->setDisabled(true);
+            ui->tabSystemBtn->setStyleSheet(styleSheet);
+            ui->tabHelpBtn->setDisabled(true);
+            ui->tabHelpBtn->setStyleSheet(styleSheet);
         } else {
-            ui->tabBondBtn->setDisabled(false);
-            ui->tabBondBtn_2->setDisabled(false);
-            ui->tabBondBtn_3->setDisabled(false);
-            ui->tabBondBtn_4->setDisabled(false);
-            ui->tabBondBtn_5->setDisabled(false);
-            ui->tabBondBtn_6->setDisabled(false);
-            ui->tabBondBtn_7->setDisabled(false);
-            ui->tabBondBtn_8->setDisabled(false);
-            ui->tabBondBtn_9->setDisabled(false);
+            ui->tabHomeBtn->setDisabled(false);
+            ui->tabProductionBtn->setDisabled(false);
+            ui->tabProgramBtn->setDisabled(false);
+            ui->tabMessageBtn->setDisabled(false);
+            ui->tabModuleBtn->setDisabled(false);
+            ui->tabDispositionBtn->setDisabled(false);
+            ui->tabDiagnosisBtn->setDisabled(false);
+            ui->tabSystemBtn->setDisabled(false);
+            ui->tabHelpBtn->setDisabled(false);
         }
 
         if (currentWidgetName == "OriginalWnd") {
-            ui->tabBondBtn->setIcon(QIcon(":/images/deep/home.png"));
-            ui->tabBondBtn->setChecked(true);
-            ui->tabBondBtn->setStyleSheet("background:qlineargradient(spread:pad,x1:0,y1:0,x2:0,y2:1,stop:0 #949FE8,stop:1 #2D309B);color:#FFFFFF;");
-            ui->tabBondBtn->update();
+            ui->tabHomeBtn->setIcon(QIcon(":/images/deep/home.png"));
+            ui->tabHomeBtn->setChecked(true);
+            ui->tabHomeBtn->setStyleSheet("background:qlineargradient(spread:pad,x1:0,y1:0,x2:0,y2:1,stop:0 #949FE8,stop:1 #2D309B);color:#FFFFFF;");
+            ui->tabHomeBtn->update();
         } else {
-            ui->tabBondBtn->setStyleSheet(""); // 恢复默认样式
+            // ui->tabHomeBtn->setStyleSheet(""); // 恢复默认样式
         }
     }
 }
 
-void MainWnd::on_tabBondBtn_clicked()
+void MainWnd::on_tabHomeBtn_clicked()
 {
     OriginalWnd *originalWnd = new OriginalWnd(this);
-    ui->stackedWidget_3->addWidget(originalWnd);
-    ui->stackedWidget_3->setCurrentIndex(ui->stackedWidget_3->indexOf(originalWnd));
+    ui->stackedWidget_UI->addWidget(originalWnd);
+    ui->stackedWidget_UI->setCurrentIndex(ui->stackedWidget_UI->indexOf(originalWnd));
 }
 
 void MainWnd::on_pushButton_clicked()

+ 3 - 1
MainWnd.h

@@ -26,12 +26,14 @@ private slots:
     void onCurrentWidgetChanged();
 
 
-    void on_tabBondBtn_clicked();
+    void on_tabHomeBtn_clicked();
 
 
     void on_pushButton_clicked();
 
 private:
     Ui::MainWnd *ui;
+
+
 };
 #endif // MAINWND_H

+ 12 - 12
MainWnd.ui

@@ -32,7 +32,7 @@
     <property name="styleSheet">
      <string notr="true"/>
     </property>
-    <widget class="QToolButton" name="tabBondBtn">
+    <widget class="QToolButton" name="tabHomeBtn">
      <property name="geometry">
       <rect>
        <x>13</x>
@@ -124,7 +124,7 @@
       <enum>Qt::Horizontal</enum>
      </property>
     </widget>
-    <widget class="QToolButton" name="tabBondBtn_2">
+    <widget class="QToolButton" name="tabProductionBtn">
      <property name="geometry">
       <rect>
        <x>13</x>
@@ -174,7 +174,7 @@
       <enum>Qt::ToolButtonTextUnderIcon</enum>
      </property>
     </widget>
-    <widget class="QToolButton" name="tabBondBtn_3">
+    <widget class="QToolButton" name="tabProgramBtn">
      <property name="geometry">
       <rect>
        <x>13</x>
@@ -224,7 +224,7 @@
       <enum>Qt::ToolButtonTextUnderIcon</enum>
      </property>
     </widget>
-    <widget class="QToolButton" name="tabBondBtn_4">
+    <widget class="QToolButton" name="tabMessageBtn">
      <property name="geometry">
       <rect>
        <x>13</x>
@@ -274,7 +274,7 @@
       <enum>Qt::ToolButtonTextUnderIcon</enum>
      </property>
     </widget>
-    <widget class="QToolButton" name="tabBondBtn_5">
+    <widget class="QToolButton" name="tabModuleBtn">
      <property name="geometry">
       <rect>
        <x>13</x>
@@ -324,7 +324,7 @@
       <enum>Qt::ToolButtonTextUnderIcon</enum>
      </property>
     </widget>
-    <widget class="QToolButton" name="tabBondBtn_6">
+    <widget class="QToolButton" name="tabDispositionBtn">
      <property name="geometry">
       <rect>
        <x>13</x>
@@ -374,7 +374,7 @@
       <enum>Qt::ToolButtonTextUnderIcon</enum>
      </property>
     </widget>
-    <widget class="QToolButton" name="tabBondBtn_7">
+    <widget class="QToolButton" name="tabDiagnosisBtn">
      <property name="geometry">
       <rect>
        <x>13</x>
@@ -424,7 +424,7 @@
       <enum>Qt::ToolButtonTextUnderIcon</enum>
      </property>
     </widget>
-    <widget class="QToolButton" name="tabBondBtn_8">
+    <widget class="QToolButton" name="tabSystemBtn">
      <property name="geometry">
       <rect>
        <x>13</x>
@@ -474,7 +474,7 @@
       <enum>Qt::ToolButtonTextUnderIcon</enum>
      </property>
     </widget>
-    <widget class="QToolButton" name="tabBondBtn_9">
+    <widget class="QToolButton" name="tabHelpBtn">
      <property name="geometry">
       <rect>
        <x>13</x>
@@ -538,7 +538,7 @@
      </property>
     </widget>
    </widget>
-   <widget class="QStackedWidget" name="stackedWidget_3">
+   <widget class="QStackedWidget" name="stackedWidget_UI">
     <property name="geometry">
      <rect>
       <x>136</x>
@@ -547,9 +547,9 @@
       <height>1049</height>
      </rect>
     </property>
-    <widget class="QWidget" name="stackedWidget_3Page1"/>
+    <widget class="QWidget" name="stackedWidget_UIPage1"/>
    </widget>
-   <zorder>stackedWidget_3</zorder>
+   <zorder>stackedWidget_UI</zorder>
    <zorder>TabSideBar</zorder>
   </widget>
  </widget>

+ 257 - 0
OriginalWnd/Demo001_1.cpp

@@ -1,14 +1,271 @@
 #include "Demo001_1.h"
 #include "ui_Demo001_1.h"
+#include <QSettings>
+#include <QCloseEvent>
+#include "Group.h"
+#include <QVBoxLayout>
+#include <QTimer>
 
 Demo001_1::Demo001_1(QWidget *parent)
     : QMainWindow(parent)
     , ui(new Ui::Demo001_1)
 {
     ui->setupUi(this);
+
+    // initFrom();
 }
 
 Demo001_1::~Demo001_1()
 {
     delete ui;
 }
+
+void Demo001_1::initFrom() {
+    QTimer *timer = new QTimer(this);
+    connect(timer, &QTimer::timeout, this, &Demo001_1::checkSettings);
+    timer->start(100);
+
+    ui->label_Percentage->setAlignment(Qt::AlignCenter);
+
+    // 设置右下部分
+    // loadSliderStates();
+
+    initSliders();
+    initLineEdits();
+
+    connectSliderAndLineEdit(ui->verticalSlider, ui->lineEdit);
+    connectSliderAndLineEdit(ui->verticalSlider_2, ui->lineEdit_2);
+    connectSliderAndLineEdit(ui->verticalSlider_3, ui->lineEdit_3);
+    connectSliderAndLineEdit(ui->verticalSlider_4, ui->lineEdit_4);
+    connectSliderAndLineEdit(ui->verticalSlider_7, ui->lineEdit_7);
+    connectSliderAndLineEdit(ui->verticalSlider_8, ui->lineEdit_8);
+
+    QWidget *viewport = ui->scrollArea->viewport();
+    QWidget *container = new QWidget(viewport);
+
+    // 创建水平布局
+    QHBoxLayout *mainLayout = new QHBoxLayout(container);
+
+    // 创建两个垂直布局,分别用于左右两排
+    QVBoxLayout *leftLayout = new QVBoxLayout();
+    QVBoxLayout *rightLayout = new QVBoxLayout();
+
+    leftLayout->setSpacing(16); // 设置Group之间的间隔距离
+    leftLayout->setMargin(0);
+    rightLayout->setSpacing(16); // 设置Group之间的间隔距离
+    rightLayout->setMargin(0);
+
+    // 添加控件到左侧布局
+    QStringList dispmodel;
+    dispmodel << "P die align" << "D device align";
+    Group *widget = new Group(6, ":/images/test_image/image_1.png", ":/images/test_image/image_2.png", dispmodel, this);
+    leftLayout->addWidget(widget);
+
+    QStringList dispmodel1;
+    dispmodel1 << "D device align" << "P die align";
+    Group *widget_1 = new Group(7, ":/images/test_image/image_3.png", ":/images/test_image/image_4.png", dispmodel1, this);
+    leftLayout->addWidget(widget_1);
+
+    // 添加控件到右侧布局
+    QStringList dispmodel2;
+    dispmodel2 << "B device align" << "P die align";
+    Group *widget_2 = new Group(8, ":/images/test_image/image_5.png", ":/images/test_image/image_6.png", dispmodel2, this);
+    rightLayout->addWidget(widget_2);
+
+    QStringList dispmodel3;
+    dispmodel3 << "U die align" << "D device align";
+    Group *widget_3 = new Group(9, ":/images/test_image/image_7.png", ":/images/test_image/image_8.png", dispmodel3, this);
+    rightLayout->addWidget(widget_3);
+
+    // 添加最后一个控件到左侧布局
+    // Group *widget_4 = new Group(5, ":/images/test_image/image.png", ":/images/test_image/image_2.png", dispmodel, this);
+    // leftLayout->addWidget(widget_4);
+
+    // 设置控件的最小高度和最大宽度
+    int minHeight = 162;
+    int maxWidth = 244;
+    QWidgetList widgets = {widget, widget_1, widget_2, widget_3, /*widget_4*/};
+    for (QWidget *w : widgets) {
+        w->setMinimumHeight(minHeight);
+        w->setMaximumWidth(maxWidth);
+    }
+
+    mainLayout->addLayout(leftLayout);
+    mainLayout->addSpacing(8);
+    mainLayout->addLayout(rightLayout);
+
+    mainLayout->setContentsMargins(0, 0, 0, 0);
+
+    container->setLayout(mainLayout);
+    ui->scrollArea->setWidget(container);
+    ui->scrollArea->resize(521, 162);
+
+    ui->Operatewidget->setMouseTracking(true);
+}
+
+void Demo001_1::initSliders() {
+    QList<QSlider*> sliders = {
+        ui->verticalSlider, ui->verticalSlider_2, ui->verticalSlider_3,
+        ui->verticalSlider_4, ui->verticalSlider_7, ui->verticalSlider_8
+    };
+    QList<int> initialValues = {11, 22, 9, 11, 0, 0};
+
+    for (int i = 0; i < sliders.size(); ++i) {
+        sliders[i]->setMinimum(0);
+        sliders[i]->setMaximum(100);
+        sliders[i]->setValue(initialValues[i]);
+    }
+}
+
+void Demo001_1::initLineEdits() {
+    QList<QLineEdit*> lineEdits = {
+        ui->lineEdit, ui->lineEdit_2, ui->lineEdit_3,
+        ui->lineEdit_4, ui->lineEdit_7, ui->lineEdit_8
+    };
+
+    for (QLineEdit* lineEdit : lineEdits) {
+        lineEdit->setAlignment(Qt::AlignCenter);
+    }
+}
+
+void Demo001_1::connectSliderAndLineEdit(QSlider* slider, QLineEdit* lineEdit)
+{
+    QIntValidator* validator = new QIntValidator(slider->minimum(), slider->maximum(), lineEdit);
+    lineEdit->setValidator(validator);
+
+    connect(slider, &QSlider::valueChanged, [lineEdit](int value) {
+        lineEdit->setText(QString::number(value));
+    });
+
+    connect(lineEdit, &QLineEdit::textChanged, [slider](const QString &text) {
+        bool ok;
+        int value = text.toInt(&ok);
+        if (ok && value >= slider->minimum() && value <= slider->maximum()) {
+            slider->setValue(value);
+        } else if (!text.isEmpty()) {
+            int closestValue = qMin(qMax(text.toInt(&ok), slider->minimum()), slider->maximum());
+            slider->setValue(closestValue);
+        }
+    });
+}
+
+void Demo001_1::checkSettings() {
+    static int lastGroupId = -1;
+    static int lastIndex = -1;
+
+    QSettings settings("YourCompany", "YourApplication_");
+    int groupId = settings.value("GroupId", 0).toInt();
+    int index = settings.value("Index", 0).toInt();
+
+    if (groupId != lastGroupId || index != lastIndex) {
+        lastGroupId = groupId;
+        lastIndex = index;
+        loadSettings();
+    }
+}
+
+void Demo001_1::loadSettings()
+{
+    QSettings settings("YourCompany", "YourApplication_");
+    int groupId = settings.value("GroupId", 0).toInt();
+    int index = settings.value("Index", 0).toInt();
+    loadGroupSettings(groupId, index);
+}
+
+void Demo001_1::loadGroupSettings(int Id, int Index) {
+    QSettings settings("YourOrganization", "YourApplication");
+    settings.beginGroup(QString::number(Id));
+    QString imagePath1 = settings.value("ImagePath1").toString();
+    QString imagePath2 = settings.value("ImagePath2").toString();
+    QStringList textList = settings.value("TextList").toStringList();
+    settings.endGroup();
+
+    QSize size = ui->Operatewidget->size();
+
+    QPixmap newPixmap;
+    if (Index == 1) {
+        newPixmap = QPixmap(imagePath1);
+    } else if (Index == 2) {
+        newPixmap = QPixmap(imagePath2);
+    } else {
+        newPixmap = QPixmap(":/images/test_image/image.png");
+    }
+
+    QPixmap scaledPixmap = newPixmap.scaled(size, Qt::KeepAspectRatio, Qt::SmoothTransformation);
+    ui->Operatewidget->setPixmap(scaledPixmap);
+
+    // 更新当前图片的成员变量
+    currentPixmap = scaledPixmap;
+    scaleFactor = 1.0;
+    ui->label_Percentage->setText("100%");
+
+    ui->DatacomboBox->clear();
+    ui->DatacomboBox->addItems(textList);
+    // connect(ui->DatacomboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(Demo001_3::onComboBoxIndexChanged(int)));
+}
+
+void Demo001_1::on_ZoomUpButton_clicked()
+{
+    scaleFactor *= 1.1;
+
+    int newWidth = currentPixmap.width() * scaleFactor;
+    int newHeight = currentPixmap.height() * scaleFactor;
+
+    QPixmap scaledImage = currentPixmap.scaled(newWidth, newHeight, Qt::KeepAspectRatio, Qt::SmoothTransformation);
+
+    ui->Operatewidget->setPixmap(scaledImage);
+
+    double percentage = (scaleFactor * 100);
+    QString percentageStr = QString::number((int)percentage);
+    ui->label_Percentage->setText(QString("%1%").arg(percentageStr));
+}
+
+
+void Demo001_1::on_ZoomOutButton_clicked()
+{
+    scaleFactor *= 0.9;
+
+    int newWidth = currentPixmap.width() * scaleFactor;
+    int newHeight = currentPixmap.height() * scaleFactor;
+
+    QPixmap scaledImage = currentPixmap.scaled(newWidth, newHeight, Qt::KeepAspectRatio, Qt::SmoothTransformation);
+
+    ui->Operatewidget->setPixmap(scaledImage);
+
+    double percentage = scaleFactor * 100;
+    QString percentageStr = QString::number((int)percentage);
+    ui->label_Percentage->setText(QString("%1%").arg(percentageStr));
+}
+
+void Demo001_1::wheelEvent(QWheelEvent *event)
+{
+    if (ui->Operatewidget->rect().contains(ui->Operatewidget->mapFromGlobal(event->globalPos()))) {
+        if (event->angleDelta().y() > 0) {
+            scaleFactor *= 1.1;
+        } else {
+            scaleFactor *= 0.9;
+        }
+
+        int newWidth = currentPixmap.width() * scaleFactor;
+        int newHeight = currentPixmap.height() * scaleFactor;
+
+        QPixmap scaledImage = currentPixmap.scaled(newWidth, newHeight, Qt::KeepAspectRatio, Qt::SmoothTransformation);
+        ui->Operatewidget->setPixmap(scaledImage);
+
+        double percentage = scaleFactor * 100;
+        QString percentageStr = QString::number((int)percentage);
+        ui->label_Percentage->setText(QString("%1%").arg(percentageStr));
+    }
+
+    QMainWindow::wheelEvent(event);
+}
+
+void Demo001_1::showEvent(QShowEvent *event) {
+    QMainWindow::showEvent(event);
+    loadSettings();
+    initFrom();
+}
+
+void Demo001_1::hideEvent(QHideEvent *event) {
+    QMainWindow::hideEvent(event);
+}

+ 27 - 0
OriginalWnd/Demo001_1.h

@@ -2,6 +2,8 @@
 #define DEMO001_1_H
 
 #include <QMainWindow>
+#include <QSlider>
+#include <QLineEdit>
 
 namespace Ui {
 class Demo001_1;
@@ -15,8 +17,33 @@ public:
     explicit Demo001_1(QWidget *parent = nullptr);
     ~Demo001_1();
 
+    void initFrom();
+    void connectSliderAndLineEdit(QSlider* slider, QLineEdit* lineEdit);
+    void initLineEdits();
+    void initSliders();
+
+protected:
+    void wheelEvent(QWheelEvent *event);
+    void loadSettings();
+    void checkSettings();
+    void loadGroupSettings(int Id, int Index);
+    void showEvent(QShowEvent *event) override;
+    void hideEvent(QHideEvent *event) override;
+
+private slots:
+    void on_ZoomUpButton_clicked();
+
+    QPixmap getCurrentPixmap() const {
+        return currentPixmap;
+    }
+
+    void on_ZoomOutButton_clicked();
+
 private:
     Ui::Demo001_1 *ui;
+
+    QPixmap currentPixmap;
+    qreal scaleFactor;
 };
 
 #endif // DEMO001_1_H

+ 576 - 8
OriginalWnd/Demo001_1.ui

@@ -6,27 +6,595 @@
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>800</width>
-    <height>600</height>
+    <width>1102</width>
+    <height>988</height>
    </rect>
   </property>
   <property name="windowTitle">
    <string>MainWindow</string>
   </property>
   <widget class="QWidget" name="centralwidget">
-   <widget class="QComboBox" name="comboBox">
+   <widget class="QWidget" name="Leftwidget" native="true">
     <property name="geometry">
      <rect>
-      <x>40</x>
-      <y>20</y>
-      <width>174</width>
-      <height>32</height>
+      <x>0</x>
+      <y>0</y>
+      <width>550</width>
+      <height>988</height>
      </rect>
     </property>
    </widget>
+   <widget class="QWidget" name="Rightwidget" native="true">
+    <property name="geometry">
+     <rect>
+      <x>566</x>
+      <y>0</y>
+      <width>536</width>
+      <height>988</height>
+     </rect>
+    </property>
+    <widget class="ImageWidget" name="Operatewidget" native="true">
+     <property name="geometry">
+      <rect>
+       <x>30</x>
+       <y>72</y>
+       <width>476</width>
+       <height>476</height>
+      </rect>
+     </property>
+    </widget>
+    <widget class="QComboBox" name="DatacomboBox">
+     <property name="geometry">
+      <rect>
+       <x>30</x>
+       <y>20</y>
+       <width>400</width>
+       <height>32</height>
+      </rect>
+     </property>
+    </widget>
+    <widget class="QPushButton" name="LiveButton">
+     <property name="geometry">
+      <rect>
+       <x>446</x>
+       <y>20</y>
+       <width>60</width>
+       <height>32</height>
+      </rect>
+     </property>
+     <property name="text">
+      <string>Live</string>
+     </property>
+    </widget>
+    <widget class="QWidget" name="Toolbar" native="true">
+     <property name="geometry">
+      <rect>
+       <x>16</x>
+       <y>572</y>
+       <width>504</width>
+       <height>32</height>
+      </rect>
+     </property>
+     <widget class="Line" name="line">
+      <property name="geometry">
+       <rect>
+        <x>80</x>
+        <y>8</y>
+        <width>1</width>
+        <height>16</height>
+       </rect>
+      </property>
+      <property name="orientation">
+       <enum>Qt::Vertical</enum>
+      </property>
+     </widget>
+     <widget class="QPushButton" name="ZoomUpButton">
+      <property name="geometry">
+       <rect>
+        <x>0</x>
+        <y>0</y>
+        <width>78</width>
+        <height>32</height>
+       </rect>
+      </property>
+      <property name="text">
+       <string/>
+      </property>
+     </widget>
+     <widget class="Line" name="line_3">
+      <property name="geometry">
+       <rect>
+        <x>156</x>
+        <y>8</y>
+        <width>1</width>
+        <height>16</height>
+       </rect>
+      </property>
+      <property name="orientation">
+       <enum>Qt::Vertical</enum>
+      </property>
+     </widget>
+     <widget class="Line" name="line_4">
+      <property name="geometry">
+       <rect>
+        <x>255</x>
+        <y>8</y>
+        <width>1</width>
+        <height>16</height>
+       </rect>
+      </property>
+      <property name="orientation">
+       <enum>Qt::Vertical</enum>
+      </property>
+     </widget>
+     <widget class="Line" name="line_5">
+      <property name="geometry">
+       <rect>
+        <x>343</x>
+        <y>8</y>
+        <width>1</width>
+        <height>16</height>
+       </rect>
+      </property>
+      <property name="orientation">
+       <enum>Qt::Vertical</enum>
+      </property>
+     </widget>
+     <widget class="Line" name="line_6">
+      <property name="geometry">
+       <rect>
+        <x>415</x>
+        <y>8</y>
+        <width>1</width>
+        <height>16</height>
+       </rect>
+      </property>
+      <property name="orientation">
+       <enum>Qt::Vertical</enum>
+      </property>
+     </widget>
+     <widget class="QPushButton" name="pushButton_2">
+      <property name="geometry">
+       <rect>
+        <x>417</x>
+        <y>0</y>
+        <width>87</width>
+        <height>32</height>
+       </rect>
+      </property>
+      <property name="text">
+       <string>.......</string>
+      </property>
+     </widget>
+     <widget class="QPushButton" name="ZoomOutButton">
+      <property name="geometry">
+       <rect>
+        <x>82</x>
+        <y>0</y>
+        <width>72</width>
+        <height>32</height>
+       </rect>
+      </property>
+      <property name="text">
+       <string/>
+      </property>
+     </widget>
+     <widget class="QPushButton" name="RulerButton">
+      <property name="geometry">
+       <rect>
+        <x>257</x>
+        <y>0</y>
+        <width>84</width>
+        <height>32</height>
+       </rect>
+      </property>
+      <property name="text">
+       <string/>
+      </property>
+     </widget>
+     <widget class="QPushButton" name="PenButton">
+      <property name="geometry">
+       <rect>
+        <x>345</x>
+        <y>0</y>
+        <width>68</width>
+        <height>32</height>
+       </rect>
+      </property>
+      <property name="text">
+       <string/>
+      </property>
+     </widget>
+     <widget class="QLabel" name="label_Percentage">
+      <property name="geometry">
+       <rect>
+        <x>158</x>
+        <y>0</y>
+        <width>95</width>
+        <height>32</height>
+       </rect>
+      </property>
+      <property name="layoutDirection">
+       <enum>Qt::LeftToRight</enum>
+      </property>
+      <property name="text">
+       <string>100%</string>
+      </property>
+     </widget>
+    </widget>
+    <widget class="QWidget" name="BackGround" native="true">
+     <property name="geometry">
+      <rect>
+       <x>29</x>
+       <y>71</y>
+       <width>478</width>
+       <height>478</height>
+      </rect>
+     </property>
+    </widget>
+    <widget class="QWidget" name="widget_6" native="true">
+     <property name="geometry">
+      <rect>
+       <x>16</x>
+       <y>830</y>
+       <width>114</width>
+       <height>114</height>
+      </rect>
+     </property>
+     <widget class="QSlider" name="verticalSlider">
+      <property name="geometry">
+       <rect>
+        <x>30</x>
+        <y>12</y>
+        <width>18</width>
+        <height>56</height>
+       </rect>
+      </property>
+      <property name="orientation">
+       <enum>Qt::Vertical</enum>
+      </property>
+     </widget>
+     <widget class="QSlider" name="verticalSlider_2">
+      <property name="geometry">
+       <rect>
+        <x>65</x>
+        <y>12</y>
+        <width>18</width>
+        <height>56</height>
+       </rect>
+      </property>
+      <property name="orientation">
+       <enum>Qt::Vertical</enum>
+      </property>
+     </widget>
+     <widget class="QLineEdit" name="lineEdit">
+      <property name="geometry">
+       <rect>
+        <x>6</x>
+        <y>78</y>
+        <width>40</width>
+        <height>24</height>
+       </rect>
+      </property>
+      <property name="text">
+       <string>11</string>
+      </property>
+     </widget>
+     <widget class="QLineEdit" name="lineEdit_2">
+      <property name="geometry">
+       <rect>
+        <x>68</x>
+        <y>78</y>
+        <width>40</width>
+        <height>24</height>
+       </rect>
+      </property>
+      <property name="text">
+       <string>22</string>
+      </property>
+     </widget>
+     <widget class="QLabel" name="label">
+      <property name="geometry">
+       <rect>
+        <x>50</x>
+        <y>83</y>
+        <width>14</width>
+        <height>14</height>
+       </rect>
+      </property>
+      <property name="text">
+       <string>%</string>
+      </property>
+     </widget>
+     <widget class="QLabel" name="label_4">
+      <property name="geometry">
+       <rect>
+        <x>12</x>
+        <y>22</y>
+        <width>10</width>
+        <height>34</height>
+       </rect>
+      </property>
+      <property name="text">
+       <string/>
+      </property>
+     </widget>
+     <widget class="QLabel" name="label_5">
+      <property name="geometry">
+       <rect>
+        <x>94</x>
+        <y>22</y>
+        <width>10</width>
+        <height>34</height>
+       </rect>
+      </property>
+      <property name="text">
+       <string/>
+      </property>
+     </widget>
+    </widget>
+    <widget class="QWidget" name="widget_7" native="true">
+     <property name="geometry">
+      <rect>
+       <x>146</x>
+       <y>830</y>
+       <width>114</width>
+       <height>114</height>
+      </rect>
+     </property>
+     <widget class="QSlider" name="verticalSlider_3">
+      <property name="geometry">
+       <rect>
+        <x>30</x>
+        <y>12</y>
+        <width>18</width>
+        <height>56</height>
+       </rect>
+      </property>
+      <property name="orientation">
+       <enum>Qt::Vertical</enum>
+      </property>
+     </widget>
+     <widget class="QSlider" name="verticalSlider_4">
+      <property name="geometry">
+       <rect>
+        <x>65</x>
+        <y>12</y>
+        <width>18</width>
+        <height>56</height>
+       </rect>
+      </property>
+      <property name="orientation">
+       <enum>Qt::Vertical</enum>
+      </property>
+     </widget>
+     <widget class="QLineEdit" name="lineEdit_3">
+      <property name="geometry">
+       <rect>
+        <x>6</x>
+        <y>78</y>
+        <width>40</width>
+        <height>24</height>
+       </rect>
+      </property>
+      <property name="text">
+       <string>9</string>
+      </property>
+     </widget>
+     <widget class="QLineEdit" name="lineEdit_4">
+      <property name="geometry">
+       <rect>
+        <x>68</x>
+        <y>78</y>
+        <width>40</width>
+        <height>24</height>
+       </rect>
+      </property>
+      <property name="text">
+       <string>11</string>
+      </property>
+     </widget>
+     <widget class="QLabel" name="label_2">
+      <property name="geometry">
+       <rect>
+        <x>50</x>
+        <y>83</y>
+        <width>14</width>
+        <height>14</height>
+       </rect>
+      </property>
+      <property name="text">
+       <string>%</string>
+      </property>
+     </widget>
+     <widget class="QLabel" name="label_6">
+      <property name="geometry">
+       <rect>
+        <x>12</x>
+        <y>22</y>
+        <width>12</width>
+        <height>34</height>
+       </rect>
+      </property>
+      <property name="text">
+       <string/>
+      </property>
+     </widget>
+     <widget class="QLabel" name="label_7">
+      <property name="geometry">
+       <rect>
+        <x>91</x>
+        <y>22</y>
+        <width>12</width>
+        <height>34</height>
+       </rect>
+      </property>
+      <property name="text">
+       <string/>
+      </property>
+     </widget>
+    </widget>
+    <widget class="QWidget" name="widget_8" native="true">
+     <property name="geometry">
+      <rect>
+       <x>276</x>
+       <y>830</y>
+       <width>114</width>
+       <height>114</height>
+      </rect>
+     </property>
+     <widget class="QSlider" name="verticalSlider_7">
+      <property name="geometry">
+       <rect>
+        <x>30</x>
+        <y>12</y>
+        <width>18</width>
+        <height>56</height>
+       </rect>
+      </property>
+      <property name="orientation">
+       <enum>Qt::Vertical</enum>
+      </property>
+     </widget>
+     <widget class="QSlider" name="verticalSlider_8">
+      <property name="geometry">
+       <rect>
+        <x>65</x>
+        <y>12</y>
+        <width>18</width>
+        <height>56</height>
+       </rect>
+      </property>
+      <property name="orientation">
+       <enum>Qt::Vertical</enum>
+      </property>
+     </widget>
+     <widget class="QLineEdit" name="lineEdit_7">
+      <property name="geometry">
+       <rect>
+        <x>6</x>
+        <y>78</y>
+        <width>40</width>
+        <height>24</height>
+       </rect>
+      </property>
+      <property name="text">
+       <string>0</string>
+      </property>
+     </widget>
+     <widget class="QLineEdit" name="lineEdit_8">
+      <property name="geometry">
+       <rect>
+        <x>68</x>
+        <y>78</y>
+        <width>40</width>
+        <height>24</height>
+       </rect>
+      </property>
+      <property name="text">
+       <string>0</string>
+      </property>
+     </widget>
+     <widget class="QLabel" name="label_10">
+      <property name="geometry">
+       <rect>
+        <x>50</x>
+        <y>83</y>
+        <width>14</width>
+        <height>14</height>
+       </rect>
+      </property>
+      <property name="text">
+       <string>%</string>
+      </property>
+     </widget>
+     <widget class="QLabel" name="label_11">
+      <property name="geometry">
+       <rect>
+        <x>7</x>
+        <y>22</y>
+        <width>19</width>
+        <height>34</height>
+       </rect>
+      </property>
+      <property name="text">
+       <string/>
+      </property>
+     </widget>
+     <widget class="QLabel" name="label_12">
+      <property name="geometry">
+       <rect>
+        <x>87</x>
+        <y>22</y>
+        <width>19</width>
+        <height>34</height>
+       </rect>
+      </property>
+      <property name="text">
+       <string/>
+      </property>
+     </widget>
+    </widget>
+    <widget class="Line" name="line_2">
+     <property name="geometry">
+      <rect>
+       <x>20</x>
+       <y>628</y>
+       <width>496</width>
+       <height>1</height>
+      </rect>
+     </property>
+     <property name="orientation">
+      <enum>Qt::Horizontal</enum>
+     </property>
+    </widget>
+    <widget class="QScrollArea" name="scrollArea">
+     <property name="geometry">
+      <rect>
+       <x>16</x>
+       <y>652</y>
+       <width>521</width>
+       <height>162</height>
+      </rect>
+     </property>
+     <property name="verticalScrollBarPolicy">
+      <enum>Qt::ScrollBarAsNeeded</enum>
+     </property>
+     <property name="widgetResizable">
+      <bool>true</bool>
+     </property>
+     <widget class="QWidget" name="scrollAreaWidgetContents">
+      <property name="geometry">
+       <rect>
+        <x>0</x>
+        <y>0</y>
+        <width>519</width>
+        <height>160</height>
+       </rect>
+      </property>
+     </widget>
+    </widget>
+    <zorder>BackGround</zorder>
+    <zorder>Operatewidget</zorder>
+    <zorder>DatacomboBox</zorder>
+    <zorder>LiveButton</zorder>
+    <zorder>Toolbar</zorder>
+    <zorder>widget_6</zorder>
+    <zorder>widget_7</zorder>
+    <zorder>widget_8</zorder>
+    <zorder>line_2</zorder>
+    <zorder>scrollArea</zorder>
+   </widget>
   </widget>
-  <widget class="QStatusBar" name="statusbar"/>
  </widget>
+ <customwidgets>
+  <customwidget>
+   <class>ImageWidget</class>
+   <extends>QWidget</extends>
+   <header location="global">ImageWidget.h</header>
+   <container>1</container>
+  </customwidget>
+ </customwidgets>
  <resources/>
  <connections/>
 </ui>

+ 338 - 0
OriginalWnd/Demo001_2.cpp

@@ -1,14 +1,352 @@
 #include "Demo001_2.h"
 #include "ui_Demo001_2.h"
+#include <QSettings>
+#include <QCloseEvent>
+#include "Group.h"
+#include <QVBoxLayout>
+#include <QTimer>
 
 Demo001_2::Demo001_2(QWidget *parent)
     : QMainWindow(parent)
     , ui(new Ui::Demo001_2)
 {
     ui->setupUi(this);
+
+    // initFrom();
 }
 
 Demo001_2::~Demo001_2()
 {
     delete ui;
 }
+
+void Demo001_2::initFrom()
+{
+    QTimer *timer = new QTimer(this);
+    connect(timer, &QTimer::timeout, this, &Demo001_2::checkSettings);
+    timer->start(100);
+
+    ui->Leftlabel_Percentage->setAlignment(Qt::AlignCenter);
+    ui->Rightlabel_Percentage->setAlignment(Qt::AlignCenter);
+
+    initSliders();
+    initLineEdits();
+
+    connectSliderAndLineEdit(ui->verticalSlider, ui->lineEdit);
+    connectSliderAndLineEdit(ui->verticalSlider_2, ui->lineEdit_2);
+    connectSliderAndLineEdit(ui->verticalSlider_3, ui->lineEdit_3);
+    connectSliderAndLineEdit(ui->verticalSlider_4, ui->lineEdit_4);
+    connectSliderAndLineEdit(ui->verticalSlider_7, ui->lineEdit_7);
+    connectSliderAndLineEdit(ui->verticalSlider_8, ui->lineEdit_8);
+
+    QWidget *viewport = ui->scrollArea->viewport();
+    QWidget *container = new QWidget(viewport);
+
+    // 创建水平布局
+    QHBoxLayout *mainLayout = new QHBoxLayout(container);
+
+    // 创建四个垂直布局,分别用于四个区域
+    QVBoxLayout *vLayout1 = new QVBoxLayout();
+    QVBoxLayout *vLayout2 = new QVBoxLayout();
+    QVBoxLayout *vLayout3 = new QVBoxLayout();
+    QVBoxLayout *vLayout4 = new QVBoxLayout();
+
+    QStringList dispmodel1;
+    dispmodel1 << "P die align" << "D device align";
+    Group *widget1 = new Group(16, ":/images/test_image/image_1.png", ":/images/test_image/image_2.png", dispmodel1, this);
+
+    QStringList dispmodel2;
+    dispmodel2 << "D device align" << "P die align";
+    Group *widget2 = new Group(17, ":/images/test_image/image_3.png", ":/images/test_image/image_4.png", dispmodel2, this);
+
+    QStringList dispmodel3;
+    dispmodel3 << "B device align" << "P die align";
+    Group *widget3 = new Group(18, ":/images/test_image/image_5.png", ":/images/test_image/image_6.png", dispmodel3, this);
+
+    QStringList dispmodel4;
+    dispmodel4 << "U die align" << "D device align";
+    Group *widget4 = new Group(19, ":/images/test_image/image_7.png", ":/images/test_image/image_8.png", dispmodel4, this);
+
+    QStringList dispmodel5;
+    dispmodel5 << "P die align" << "D device align";
+    Group *widget5 = new Group(20, ":/images/test_image/image_1.png", ":/images/test_image/image_2.png", dispmodel1, this);
+
+    QStringList dispmodel6;
+    dispmodel6 << "D device align" << "P die align";
+    Group *widget6 = new Group(21, ":/images/test_image/image_3.png", ":/images/test_image/image_4.png", dispmodel2, this);
+
+    QStringList dispmodel7;
+    dispmodel7 << "B device align" << "P die align";
+    Group *widget7 = new Group(22, ":/images/test_image/image_5.png", ":/images/test_image/image_6.png", dispmodel3, this);
+
+    QStringList dispmodel8;
+    dispmodel8 << "U die align" << "D device align";
+    Group *widget8 = new Group(23, ":/images/test_image/image_7.png", ":/images/test_image/image_8.png", dispmodel4, this);
+
+    vLayout1->addWidget(widget1);
+    // vLayout1->addWidget(widget8);
+    // vLayout2->addWidget(widget7);
+    vLayout2->addWidget(widget2);
+    vLayout3->addWidget(widget3);
+    // vLayout3->addWidget(widget6);
+    // vLayout4->addWidget(widget5);
+    vLayout4->addWidget(widget4);
+
+    int minHeight = 162;
+    int maxWidth = 244;
+    QWidgetList widgets = {widget1, widget2, widget3, widget4};
+    for (QWidget *w : widgets) {
+        w->setMinimumHeight(minHeight);
+        w->setMaximumWidth(maxWidth);
+    }
+
+    mainLayout->addLayout(vLayout1);
+    mainLayout->addSpacing(8); // 第一个和第二个之间的间距
+    mainLayout->addLayout(vLayout2);
+    mainLayout->addSpacing(52); // 第二个和第三个之间的间距
+    mainLayout->addLayout(vLayout3);
+    mainLayout->addSpacing(8); // 第三个和第四个之间的间距
+    mainLayout->addLayout(vLayout4);
+
+    mainLayout->setContentsMargins(0, 0, 15, 0);
+
+    container->setLayout(mainLayout);
+    ui->scrollArea->setWidget(container);
+    ui->scrollArea->resize(1083, 162);
+
+    ui->LeftOperatewidget->setMouseTracking(true);
+    ui->RightOperatewidget->setMouseTracking(true);
+}
+
+void Demo001_2::initSliders() {
+    QList<QSlider*> sliders = {
+        ui->verticalSlider, ui->verticalSlider_2, ui->verticalSlider_3,
+        ui->verticalSlider_4, ui->verticalSlider_7, ui->verticalSlider_8
+    };
+    QList<int> initialValues = {11, 22, 9, 11, 0, 0};
+
+    for (int i = 0; i < sliders.size(); ++i) {
+        sliders[i]->setMinimum(0);
+        sliders[i]->setMaximum(100);
+        sliders[i]->setValue(initialValues[i]);
+    }
+}
+
+void Demo001_2::initLineEdits() {
+    QList<QLineEdit*> lineEdits = {
+        ui->lineEdit, ui->lineEdit_2, ui->lineEdit_3,
+        ui->lineEdit_4, ui->lineEdit_7, ui->lineEdit_8
+    };
+
+    for (QLineEdit* lineEdit : lineEdits) {
+        lineEdit->setAlignment(Qt::AlignCenter);
+    }
+}
+
+void Demo001_2::connectSliderAndLineEdit(QSlider* slider, QLineEdit* lineEdit)
+{
+    QIntValidator* validator = new QIntValidator(slider->minimum(), slider->maximum(), lineEdit);
+    lineEdit->setValidator(validator);
+
+    connect(slider, &QSlider::valueChanged, [lineEdit](int value) {
+        lineEdit->setText(QString::number(value));
+    });
+
+    connect(lineEdit, &QLineEdit::textChanged, [slider](const QString &text) {
+        bool ok;
+        int value = text.toInt(&ok);
+        if (ok && value >= slider->minimum() && value <= slider->maximum()) {
+            slider->setValue(value);
+        } else if (!text.isEmpty()) {
+            int closestValue = qMin(qMax(text.toInt(&ok), slider->minimum()), slider->maximum());
+            slider->setValue(closestValue);
+        }
+    });
+}
+
+void Demo001_2::checkSettings() {
+    static int lastGroupId = -1;
+    static int lastIndex = -1;
+
+    QSettings settings("YourCompany", "YourApplication_");
+    int groupId = settings.value("GroupId", 0).toInt();
+    int index = settings.value("Index", 0).toInt();
+
+    if (groupId != lastGroupId || index != lastIndex) {
+        lastGroupId = groupId;
+        lastIndex = index;
+        loadSettings();
+    }
+}
+
+void Demo001_2::loadSettings()
+{
+    QSettings settings("YourCompany", "YourApplication_");
+    int groupId = settings.value("GroupId", 0).toInt();
+    int index = settings.value("Index", 0).toInt();
+    loadGroupSettings(groupId, index);
+}
+
+void Demo001_2::loadGroupSettings(int Id, int Index) {
+    QSettings settings("YourOrganization", "YourApplication");
+    settings.beginGroup(QString::number(Id));
+    QString imagePath1 = settings.value("ImagePath1").toString();
+    QString imagePath2 = settings.value("ImagePath2").toString();
+    QStringList textList = settings.value("TextList").toStringList();
+    settings.endGroup();
+
+    QSize size_left = ui->LeftOperatewidget->size();
+    QSize size_right = ui->RightOperatewidget->size();
+
+    // QPixmap newPixmap;
+    // if (Index == 1) {
+    //     newPixmap = QPixmap(imagePath1);
+    // } else if (Index == 2) {
+    //     newPixmap = QPixmap(imagePath2);
+    // } else {
+    //     newPixmap = QPixmap(":/images/test_image/image.png");
+    // }
+
+    QPixmap LeftPixmap = QPixmap(imagePath2);
+    QPixmap RightPixmap = QPixmap(imagePath1);
+
+    QPixmap scaledPixmap_left = LeftPixmap.scaled(size_left, Qt::KeepAspectRatio, Qt::SmoothTransformation);
+    ui->LeftOperatewidget->setPixmap(scaledPixmap_left);
+
+    QPixmap scaledPixmap_right = RightPixmap.scaled(size_right, Qt::KeepAspectRatio, Qt::SmoothTransformation);
+    ui->RightOperatewidget->setPixmap(scaledPixmap_right);
+
+    // 更新当前图片的成员变量
+    Left_currentPixmap = scaledPixmap_left;
+    Left_scaleFactor = 1.0;
+    Right_currentPixmap = scaledPixmap_right;
+    Left_scaleFactor = 1.0;
+    ui->Leftlabel_Percentage->setText("100%");
+    ui->Rightlabel_Percentage->setText("100%");
+
+    ui->LeftDataSources->clear();
+    ui->LeftDataSources->addItems(textList);
+    ui->RightDataSources->clear();
+    ui->RightDataSources->addItems(textList);
+    // connect(ui->DatacomboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(Demo001_3::onComboBoxIndexChanged(int)));
+}
+
+
+void Demo001_2::on_LeftZoomUpButton_clicked()
+{
+    Left_scaleFactor *= 1.1;
+
+    int newWidth = Left_currentPixmap.width() * Left_scaleFactor;
+    int newHeight = Left_currentPixmap.height() * Left_scaleFactor;
+
+    QPixmap scaledImage = Left_currentPixmap.scaled(newWidth, newHeight, Qt::KeepAspectRatio, Qt::SmoothTransformation);
+
+    ui->LeftOperatewidget->setPixmap(scaledImage);
+
+    double percentage = (Left_scaleFactor * 100);
+    QString percentageStr = QString::number((int)percentage);
+    ui->Leftlabel_Percentage->setText(QString("%1%").arg(percentageStr));
+}
+
+
+void Demo001_2::on_RightZoomUpButton_clicked()
+{
+    Right_scaleFactor *= 1.1;
+
+    int newWidth = Right_currentPixmap.width() * Right_scaleFactor;
+    int newHeight = Right_currentPixmap.height() * Right_scaleFactor;
+
+    QPixmap scaledImage = Right_currentPixmap.scaled(newWidth, newHeight, Qt::KeepAspectRatio, Qt::SmoothTransformation);
+
+    ui->RightOperatewidget->setPixmap(scaledImage);
+
+    double percentage = (Right_scaleFactor * 100);
+    QString percentageStr = QString::number((int)percentage);
+    ui->Rightlabel_Percentage->setText(QString("%1%").arg(percentageStr));
+}
+
+
+void Demo001_2::on_LeftZoomOutButton_clicked()
+{
+    Left_scaleFactor *= 0.9;
+
+    int newWidth = Left_currentPixmap.width() * Left_scaleFactor;
+    int newHeight = Left_currentPixmap.height() * Left_scaleFactor;
+
+    QPixmap scaledImage = Left_currentPixmap.scaled(newWidth, newHeight, Qt::KeepAspectRatio, Qt::SmoothTransformation);
+
+    ui->LeftOperatewidget->setPixmap(scaledImage);
+
+    double percentage = (Left_scaleFactor * 100);
+    QString percentageStr = QString::number((int)percentage);
+    ui->Leftlabel_Percentage->setText(QString("%1%").arg(percentageStr));
+}
+
+
+void Demo001_2::on_RightZoomOutButton_clicked()
+{
+    Right_scaleFactor *= 0.9;
+
+    int newWidth = Right_currentPixmap.width() * Right_scaleFactor;
+    int newHeight = Right_currentPixmap.height() * Right_scaleFactor;
+
+    QPixmap scaledImage = Right_currentPixmap.scaled(newWidth, newHeight, Qt::KeepAspectRatio, Qt::SmoothTransformation);
+
+    ui->RightOperatewidget->setPixmap(scaledImage);
+
+    double percentage = (Right_scaleFactor * 100);
+    QString percentageStr = QString::number((int)percentage);
+    ui->Rightlabel_Percentage->setText(QString("%1%").arg(percentageStr));
+}
+
+void Demo001_2::wheelEvent(QWheelEvent *event)
+{
+    if (ui->LeftOperatewidget->rect().contains(ui->LeftOperatewidget->mapFromGlobal(event->globalPosition().toPoint()))) {
+        if (event->angleDelta().y() > 0) {
+            Left_scaleFactor *= 1.1;
+        } else {
+            Left_scaleFactor *= 0.9;
+        }
+
+        int newWidth_left = Left_currentPixmap.width() * Left_scaleFactor;
+        int newHeight_left = Left_currentPixmap.height() * Left_scaleFactor;
+
+        QPixmap scaledImage_left = Left_currentPixmap.scaled(newWidth_left, newHeight_left, Qt::KeepAspectRatio, Qt::SmoothTransformation);
+        ui->LeftOperatewidget->setPixmap(scaledImage_left);
+
+        double percentage_left = Left_scaleFactor * 100;
+        QString percentageStr_left = QString::number((int)percentage_left);
+        ui->Leftlabel_Percentage->setText(QString("%1%").arg(percentageStr_left));
+    }
+
+    if (ui->RightOperatewidget->rect().contains(ui->RightOperatewidget->mapFromGlobal(event->globalPosition().toPoint()))) {
+        if (event->angleDelta().y() > 0) {
+            Right_scaleFactor *= 1.1;
+        } else {
+            Right_scaleFactor *= 0.9;
+        }
+
+        int newWidth = Right_currentPixmap.width() * Right_scaleFactor;
+        int newHeight = Right_currentPixmap.height() * Right_scaleFactor;
+
+        QPixmap scaledImage = Right_currentPixmap.scaled(newWidth, newHeight, Qt::KeepAspectRatio, Qt::SmoothTransformation);
+        ui->RightOperatewidget->setPixmap(scaledImage);
+
+        double percentage = Right_scaleFactor * 100;
+        QString percentageStr = QString::number((int)percentage);
+        ui->Rightlabel_Percentage->setText(QString("%1%").arg(percentageStr));
+    }
+
+    QMainWindow::wheelEvent(event);
+}
+
+void Demo001_2::showEvent(QShowEvent *event) {
+    QMainWindow::showEvent(event);
+    loadSettings();
+    initFrom();
+}
+
+void Demo001_2::hideEvent(QHideEvent *event) {
+    QMainWindow::hideEvent(event);
+}
+

+ 29 - 0
OriginalWnd/Demo001_2.h

@@ -2,6 +2,8 @@
 #define DEMO001_2_H
 
 #include <QMainWindow>
+#include <QSlider>
+#include <QLineEdit>
 
 namespace Ui {
 class Demo001_2;
@@ -15,8 +17,35 @@ public:
     explicit Demo001_2(QWidget *parent = nullptr);
     ~Demo001_2();
 
+    void initFrom();
+    void connectSliderAndLineEdit(QSlider* slider, QLineEdit* lineEdit);
+    void initLineEdits();
+    void initSliders();
+
+protected:
+    void wheelEvent(QWheelEvent *event);
+    void loadSettings();
+    void checkSettings();
+    void loadGroupSettings(int Id, int Index);
+    void showEvent(QShowEvent *event) override;
+    void hideEvent(QHideEvent *event) override;
+
+private slots:
+    void on_LeftZoomUpButton_clicked();
+
+    void on_RightZoomUpButton_clicked();
+
+    void on_LeftZoomOutButton_clicked();
+
+    void on_RightZoomOutButton_clicked();
+
 private:
     Ui::Demo001_2 *ui;
+
+    QPixmap Left_currentPixmap;
+    qreal Left_scaleFactor;
+    QPixmap Right_currentPixmap;
+    qreal Right_scaleFactor;
 };
 
 #endif // DEMO001_2_H

+ 769 - 9
OriginalWnd/Demo001_2.ui

@@ -6,30 +6,790 @@
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>800</width>
-    <height>600</height>
+    <width>1102</width>
+    <height>988</height>
    </rect>
   </property>
   <property name="windowTitle">
    <string>MainWindow</string>
   </property>
   <widget class="QWidget" name="centralwidget">
-   <widget class="QPushButton" name="pushButton">
+   <widget class="QComboBox" name="LeftDataSources">
     <property name="geometry">
      <rect>
-      <x>180</x>
-      <y>140</y>
-      <width>391</width>
-      <height>271</height>
+      <x>34</x>
+      <y>20</y>
+      <width>400</width>
+      <height>32</height>
+     </rect>
+    </property>
+   </widget>
+   <widget class="QComboBox" name="RightDataSources">
+    <property name="geometry">
+     <rect>
+      <x>596</x>
+      <y>20</y>
+      <width>400</width>
+      <height>32</height>
+     </rect>
+    </property>
+   </widget>
+   <widget class="ImageWidget" name="LeftOperatewidget" native="true">
+    <property name="geometry">
+     <rect>
+      <x>34</x>
+      <y>72</y>
+      <width>476</width>
+      <height>476</height>
+     </rect>
+    </property>
+   </widget>
+   <widget class="ImageWidget" name="RightOperatewidget" native="true">
+    <property name="geometry">
+     <rect>
+      <x>596</x>
+      <y>72</y>
+      <width>476</width>
+      <height>476</height>
+     </rect>
+    </property>
+   </widget>
+   <widget class="QWidget" name="LeftBackGround" native="true">
+    <property name="geometry">
+     <rect>
+      <x>33</x>
+      <y>71</y>
+      <width>478</width>
+      <height>478</height>
+     </rect>
+    </property>
+   </widget>
+   <widget class="QWidget" name="RightBackGround" native="true">
+    <property name="geometry">
+     <rect>
+      <x>595</x>
+      <y>71</y>
+      <width>478</width>
+      <height>478</height>
+     </rect>
+    </property>
+   </widget>
+   <widget class="QWidget" name="LeftToolbar" native="true">
+    <property name="geometry">
+     <rect>
+      <x>20</x>
+      <y>572</y>
+      <width>504</width>
+      <height>32</height>
+     </rect>
+    </property>
+    <widget class="Line" name="line">
+     <property name="geometry">
+      <rect>
+       <x>80</x>
+       <y>8</y>
+       <width>1</width>
+       <height>16</height>
+      </rect>
+     </property>
+     <property name="orientation">
+      <enum>Qt::Vertical</enum>
+     </property>
+    </widget>
+    <widget class="QPushButton" name="LeftZoomUpButton">
+     <property name="geometry">
+      <rect>
+       <x>0</x>
+       <y>0</y>
+       <width>78</width>
+       <height>32</height>
+      </rect>
+     </property>
+     <property name="text">
+      <string/>
+     </property>
+    </widget>
+    <widget class="Line" name="line_3">
+     <property name="geometry">
+      <rect>
+       <x>156</x>
+       <y>8</y>
+       <width>1</width>
+       <height>16</height>
+      </rect>
+     </property>
+     <property name="orientation">
+      <enum>Qt::Vertical</enum>
+     </property>
+    </widget>
+    <widget class="Line" name="line_4">
+     <property name="geometry">
+      <rect>
+       <x>255</x>
+       <y>8</y>
+       <width>1</width>
+       <height>16</height>
+      </rect>
+     </property>
+     <property name="orientation">
+      <enum>Qt::Vertical</enum>
+     </property>
+    </widget>
+    <widget class="Line" name="line_5">
+     <property name="geometry">
+      <rect>
+       <x>343</x>
+       <y>8</y>
+       <width>1</width>
+       <height>16</height>
+      </rect>
+     </property>
+     <property name="orientation">
+      <enum>Qt::Vertical</enum>
+     </property>
+    </widget>
+    <widget class="Line" name="line_6">
+     <property name="geometry">
+      <rect>
+       <x>415</x>
+       <y>8</y>
+       <width>1</width>
+       <height>16</height>
+      </rect>
+     </property>
+     <property name="orientation">
+      <enum>Qt::Vertical</enum>
+     </property>
+    </widget>
+    <widget class="QPushButton" name="pushButton_2">
+     <property name="geometry">
+      <rect>
+       <x>417</x>
+       <y>0</y>
+       <width>87</width>
+       <height>32</height>
+      </rect>
+     </property>
+     <property name="text">
+      <string>.......</string>
+     </property>
+    </widget>
+    <widget class="QPushButton" name="LeftZoomOutButton">
+     <property name="geometry">
+      <rect>
+       <x>82</x>
+       <y>0</y>
+       <width>72</width>
+       <height>32</height>
+      </rect>
+     </property>
+     <property name="text">
+      <string/>
+     </property>
+    </widget>
+    <widget class="QPushButton" name="LeftRulerButton">
+     <property name="geometry">
+      <rect>
+       <x>257</x>
+       <y>0</y>
+       <width>84</width>
+       <height>32</height>
+      </rect>
+     </property>
+     <property name="text">
+      <string/>
+     </property>
+    </widget>
+    <widget class="QPushButton" name="LeftPenButton">
+     <property name="geometry">
+      <rect>
+       <x>345</x>
+       <y>0</y>
+       <width>68</width>
+       <height>32</height>
+      </rect>
+     </property>
+     <property name="text">
+      <string/>
+     </property>
+    </widget>
+    <widget class="QLabel" name="Leftlabel_Percentage">
+     <property name="geometry">
+      <rect>
+       <x>158</x>
+       <y>0</y>
+       <width>95</width>
+       <height>32</height>
+      </rect>
+     </property>
+     <property name="layoutDirection">
+      <enum>Qt::LeftToRight</enum>
+     </property>
+     <property name="text">
+      <string>100%</string>
+     </property>
+    </widget>
+    <zorder>LeftPenButton</zorder>
+    <zorder>line</zorder>
+    <zorder>LeftZoomUpButton</zorder>
+    <zorder>line_3</zorder>
+    <zorder>line_4</zorder>
+    <zorder>line_5</zorder>
+    <zorder>line_6</zorder>
+    <zorder>pushButton_2</zorder>
+    <zorder>LeftZoomOutButton</zorder>
+    <zorder>LeftRulerButton</zorder>
+    <zorder>Leftlabel_Percentage</zorder>
+   </widget>
+   <widget class="QWidget" name="RightToolbar" native="true">
+    <property name="geometry">
+     <rect>
+      <x>582</x>
+      <y>572</y>
+      <width>504</width>
+      <height>32</height>
+     </rect>
+    </property>
+    <widget class="Line" name="line_11">
+     <property name="geometry">
+      <rect>
+       <x>80</x>
+       <y>8</y>
+       <width>1</width>
+       <height>16</height>
+      </rect>
+     </property>
+     <property name="orientation">
+      <enum>Qt::Vertical</enum>
+     </property>
+    </widget>
+    <widget class="QPushButton" name="RightZoomUpButton">
+     <property name="geometry">
+      <rect>
+       <x>0</x>
+       <y>0</y>
+       <width>78</width>
+       <height>32</height>
+      </rect>
+     </property>
+     <property name="text">
+      <string/>
+     </property>
+    </widget>
+    <widget class="Line" name="line_12">
+     <property name="geometry">
+      <rect>
+       <x>156</x>
+       <y>8</y>
+       <width>1</width>
+       <height>16</height>
+      </rect>
+     </property>
+     <property name="orientation">
+      <enum>Qt::Vertical</enum>
+     </property>
+    </widget>
+    <widget class="Line" name="line_13">
+     <property name="geometry">
+      <rect>
+       <x>255</x>
+       <y>8</y>
+       <width>1</width>
+       <height>16</height>
+      </rect>
+     </property>
+     <property name="orientation">
+      <enum>Qt::Vertical</enum>
+     </property>
+    </widget>
+    <widget class="Line" name="line_14">
+     <property name="geometry">
+      <rect>
+       <x>343</x>
+       <y>8</y>
+       <width>1</width>
+       <height>16</height>
+      </rect>
+     </property>
+     <property name="orientation">
+      <enum>Qt::Vertical</enum>
+     </property>
+    </widget>
+    <widget class="Line" name="line_15">
+     <property name="geometry">
+      <rect>
+       <x>415</x>
+       <y>8</y>
+       <width>1</width>
+       <height>16</height>
+      </rect>
+     </property>
+     <property name="orientation">
+      <enum>Qt::Vertical</enum>
+     </property>
+    </widget>
+    <widget class="QPushButton" name="pushButton_4">
+     <property name="geometry">
+      <rect>
+       <x>417</x>
+       <y>0</y>
+       <width>87</width>
+       <height>32</height>
+      </rect>
+     </property>
+     <property name="text">
+      <string>.......</string>
+     </property>
+    </widget>
+    <widget class="QPushButton" name="RightZoomOutButton">
+     <property name="geometry">
+      <rect>
+       <x>82</x>
+       <y>0</y>
+       <width>72</width>
+       <height>32</height>
+      </rect>
+     </property>
+     <property name="text">
+      <string/>
+     </property>
+    </widget>
+    <widget class="QPushButton" name="RightRulerButton">
+     <property name="geometry">
+      <rect>
+       <x>257</x>
+       <y>0</y>
+       <width>84</width>
+       <height>32</height>
+      </rect>
+     </property>
+     <property name="text">
+      <string/>
+     </property>
+    </widget>
+    <widget class="QPushButton" name="RightPenButton">
+     <property name="geometry">
+      <rect>
+       <x>345</x>
+       <y>0</y>
+       <width>68</width>
+       <height>32</height>
+      </rect>
+     </property>
+     <property name="text">
+      <string/>
+     </property>
+    </widget>
+    <widget class="QLabel" name="Rightlabel_Percentage">
+     <property name="geometry">
+      <rect>
+       <x>158</x>
+       <y>0</y>
+       <width>95</width>
+       <height>32</height>
+      </rect>
+     </property>
+     <property name="layoutDirection">
+      <enum>Qt::LeftToRight</enum>
+     </property>
+     <property name="text">
+      <string>100%</string>
+     </property>
+    </widget>
+   </widget>
+   <widget class="QPushButton" name="LeftLiveButton">
+    <property name="geometry">
+     <rect>
+      <x>452</x>
+      <y>20</y>
+      <width>60</width>
+      <height>32</height>
+     </rect>
+    </property>
+    <property name="text">
+     <string>Live</string>
+    </property>
+   </widget>
+   <widget class="QPushButton" name="RightLiveButton">
+    <property name="geometry">
+     <rect>
+      <x>1014</x>
+      <y>20</y>
+      <width>60</width>
+      <height>32</height>
      </rect>
     </property>
     <property name="text">
-     <string>PushButton</string>
+     <string>Live</string>
+    </property>
+   </widget>
+   <widget class="Line" name="line_16">
+    <property name="geometry">
+     <rect>
+      <x>20</x>
+      <y>628</y>
+      <width>1062</width>
+      <height>1</height>
+     </rect>
+    </property>
+    <property name="orientation">
+     <enum>Qt::Horizontal</enum>
+    </property>
+   </widget>
+   <widget class="QWidget" name="widget_6" native="true">
+    <property name="geometry">
+     <rect>
+      <x>582</x>
+      <y>830</y>
+      <width>114</width>
+      <height>114</height>
+     </rect>
+    </property>
+    <widget class="QSlider" name="verticalSlider">
+     <property name="geometry">
+      <rect>
+       <x>30</x>
+       <y>12</y>
+       <width>18</width>
+       <height>56</height>
+      </rect>
+     </property>
+     <property name="orientation">
+      <enum>Qt::Vertical</enum>
+     </property>
+    </widget>
+    <widget class="QSlider" name="verticalSlider_2">
+     <property name="geometry">
+      <rect>
+       <x>65</x>
+       <y>12</y>
+       <width>18</width>
+       <height>56</height>
+      </rect>
+     </property>
+     <property name="orientation">
+      <enum>Qt::Vertical</enum>
+     </property>
+    </widget>
+    <widget class="QLineEdit" name="lineEdit">
+     <property name="geometry">
+      <rect>
+       <x>6</x>
+       <y>78</y>
+       <width>40</width>
+       <height>24</height>
+      </rect>
+     </property>
+     <property name="text">
+      <string>11</string>
+     </property>
+    </widget>
+    <widget class="QLineEdit" name="lineEdit_2">
+     <property name="geometry">
+      <rect>
+       <x>68</x>
+       <y>78</y>
+       <width>40</width>
+       <height>24</height>
+      </rect>
+     </property>
+     <property name="text">
+      <string>22</string>
+     </property>
+    </widget>
+    <widget class="QLabel" name="label">
+     <property name="geometry">
+      <rect>
+       <x>50</x>
+       <y>83</y>
+       <width>14</width>
+       <height>14</height>
+      </rect>
+     </property>
+     <property name="text">
+      <string>%</string>
+     </property>
+    </widget>
+    <widget class="QLabel" name="label_4">
+     <property name="geometry">
+      <rect>
+       <x>12</x>
+       <y>22</y>
+       <width>10</width>
+       <height>34</height>
+      </rect>
+     </property>
+     <property name="text">
+      <string/>
+     </property>
+    </widget>
+    <widget class="QLabel" name="label_5">
+     <property name="geometry">
+      <rect>
+       <x>94</x>
+       <y>22</y>
+       <width>10</width>
+       <height>34</height>
+      </rect>
+     </property>
+     <property name="text">
+      <string/>
+     </property>
+    </widget>
+   </widget>
+   <widget class="QWidget" name="widget_7" native="true">
+    <property name="geometry">
+     <rect>
+      <x>712</x>
+      <y>830</y>
+      <width>114</width>
+      <height>114</height>
+     </rect>
+    </property>
+    <widget class="QSlider" name="verticalSlider_3">
+     <property name="geometry">
+      <rect>
+       <x>30</x>
+       <y>12</y>
+       <width>18</width>
+       <height>56</height>
+      </rect>
+     </property>
+     <property name="orientation">
+      <enum>Qt::Vertical</enum>
+     </property>
+    </widget>
+    <widget class="QSlider" name="verticalSlider_4">
+     <property name="geometry">
+      <rect>
+       <x>65</x>
+       <y>12</y>
+       <width>18</width>
+       <height>56</height>
+      </rect>
+     </property>
+     <property name="orientation">
+      <enum>Qt::Vertical</enum>
+     </property>
+    </widget>
+    <widget class="QLineEdit" name="lineEdit_3">
+     <property name="geometry">
+      <rect>
+       <x>6</x>
+       <y>78</y>
+       <width>40</width>
+       <height>24</height>
+      </rect>
+     </property>
+     <property name="text">
+      <string>9</string>
+     </property>
+    </widget>
+    <widget class="QLineEdit" name="lineEdit_4">
+     <property name="geometry">
+      <rect>
+       <x>68</x>
+       <y>78</y>
+       <width>40</width>
+       <height>24</height>
+      </rect>
+     </property>
+     <property name="text">
+      <string>11</string>
+     </property>
+    </widget>
+    <widget class="QLabel" name="label_2">
+     <property name="geometry">
+      <rect>
+       <x>50</x>
+       <y>83</y>
+       <width>14</width>
+       <height>14</height>
+      </rect>
+     </property>
+     <property name="text">
+      <string>%</string>
+     </property>
+    </widget>
+    <widget class="QLabel" name="label_6">
+     <property name="geometry">
+      <rect>
+       <x>12</x>
+       <y>22</y>
+       <width>12</width>
+       <height>34</height>
+      </rect>
+     </property>
+     <property name="text">
+      <string/>
+     </property>
+    </widget>
+    <widget class="QLabel" name="label_7">
+     <property name="geometry">
+      <rect>
+       <x>91</x>
+       <y>22</y>
+       <width>12</width>
+       <height>34</height>
+      </rect>
+     </property>
+     <property name="text">
+      <string/>
+     </property>
+    </widget>
+   </widget>
+   <widget class="QWidget" name="widget_8" native="true">
+    <property name="geometry">
+     <rect>
+      <x>842</x>
+      <y>830</y>
+      <width>114</width>
+      <height>114</height>
+     </rect>
+    </property>
+    <widget class="QSlider" name="verticalSlider_7">
+     <property name="geometry">
+      <rect>
+       <x>30</x>
+       <y>12</y>
+       <width>18</width>
+       <height>56</height>
+      </rect>
+     </property>
+     <property name="orientation">
+      <enum>Qt::Vertical</enum>
+     </property>
+    </widget>
+    <widget class="QSlider" name="verticalSlider_8">
+     <property name="geometry">
+      <rect>
+       <x>65</x>
+       <y>12</y>
+       <width>18</width>
+       <height>56</height>
+      </rect>
+     </property>
+     <property name="orientation">
+      <enum>Qt::Vertical</enum>
+     </property>
+    </widget>
+    <widget class="QLineEdit" name="lineEdit_7">
+     <property name="geometry">
+      <rect>
+       <x>6</x>
+       <y>78</y>
+       <width>40</width>
+       <height>24</height>
+      </rect>
+     </property>
+     <property name="text">
+      <string>0</string>
+     </property>
+    </widget>
+    <widget class="QLineEdit" name="lineEdit_8">
+     <property name="geometry">
+      <rect>
+       <x>68</x>
+       <y>78</y>
+       <width>40</width>
+       <height>24</height>
+      </rect>
+     </property>
+     <property name="text">
+      <string>0</string>
+     </property>
+    </widget>
+    <widget class="QLabel" name="label_10">
+     <property name="geometry">
+      <rect>
+       <x>50</x>
+       <y>83</y>
+       <width>14</width>
+       <height>14</height>
+      </rect>
+     </property>
+     <property name="text">
+      <string>%</string>
+     </property>
+    </widget>
+    <widget class="QLabel" name="label_11">
+     <property name="geometry">
+      <rect>
+       <x>7</x>
+       <y>22</y>
+       <width>19</width>
+       <height>34</height>
+      </rect>
+     </property>
+     <property name="text">
+      <string/>
+     </property>
+    </widget>
+    <widget class="QLabel" name="label_12">
+     <property name="geometry">
+      <rect>
+       <x>87</x>
+       <y>22</y>
+       <width>19</width>
+       <height>34</height>
+      </rect>
+     </property>
+     <property name="text">
+      <string/>
+     </property>
+    </widget>
+   </widget>
+   <widget class="QScrollArea" name="scrollArea">
+    <property name="geometry">
+     <rect>
+      <x>20</x>
+      <y>652</y>
+      <width>1083</width>
+      <height>162</height>
+     </rect>
+    </property>
+    <property name="verticalScrollBarPolicy">
+     <enum>Qt::ScrollBarAsNeeded</enum>
+    </property>
+    <property name="widgetResizable">
+     <bool>true</bool>
     </property>
+    <widget class="QWidget" name="scrollAreaWidgetContents">
+     <property name="geometry">
+      <rect>
+       <x>0</x>
+       <y>0</y>
+       <width>1081</width>
+       <height>160</height>
+      </rect>
+     </property>
+    </widget>
    </widget>
+   <zorder>RightBackGround</zorder>
+   <zorder>LeftBackGround</zorder>
+   <zorder>LeftDataSources</zorder>
+   <zorder>RightDataSources</zorder>
+   <zorder>LeftOperatewidget</zorder>
+   <zorder>RightOperatewidget</zorder>
+   <zorder>LeftToolbar</zorder>
+   <zorder>RightToolbar</zorder>
+   <zorder>LeftLiveButton</zorder>
+   <zorder>RightLiveButton</zorder>
+   <zorder>line_16</zorder>
+   <zorder>widget_6</zorder>
+   <zorder>widget_7</zorder>
+   <zorder>widget_8</zorder>
+   <zorder>scrollArea</zorder>
   </widget>
-  <widget class="QStatusBar" name="statusbar"/>
  </widget>
+ <customwidgets>
+  <customwidget>
+   <class>ImageWidget</class>
+   <extends>QWidget</extends>
+   <header location="global">ImageWidget.h</header>
+   <container>1</container>
+  </customwidget>
+ </customwidgets>
  <resources/>
  <connections/>
 </ui>

+ 81 - 19
OriginalWnd/Demo001_3.cpp

@@ -6,7 +6,6 @@
 #include <QVBoxLayout>
 #include <QDebug>
 #include <QTimer>
-#include <QToolBar>
 
 Demo001_3::Demo001_3(QWidget *parent)
     : QMainWindow(parent)
@@ -14,10 +13,10 @@ Demo001_3::Demo001_3(QWidget *parent)
 {
     ui->setupUi(this);
 
+    // initFrom();
+    // connect(this, &Demo001_3::closeEvent, this, &Demo001_3::saveSliderStates);
 
 
-    initFrom();
-    // connect(this, &Demo001_3::closeEvent, this, &Demo001_3::saveSliderStates);
 }
 
 Demo001_3::~Demo001_3()
@@ -30,9 +29,9 @@ void Demo001_3::initFrom() {
     connect(timer, &QTimer::timeout, this, &Demo001_3::checkSettings);
     timer->start(100);
 
-    ui->label_10->setAlignment(Qt::AlignCenter);
+    ui->label_Percentage->setAlignment(Qt::AlignCenter);
 
-// 设置右下部分
+    // 设置右下部分
     loadSliderStates();
 
     initSliders();
@@ -45,7 +44,7 @@ void Demo001_3::initFrom() {
     connectSliderAndLineEdit(ui->verticalSlider_5, ui->lineEdit_5);
     connectSliderAndLineEdit(ui->verticalSlider_6, ui->lineEdit_6);
 
-// 设置右上部分
+    // 设置右上部分
     QWidget *viewport = ui->scrollArea->viewport();
     QWidget *container = new QWidget(viewport);
     QVBoxLayout *layout = new QVBoxLayout(container);
@@ -91,6 +90,8 @@ void Demo001_3::initFrom() {
     container->setLayout(layout);
     ui->scrollArea->setWidget(container);
     ui->scrollArea->resize(261, 700);
+
+    ui->Operatewidget->setMouseTracking(true);
 }
 
 void Demo001_3::closeEvent(QCloseEvent *event) {
@@ -203,7 +204,7 @@ void Demo001_3::loadGroupSettings(int Id, int Index) {
     QStringList textList = settings.value("TextList").toStringList();
     settings.endGroup();
 
-    QSize size = ui->widget->size();
+    QSize size = ui->Operatewidget->size();
 
     QPixmap newPixmap;
     if (Index == 1) {
@@ -215,18 +216,20 @@ void Demo001_3::loadGroupSettings(int Id, int Index) {
     }
 
     QPixmap scaledPixmap = newPixmap.scaled(size, Qt::KeepAspectRatio, Qt::SmoothTransformation);
-    ui->widget->setPixmap(scaledPixmap);
+    ui->Operatewidget->setPixmap(scaledPixmap);
 
     // 更新当前图片的成员变量
     currentPixmap = scaledPixmap;
     scaleFactor = 1.0;
+    ui->label_Percentage->setText("100%");
 
-    ui->comboBox->clear();
-    ui->comboBox->addItems(textList);
+    ui->DatacomboBox->clear();
+    ui->DatacomboBox->addItems(textList);
+    // qDebug() << "ComboBox items added:" << ui->DatacomboBox->count();
+    // connect(ui->DatacomboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(Demo001_3::onComboBoxIndexChanged(int)));
 }
 
-void Demo001_3::on_pushButton_clicked()
-{
+void Demo001_3::on_ZoomUpButton_clicked() {
     scaleFactor *= 1.1;
 
     int newWidth = currentPixmap.width() * scaleFactor;
@@ -234,16 +237,14 @@ void Demo001_3::on_pushButton_clicked()
 
     QPixmap scaledImage = currentPixmap.scaled(newWidth, newHeight, Qt::KeepAspectRatio, Qt::SmoothTransformation);
 
-    ui->widget->setPixmap(scaledImage);
+    ui->Operatewidget->setPixmap(scaledImage); // 这里传递缩放后的图片
 
     double percentage = (scaleFactor * 100);
     QString percentageStr = QString::number((int)percentage);
-    ui->label_10->setText(QString("%1%").arg(percentageStr));
+    ui->label_Percentage->setText(QString("%1%").arg(percentageStr));
 }
 
-
-void Demo001_3::on_pushButton_3_clicked()
-{
+void Demo001_3::on_ZoomOutButton_clicked() {
     scaleFactor *= 0.9;
 
     int newWidth = currentPixmap.width() * scaleFactor;
@@ -251,10 +252,71 @@ void Demo001_3::on_pushButton_3_clicked()
 
     QPixmap scaledImage = currentPixmap.scaled(newWidth, newHeight, Qt::KeepAspectRatio, Qt::SmoothTransformation);
 
-    ui->widget->setPixmap(scaledImage);
+    ui->Operatewidget->setPixmap(scaledImage); // 这里传递缩放后的图片
 
     double percentage = scaleFactor * 100;
     QString percentageStr = QString::number((int)percentage);
-    ui->label_10->setText(QString("%1%").arg(percentageStr));
+    ui->label_Percentage->setText(QString("%1%").arg(percentageStr));
+}
+
+void Demo001_3::wheelEvent(QWheelEvent *event) {
+    // 检查鼠标事件是否发生在 widget 上
+    if (ui->Operatewidget->rect().contains(ui->Operatewidget->mapFromGlobal(event->globalPos()))) {
+        if (event->angleDelta().y() > 0) {
+            scaleFactor *= 1.1;
+        } else {
+            scaleFactor *= 0.9;
+        }
+
+        int newWidth = currentPixmap.width() * scaleFactor;
+        int newHeight = currentPixmap.height() * scaleFactor;
+
+        QPixmap scaledImage = currentPixmap.scaled(newWidth, newHeight, Qt::KeepAspectRatio, Qt::SmoothTransformation);
+        ui->Operatewidget->setPixmap(scaledImage); // 这里传递缩放后的图片
+
+        double percentage = scaleFactor * 100;
+        QString percentageStr = QString::number((int)percentage);
+        ui->label_Percentage->setText(QString("%1%").arg(percentageStr));
+    }
+
+    QMainWindow::wheelEvent(event);
+}
+
+void Demo001_3::onComboBoxIndexChanged(int index) {
+    // 根据index获取图片路径
+    QString imagePath = getImagePathFromIndex(index);
+    if (!imagePath.isEmpty()) {
+        QPixmap newPixmap(imagePath);
+        QPixmap scaledPixmap = newPixmap.scaled(ui->Operatewidget->size(), Qt::KeepAspectRatio, Qt::SmoothTransformation);
+        ui->Operatewidget->setPixmap(scaledPixmap);
+        // 更新当前图片的成员变量
+        currentPixmap = scaledPixmap;
+        scaleFactor = 1.0;
+        ui->label_Percentage->setText("100%");
+    }
+}
+
+QString Demo001_3::getImagePathFromIndex(int index) {
+    // 假设你有一个方法来根据索引获取图片路径
+    // 这里需要你根据实际情况来实现这个函数
+    QStringList imagePaths = {
+        ":/images/test_image/image.png",
+        ":/images/test_image/image_2.png",
+    };
+    if (index >= 0 && index < imagePaths.size()) {
+        return imagePaths[index];
+    }
+    return ":/images/test_image/image.png";
+}
+
+void Demo001_3::showEvent(QShowEvent *event) {
+    QMainWindow::showEvent(event);
+    loadSettings(); // 重新加载设置,确保Operatewidget显示正确
+    initFrom();
+}
+
+void Demo001_3::hideEvent(QHideEvent *event) {
+    QMainWindow::hideEvent(event);
+    // 可以在这里保存Operatewidget的状态,以便下次显示时恢复
 }
 

+ 13 - 3
OriginalWnd/Demo001_3.h

@@ -24,18 +24,28 @@ public:
     void saveSliderStates();
     void loadSliderStates();
     void closeEvent(QCloseEvent *event);
+
+    void loadGroupSettings(int Id, int Index);
+
+public slots: // 确保这里声明了槽函数
+    void onComboBoxIndexChanged(int index); // 确保签名匹配
+    QString getImagePathFromIndex(int index);
+
+protected:
+    void wheelEvent(QWheelEvent *event);
     void loadSettings();
     void checkSettings();
-    void loadGroupSettings(int Id, int Index);
+    void showEvent(QShowEvent *event) override;
+    void hideEvent(QHideEvent *event) override;
 
 private slots:
-    void on_pushButton_clicked();
+    void on_ZoomUpButton_clicked();
 
     QPixmap getCurrentPixmap() const {
         return currentPixmap;
     }
 
-    void on_pushButton_3_clicked();
+    void on_ZoomOutButton_clicked();
 
 private:
     Ui::Demo001_3 *ui;

+ 17 - 17
OriginalWnd/Demo001_3.ui

@@ -20,17 +20,17 @@
    <enum>Qt::LeftToRight</enum>
   </property>
   <widget class="QWidget" name="centralwidget">
-   <widget class="QComboBox" name="comboBox">
+   <widget class="QComboBox" name="DatacomboBox">
     <property name="geometry">
      <rect>
       <x>20</x>
       <y>20</y>
-      <width>174</width>
+      <width>400</width>
       <height>32</height>
      </rect>
     </property>
    </widget>
-   <widget class="ImageWidget" name="widget" native="true">
+   <widget class="ImageWidget" name="Operatewidget" native="true">
     <property name="geometry">
      <rect>
       <x>20</x>
@@ -359,10 +359,10 @@
      </property>
     </widget>
    </widget>
-   <widget class="QPushButton" name="pushButton_5">
+   <widget class="QPushButton" name="LiveButton">
     <property name="geometry">
      <rect>
-      <x>204</x>
+      <x>436</x>
       <y>20</y>
       <width>60</width>
       <height>32</height>
@@ -398,7 +398,7 @@
      </property>
     </widget>
    </widget>
-   <widget class="QWidget" name="widget_2" native="true">
+   <widget class="QWidget" name="Toolbar" native="true">
     <property name="geometry">
      <rect>
       <x>22</x>
@@ -420,7 +420,7 @@
       <enum>Qt::Vertical</enum>
      </property>
     </widget>
-    <widget class="QPushButton" name="pushButton">
+    <widget class="QPushButton" name="ZoomUpButton">
      <property name="geometry">
       <rect>
        <x>0</x>
@@ -498,7 +498,7 @@
       <string>.......</string>
      </property>
     </widget>
-    <widget class="QPushButton" name="pushButton_3">
+    <widget class="QPushButton" name="ZoomOutButton">
      <property name="geometry">
       <rect>
        <x>142</x>
@@ -511,7 +511,7 @@
       <string/>
      </property>
     </widget>
-    <widget class="QPushButton" name="pushButton_6">
+    <widget class="QPushButton" name="RulerButton">
      <property name="geometry">
       <rect>
        <x>397</x>
@@ -524,7 +524,7 @@
       <string/>
      </property>
     </widget>
-    <widget class="QPushButton" name="pushButton_7">
+    <widget class="QPushButton" name="PenButton">
      <property name="geometry">
       <rect>
        <x>525</x>
@@ -537,7 +537,7 @@
       <string/>
      </property>
     </widget>
-    <widget class="QLabel" name="label_10">
+    <widget class="QLabel" name="label_Percentage">
      <property name="geometry">
       <rect>
        <x>258</x>
@@ -554,7 +554,7 @@
      </property>
     </widget>
    </widget>
-   <widget class="QWidget" name="widget_3" native="true">
+   <widget class="QWidget" name="BackGround" native="true">
     <property name="geometry">
      <rect>
       <x>19</x>
@@ -564,16 +564,16 @@
      </rect>
     </property>
    </widget>
-   <zorder>widget_3</zorder>
-   <zorder>comboBox</zorder>
-   <zorder>widget</zorder>
+   <zorder>BackGround</zorder>
+   <zorder>DatacomboBox</zorder>
+   <zorder>Operatewidget</zorder>
    <zorder>line_2</zorder>
    <zorder>widget_6</zorder>
    <zorder>widget_7</zorder>
    <zorder>widget_8</zorder>
-   <zorder>pushButton_5</zorder>
+   <zorder>LiveButton</zorder>
    <zorder>scrollArea</zorder>
-   <zorder>widget_2</zorder>
+   <zorder>Toolbar</zorder>
   </widget>
  </widget>
  <customwidgets>

+ 47 - 11
OriginalWnd/OriginalWnd.cpp

@@ -3,7 +3,11 @@
 #include "OriginalWnd/Demo001_1.h"
 #include "OriginalWnd/Demo001_2.h"
 #include "OriginalWnd/Demo001_3.h"
-#include <qDebug>
+#include "OriginalWnd/treeviewmanager.h"
+#include <QDebug>
+#include <QJsonDocument>
+#include <QFile>
+#include <QFileDialog>
 #include <QDateTime>
 #include <QTimer>
 #include <QSettings>
@@ -14,6 +18,15 @@ OriginalWnd::OriginalWnd(QWidget *parent)
 {
     ui->setupUi(this);
 
+    // 初始化 TreeViewManager
+    treeViewManager = new TreeViewManager(this, ui->widget_2);
+    if (!treeViewManager) {
+        qWarning() << "TreeViewManager 初始化失败";
+        return;
+    }
+
+    qDebug() << "UI 初始化完成";
+
     initForm();
 }
 
@@ -34,44 +47,67 @@ void OriginalWnd::initForm()
     ui->toolButton_2->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
 
 
-    ui->label_6->setPixmap(QPixmap(":/images/light/user.png").scaled(20, 20, Qt::KeepAspectRatio));
-
-    Demo001_3 *demo001_3 = new Demo001_3;
-    ui->switchShowPageUI->addWidget(demo001_3);
-    ui->switchShowPageUI->setCurrentIndex(ui->switchShowPageUI->indexOf(demo001_3));
+    ui->label_userlogo->setPixmap(QPixmap(":/images/light/user.png").scaled(20, 20, Qt::KeepAspectRatio));
+
+    QSettings settings("OrganizationName__", "ApplicationName__");
+    int lastSavedIndex = settings.value("lastIndex", 1).toInt();
+    if (lastSavedIndex == 1) {
+        Demo001_1 *demo001_1 = new Demo001_1;
+        ui->switchShowPageUI->addWidget(demo001_1);
+        ui->switchShowPageUI->setCurrentIndex(ui->switchShowPageUI->indexOf(demo001_1));
+    }
+    if (lastSavedIndex == 2) {
+        Demo001_2 *demo001_2 = new Demo001_2;
+        ui->switchShowPageUI->addWidget(demo001_2);
+        ui->switchShowPageUI->setCurrentIndex(ui->switchShowPageUI->indexOf(demo001_2));
+    }
+    if (lastSavedIndex == 3) {
+        Demo001_3 *demo001_3 = new Demo001_3;
+        ui->switchShowPageUI->addWidget(demo001_3);
+        ui->switchShowPageUI->setCurrentIndex(ui->switchShowPageUI->indexOf(demo001_3));
+    }
 }
 
 void OriginalWnd::updateTime() {
     QDateTime currentDateTime = QDateTime::currentDateTime();
     QString timeStr = currentDateTime.toString("yyyy-MM-dd HH:mm:ss");
-    ui->label_4->setText(timeStr);
+    ui->label_time->setText(timeStr);
 
     QSettings settings("YourCompany_2", "YourAppName_2");
     QString userName = settings.value("userName", "???").toString();
-    ui->label_5->setText(userName);
+    ui->label_username->setText(userName);
 
 }
 
 
-void OriginalWnd::on_pushButton_4_clicked()
+void OriginalWnd::on_ChartButton_clicked()
 {
     Demo001_1 *demo001_1 = new Demo001_1;
     ui->switchShowPageUI->addWidget(demo001_1);
     ui->switchShowPageUI->setCurrentIndex(ui->switchShowPageUI->indexOf(demo001_1));
+    QSettings settings("OrganizationName__", "ApplicationName__");
+    settings.setValue("lastIndex", 1);
 }
 
 
-void OriginalWnd::on_pushButton_5_clicked()
+void OriginalWnd::on_DoubleImageButton_clicked()
 {
     Demo001_2 *demo001_2 = new Demo001_2;
     ui->switchShowPageUI->addWidget(demo001_2);
     ui->switchShowPageUI->setCurrentIndex(ui->switchShowPageUI->indexOf(demo001_2));
+    QSettings settings("OrganizationName__", "ApplicationName__");
+    settings.setValue("lastIndex", 2);
 }
 
 
-void OriginalWnd::on_pushButton_6_clicked()
+void OriginalWnd::on_SingleImageButton_clicked()
 {
     Demo001_3 *demo001_3 = new Demo001_3;
     ui->switchShowPageUI->addWidget(demo001_3);
     ui->switchShowPageUI->setCurrentIndex(ui->switchShowPageUI->indexOf(demo001_3));
+    QSettings settings("OrganizationName__", "ApplicationName__");
+    settings.setValue("lastIndex", 3);
 }
+
+
+

+ 10 - 10
OriginalWnd/OriginalWnd.h

@@ -2,10 +2,11 @@
 #define ORIGINALWND_H
 
 #include <QMainWindow>
+#include "treeviewmanager.h"
 
-namespace Ui {
-class OriginalWnd;
-}
+QT_BEGIN_NAMESPACE
+namespace Ui { class OriginalWnd; }
+QT_END_NAMESPACE
 
 class OriginalWnd : public QMainWindow
 {
@@ -15,19 +16,18 @@ public:
     explicit OriginalWnd(QWidget *parent = nullptr);
     ~OriginalWnd();
 
-    void initForm();
-
 private slots:
-    void on_pushButton_4_clicked();
-
-    void on_pushButton_5_clicked();
-
-    void on_pushButton_6_clicked();
+    void on_ChartButton_clicked();
+    void on_DoubleImageButton_clicked();
+    void on_SingleImageButton_clicked();
 
     void updateTime();
 
 private:
     Ui::OriginalWnd *ui;
+    TreeViewManager *treeViewManager; // 树视图管理器
+
+    void initForm(); // 初始化表单控件
 };
 
 #endif // ORIGINALWND_H

+ 10 - 23
OriginalWnd/OriginalWnd.ui

@@ -39,19 +39,6 @@
       <height>988</height>
      </rect>
     </property>
-    <widget class="QPushButton" name="pushButton_19">
-     <property name="geometry">
-      <rect>
-       <x>328</x>
-       <y>16</y>
-       <width>76</width>
-       <height>30</height>
-      </rect>
-     </property>
-     <property name="text">
-      <string>PushButton</string>
-     </property>
-    </widget>
    </widget>
    <widget class="QWidget" name="widget" native="true">
     <property name="geometry">
@@ -90,7 +77,7 @@ production</string>
 production</string>
      </property>
     </widget>
-    <widget class="QPushButton" name="pushButton_4">
+    <widget class="QPushButton" name="ChartButton">
      <property name="geometry">
       <rect>
        <x>16</x>
@@ -103,7 +90,7 @@ production</string>
       <string/>
      </property>
     </widget>
-    <widget class="QPushButton" name="pushButton_5">
+    <widget class="QPushButton" name="DoubleImageButton">
      <property name="geometry">
       <rect>
        <x>71</x>
@@ -116,7 +103,7 @@ production</string>
       <string/>
      </property>
     </widget>
-    <widget class="QPushButton" name="pushButton_6">
+    <widget class="QPushButton" name="SingleImageButton">
      <property name="geometry">
       <rect>
        <x>126</x>
@@ -321,7 +308,7 @@ production</string>
       <height>44</height>
      </rect>
     </property>
-    <widget class="QLabel" name="label">
+    <widget class="QLabel" name="label_name">
      <property name="geometry">
       <rect>
        <x>32</x>
@@ -337,7 +324,7 @@ production</string>
       <string>name001</string>
      </property>
     </widget>
-    <widget class="QLabel" name="label_2">
+    <widget class="QLabel" name="RegistrationNumber">
      <property name="geometry">
       <rect>
        <x>284</x>
@@ -353,7 +340,7 @@ production</string>
       <string>Registration number 001</string>
      </property>
     </widget>
-    <widget class="QPushButton" name="pushButton">
+    <widget class="QPushButton" name="CalibrationButton">
      <property name="geometry">
       <rect>
        <x>539</x>
@@ -366,7 +353,7 @@ production</string>
       <string>Calibration</string>
      </property>
     </widget>
-    <widget class="QLabel" name="label_3">
+    <widget class="QLabel" name="ProductIotNumber">
      <property name="geometry">
       <rect>
        <x>789</x>
@@ -408,7 +395,7 @@ production</string>
       <string/>
      </property>
     </widget>
-    <widget class="QLabel" name="label_4">
+    <widget class="QLabel" name="label_time">
      <property name="geometry">
       <rect>
        <x>1334</x>
@@ -424,7 +411,7 @@ production</string>
       <string/>
      </property>
     </widget>
-    <widget class="QLabel" name="label_5">
+    <widget class="QLabel" name="label_username">
      <property name="geometry">
       <rect>
        <x>1686</x>
@@ -440,7 +427,7 @@ production</string>
       <string/>
      </property>
     </widget>
-    <widget class="QLabel" name="label_6">
+    <widget class="QLabel" name="label_userlogo">
      <property name="geometry">
       <rect>
        <x>1658</x>

+ 572 - 0
OriginalWnd/treeviewmanager.cpp

@@ -0,0 +1,572 @@
+#include "treeviewmanager.h"
+
+
+TreeViewManager::TreeViewManager(QWidget *parent, QWidget *widget2)
+    : QWidget(parent),
+    widget2(widget2),
+    treeViewDown(new QTreeView(widget2)), // 初始化 treeViewDown
+    navigationWidget(nullptr),
+    buttonOpenFile(nullptr),
+    buttonUp(nullptr),
+    buttonDown(nullptr),
+    buttonLeft(nullptr),
+    buttonRight(nullptr) {
+    if (!widget2) {
+        qWarning() << "TreeViewManager: widget2 未初始化";
+        return;
+    }
+
+    // 初始化目录树模型
+    downModel = new QStandardItemModel(this);
+    treeViewDown->setModel(downModel);
+    // 创建数据模型
+    //setupTreeData();
+
+    // 应用样式表
+    applyCustomStyles();
+
+    treeViewDown->setHeaderHidden(true);  // 显示头部
+
+    treeViewDown->setGeometry(16, 106, widget2->width()-16, widget2->height() - 106);
+    treeViewDown->setEditTriggers(QAbstractItemView::NoEditTriggers);
+    treeViewDown->show();
+
+    qDebug() << "widget2 geometry:" << widget2->geometry();
+    qDebug() << "treeViewDown geometry:" << treeViewDown->geometry();
+
+
+
+    // 加载 JSON 数据
+    loadJsonFromFile(":/config/menu_config.json");
+
+    // 创建按钮并设置布局
+    setupButton();
+
+    // 创建导航栏
+    navigationWidget = new QWidget(widget2);
+    navigationWidget->setGeometry(15, 15, 300, 74);
+    navigationLayout = new QVBoxLayout(navigationWidget);
+    navigationLayout->setContentsMargins(0, 0, 0, 0);
+    navigationLayout->setSpacing(0);
+    navigationWidget->show();
+
+    // 更新导航栏位置
+    updateNavigationWidgetGeometry();
+
+        connect(treeViewDown, &QTreeView::clicked, this, [=](const QModelIndex &index) {
+            QStandardItem *item = downModel->itemFromIndex(index);
+            if (!item) return;
+
+            QVariant data = item->data(Qt::UserRole);
+            if (data.canConvert<QJsonObject>()) {
+                QJsonObject fields = data.toJsonObject();
+                displayThirdLevelFields(fields); // 显示三级目录字段
+            }
+        });
+
+
+        connect(treeViewDown, &QTreeView::clicked, this, [=](const QModelIndex &index) {
+            if (!index.isValid()) {
+                qWarning() << "点击事件:索引无效";
+                return;
+            }
+
+            QStandardItem *item = downModel->itemFromIndex(index);
+            if (!item) {
+                qWarning() << "点击事件:未找到对应项";
+                return;
+            }
+
+            QVariant data = item->data(Qt::UserRole);
+            if (data.canConvert<QJsonObject>()) {
+                QJsonObject fields = data.toJsonObject();
+                if (fields.contains("isThirdLevel") && fields["isThirdLevel"].toBool()) {
+                    qDebug() << "加载三级目录字段内容:" << fields;
+
+                    // 更新导航栏
+                    updateNavigationBar(index);
+
+                    // 显示三级目录字段内容
+                    displayThirdLevelFields(fields); // 显示三级目录字段
+                    treeViewDown->hide();            // 隐藏 treeViewDown
+                    return;
+                }
+            }
+
+            // 即使是非三级目录,也更新导航栏
+            updateNavigationBar(index);
+            qDebug() << "更新导航栏,目录项:" << item->text();
+        });
+
+
+
+
+
+    connect(buttonOpenFile, &QPushButton::clicked, this, &TreeViewManager::onButtonOpenFileClicked);
+    connect(buttonUp, &QPushButton::clicked, this, &TreeViewManager::onButtonUpClicked);
+    connect(buttonDown, &QPushButton::clicked, this, &TreeViewManager::onButtonDownClicked);
+    connect(buttonLeft, &QPushButton::clicked, this, &TreeViewManager::onButtonLeftClicked);
+    connect(buttonRight, &QPushButton::clicked, this, &TreeViewManager::onButtonRightClicked);
+}
+
+void TreeViewManager::loadJsonFromFile(const QString &filePath)
+{
+    QFile jsonFile(filePath);
+    if (!jsonFile.exists()) {
+        qWarning() << "JSON 文件不存在:" << filePath;
+        return;
+    }
+
+    if (!jsonFile.open(QIODevice::ReadOnly)) {
+        qWarning() << "无法打开 JSON 文件:" << filePath;
+        return;
+    }
+
+    QByteArray fileData = jsonFile.readAll();
+    jsonFile.close();
+
+    QJsonDocument jsonDoc = QJsonDocument::fromJson(fileData);
+    if (jsonDoc.isNull() || !jsonDoc.isObject()) {
+        qWarning() << "JSON 文件格式错误:" << filePath;
+        return;
+    }
+
+    // 直接传递解析好的 JSON 文档
+    loadTreeData(jsonDoc);
+    qDebug() << "JSON 数据加载完成";
+}
+
+
+
+void TreeViewManager::applyCustomStyles() {
+    treeViewDown->setStyleSheet(R"(
+        /* 设置分支图标 */
+        QTreeView::branch:closed:has-children {
+            border-image: none;
+            image: url(:/images/home_add.png);
+        }
+        QTreeView::branch:open:has-children {
+            border-image: none;
+            image: url(:/images/home_minus.png);
+        }
+
+        /* 设置多选框 */
+        QTreeView::indicator:unchecked {
+            image: url(:/images/home_up.png);
+        }
+        QTreeView::indicator:checked {
+            image: url(:/images/home_down.png);
+        }
+
+        /* 背景透明 */
+        QTreeView {
+            background: transparent;
+            border: none;
+        }
+    )");
+}
+
+void TreeViewManager::loadTreeData(const QJsonDocument &doc)
+{
+    if (!doc.isObject()) {
+        qWarning() << "无效的 JSON 结构";
+        return;
+    }
+
+    // qDebug() << "加载的 JSON 数据:" << doc.toJson();
+    buildTree(doc.object(), downModel->invisibleRootItem());
+}
+
+
+
+void TreeViewManager::buildTree(const QJsonObject &jsonObj, QStandardItem *parent)
+{
+    for (auto it = jsonObj.begin(); it != jsonObj.end(); ++it) {
+        if (it.key() == "isThirdLevel") {
+            qDebug() << "跳过 'isThirdLevel' 字段:" << it.key();
+            continue; // 跳过 "isThirdLevel" 字段
+        }
+
+        QStandardItem *item = new QStandardItem(it.key());
+        item->setCheckable(true); // 添加多选框
+        parent->appendRow(item);
+
+        if (it.value().isObject()) {
+            QJsonObject childObj = it.value().toObject();
+
+            if (childObj.contains("isThirdLevel") && childObj["isThirdLevel"].toBool()) {
+                // 是三级目录,存储整个对象到 UserRole
+                item->setData(childObj, Qt::UserRole);
+                qDebug() << "识别为三级目录:" << it.key();
+            } else {
+                // 递归处理子目录
+                buildTree(childObj, item);
+            }
+        }
+    }
+}
+
+
+
+// 更新导航栏位置和大小
+void TreeViewManager::updateNavigationWidgetGeometry()
+{
+    // 设置导航栏的宽度和高度
+    int navWidth = 300;      // 固定宽度为 300 像素
+    int navHeight = 74;      // 固定高度为 74 像素
+
+    // 设置导航栏的左上角位置
+    int navLeft = 15;        // 距离 widget2 左边 15 像素
+    int navTop = 15;         // 距离 widget2 顶部 15 像素
+
+    // 设置导航栏的几何位置
+    navigationWidget->setGeometry(navLeft, navTop, navWidth, navHeight);
+
+    // 如果需要,刷新组件
+    navigationWidget->update();
+
+    qDebug() << "Updated navigationWidget geometry:"
+             << navigationWidget->geometry();
+}
+
+
+
+
+void TreeViewManager::updateNavigationBar(const QModelIndex &index)
+{
+    if (!index.isValid()) {
+        qWarning() << "导航栏更新失败:索引无效";
+        return;
+    }
+
+    QStandardItem *item = downModel->itemFromIndex(index);
+    if (!item) {
+        qWarning() << "导航栏更新失败:未找到对应项";
+        return;
+    }
+
+    qDebug() << "导航栏更新,目录项:" << item->text();
+
+    // 如果导航栏已有布局,先清理
+    if (navigationWidget->layout()) {
+        QLayoutItem *child;
+        while ((child = navigationWidget->layout()->takeAt(0)) != nullptr) {
+            if (child->widget()) {
+                child->widget()->deleteLater();
+            }
+            delete child;
+        }
+        delete navigationWidget->layout();
+    }
+
+    // 构建路径列表,从当前项到根节点
+    QList<QStandardItem *> path;
+    while (item) {
+        if (item->text() != "isThirdLevel") { // 排除 "isThirdLevel" 标识
+            path.prepend(item); // 从根节点开始
+        }
+        item = item->parent();
+    }
+
+    qDebug() << "导航路径:" << [path]() {
+        QStringList pathNames;
+        for (QStandardItem *p : path) {
+            pathNames.append(p->text());
+        }
+        return pathNames.join(" -> ");
+    }();
+
+    // 创建新的导航栏布局
+    QVBoxLayout *newLayout = new QVBoxLayout;
+    newLayout->setContentsMargins(0, 0, 0, 0); // 去除边距
+    newLayout->setSpacing(0);                  // 行间无间隙
+
+    // 确保始终显示三行
+    for (int i = 0; i < 3; ++i) {
+        QLabel *label = new QLabel;
+
+        if (i < path.size()) {
+            QString text = path[i]->text();
+            if (i == 1) text = "    " + text;   // 一级目录缩进
+            if (i == 2) text = "        " + text; // 二级/三级目录缩进
+            label->setText(text);
+        } else {
+            label->setText(""); // 填充空白行
+        }
+
+        // 设置字体和样式
+        QFont font = label->font();
+        font.setPointSize(12); // 设置字体大小
+        label->setFont(font);
+        label->setAlignment(Qt::AlignLeft | Qt::AlignVCenter); // 左对齐且垂直居中
+        label->setFixedHeight(navigationWidget->height() / 3); // 每行高度均分导航栏高度
+
+        newLayout->addWidget(label);
+    }
+
+    // 设置布局并更新导航栏
+    navigationWidget->setLayout(newLayout);
+    navigationWidget->update();
+    qDebug() << "导航栏更新完成:" << path.size() << "项";
+}
+
+
+void TreeViewManager::displayThirdLevelFields(const QJsonObject &fields)
+{
+    if (fields.isEmpty()) {
+        qWarning() << "字段数据为空,无法显示";
+        return;
+    }
+
+    qDebug() << "显示的字段数据:" << fields;
+
+    // 检查是否已存在字段窗口,防止重复创建
+    foreach (QObject *child, widget2->children()) {
+        QWidget *childWidget = qobject_cast<QWidget *>(child);
+        if (childWidget && childWidget->windowTitle() == "字段展示") {
+            qDebug() << "字段窗口已存在,关闭旧窗口";
+            childWidget->close();
+        }
+    }
+
+    QWidget *fieldWindow = new QWidget(widget2); // 使用 widget2 作为父窗口
+    fieldWindow->setWindowTitle("字段展示");
+    fieldWindow->setGeometry(treeViewDown->geometry());
+
+    QVBoxLayout *layout = new QVBoxLayout(fieldWindow);
+
+    for (auto it = fields.begin(); it != fields.end(); ++it) {
+        QString fieldName = it.key();
+        if (fieldName == "isThirdLevel") {
+            continue; // 跳过 isThirdLevel 字段
+        }
+
+        QJsonObject fieldConfig = it.value().toObject();
+        QHBoxLayout *fieldLayout = new QHBoxLayout;
+        QLabel *label = new QLabel(fieldName);
+        label->setFixedWidth(150);
+        fieldLayout->addWidget(label);
+
+        if (fieldConfig["type"].toString() == "input") {
+            QLineEdit *lineEdit = new QLineEdit(fieldConfig["value"].toString());
+            fieldLayout->addWidget(lineEdit);
+            qDebug() << "创建输入控件:" << fieldName << ", 默认值:" << fieldConfig["value"].toString();
+        } else if (fieldConfig["type"].toString() == "dropdown") {
+            QComboBox *comboBox = new QComboBox;
+            QJsonArray options = fieldConfig["options"].toArray();
+            for (const QJsonValue &option : options) {
+                comboBox->addItem(option.toString());
+            }
+            comboBox->setCurrentText(fieldConfig["value"].toString());
+            fieldLayout->addWidget(comboBox);
+            qDebug() << "创建下拉框:" << fieldName << ", 选项:" << options << ", 默认值:" << fieldConfig["value"].toString();
+        } else if (fieldConfig["type"].toString() == "checkbox") {
+            QCheckBox *checkBox = new QCheckBox;
+            checkBox->setChecked(fieldConfig["value"].toString() == "true");
+            fieldLayout->addWidget(checkBox);
+            qDebug() << "创建复选框:" << fieldName << ", 默认值:" << fieldConfig["value"].toString();
+        } else {
+            qWarning() << "未知字段类型:" << fieldConfig["type"].toString();
+        }
+
+        layout->addLayout(fieldLayout);
+    }
+
+    fieldWindow->setLayout(layout);
+    fieldWindow->adjustSize();
+    fieldWindow->show();
+
+    qDebug() << "三级目录字段窗口已打开";
+}
+
+
+
+void TreeViewManager::setupButton()
+{
+    buttonOpenFile = new QPushButton(widget2);
+    buttonUp = new QPushButton(widget2);
+    buttonDown = new QPushButton(widget2);
+    buttonLeft = new QPushButton(widget2);
+    buttonRight = new QPushButton(widget2);
+
+    // 设置 buttonOpenFile 的位置
+    buttonOpenFile->setParent(widget2); // 明确设置 widget2 为父级
+    buttonOpenFile->setMaximumSize(76, 30);
+    buttonOpenFile->setIcon(QIcon(":/images/home_openFile.png"));
+    buttonOpenFile->setText("");
+    buttonOpenFile->setGeometry(328, 16, 76, 30);
+
+    // 设置按钮位置大小
+    buttonUp->setParent(widget2);
+    buttonUp->setMaximumSize(36, 30);
+    buttonUp->setIcon(QIcon(":/images/home_up.png"));
+    buttonUp->setText("");
+    buttonUp->setGeometry(408, 16, 36, 30); // 位置示例
+
+    buttonDown->setParent(widget2);
+    buttonDown->setMaximumSize(36, 30);
+    buttonDown->setIcon(QIcon(":/images/home_down.png"));
+    buttonDown->setText("");
+    buttonDown->setGeometry(408, 50, 36, 30); // 位置示例
+
+    buttonLeft->setParent(widget2);
+    buttonLeft->setMaximumSize(36, 30);
+    buttonLeft->setIcon(QIcon(":/images/home_left.png"));
+    buttonLeft->setText("");
+    buttonLeft->setGeometry(328, 50, 36, 30); // 位置示例
+
+    buttonRight->setParent(widget2);
+    buttonRight->setMaximumSize(36, 30);
+    buttonRight->setIcon(QIcon(":/images/home_right.png"));
+    buttonRight->setText("");
+    buttonRight->setGeometry(368, 50, 36, 30); // 位置示例
+
+    // 显示所有按钮
+    buttonOpenFile->show();
+    buttonUp->show();
+    buttonDown->show();
+    buttonLeft->show();
+    buttonRight->show();
+}
+
+
+
+void TreeViewManager::onButtonOpenFileClicked()
+{
+    foreach (QObject *child, widget2->children()) {
+        QWidget *childWidget = qobject_cast<QWidget *>(child);
+        if (childWidget && childWidget->windowTitle() == "字段展示") {
+            qDebug() << "关闭字段窗口:" << childWidget;
+            childWidget->close();
+        }
+    }
+
+    treeViewDown->show(); // 显示 treeViewDown
+    treeViewDown->collapseAll(); // 收起所有节点
+    treeViewDown->clearSelection();
+
+    // 展开一级目录
+    QStandardItem *rootItem = downModel->invisibleRootItem();
+    if (rootItem) {
+        for (int i = 0; i < rootItem->rowCount(); ++i) {
+            QStandardItem *childItem = rootItem->child(i);
+            if (childItem) {
+                treeViewDown->expand(downModel->indexFromItem(childItem));
+                qDebug() << "展开一级目录:" << childItem->text();
+            }
+        }
+    }
+
+    // 重置导航栏
+    updateNavigationBar(QModelIndex());
+    qDebug() << "成功返回到一级菜单";
+}
+
+
+void TreeViewManager::onButtonUpClicked()
+{
+    qDebug() << "TreeViewManager: 遍历导航向上";
+
+    // 检查当前是否有选中的索引
+    QModelIndex currentIndex = treeViewDown->currentIndex();
+    if (!currentIndex.isValid()) {
+        qDebug() << "没有选中的索引,无法向上遍历";
+        return;
+    }
+
+    // 获取父项索引
+    QModelIndex parentIndex = currentIndex.parent();
+    if (!parentIndex.isValid()) {
+        qDebug() << "当前已在顶级目录,无法向上遍历";
+        return;
+    }
+
+    // 将父项设置为当前选中项
+    treeViewDown->setCurrentIndex(parentIndex);
+
+    // 获取父级菜单的内容
+    QStandardItem *parentItem = downModel->itemFromIndex(parentIndex);
+    if (!parentItem) {
+        qWarning() << "父项未找到,无法遍历";
+        return;
+    }
+
+    // 获取父项的数据
+    QVariant parentData = parentItem->data(Qt::UserRole);
+    if (parentData.canConvert<QJsonObject>()) {
+        QJsonObject fields = parentData.toJsonObject();
+
+        // 检查是否是三级菜单
+        if (fields.contains("type") && fields["type"].toString() == "三级菜单") {
+            qDebug() << "跳过三级菜单的内容:" << parentItem->text();
+            return;
+        }
+    }
+
+    qDebug() << "成功遍历到上一级菜单:" << parentItem->text();
+}
+
+
+
+
+void TreeViewManager::onButtonDownClicked()
+{
+    qDebug() << "TreeViewManager: 遍历导航向下";
+
+    QModelIndex currentIndex = treeViewDown->currentIndex();
+    if (!currentIndex.isValid()) {
+        currentIndex = downModel->index(0, 0); // 从根节点第一个开始
+    }
+
+    QModelIndex nextIndex = getNextIndex(currentIndex);
+    while (nextIndex.isValid()) {
+        QStandardItem *item = downModel->itemFromIndex(nextIndex);
+        if (item && !item->data(Qt::UserRole).isValid()) {
+            // 不是字段节点,导航到此项
+            treeViewDown->setCurrentIndex(nextIndex);
+            updateNavigationBar(nextIndex);
+            qDebug() << "成功导航到下一个目录:" << item->text();
+            return;
+        }
+        // 如果是字段节点,跳过
+        nextIndex = getNextIndex(nextIndex);
+    }
+
+    qDebug() << "已到达目录底部,无法继续向下遍历";
+}
+
+
+// 获取下一个有效索引
+QModelIndex TreeViewManager::getNextIndex(const QModelIndex &currentIndex)
+{
+    // 尝试获取当前项的下一个兄弟项
+    QModelIndex nextIndex = currentIndex.sibling(currentIndex.row() + 1, 0);
+    if (nextIndex.isValid()) {
+        return nextIndex;
+    }
+
+    // 如果没有兄弟项,向上找到父节点的下一个兄弟项
+    QModelIndex parentIndex = currentIndex.parent();
+    while (parentIndex.isValid()) {
+        QModelIndex nextParentSibling = parentIndex.sibling(parentIndex.row() + 1, 0);
+        if (nextParentSibling.isValid()) {
+            return nextParentSibling;
+        }
+        parentIndex = parentIndex.parent(); // 再往上层找
+    }
+
+    // 如果没有兄弟项或父节点兄弟项,返回无效索引
+    return QModelIndex();
+}
+
+
+
+void TreeViewManager::onButtonLeftClicked()
+{
+    qDebug() << "TreeViewManager: 进入下一级目录";
+}
+
+void TreeViewManager::onButtonRightClicked()
+{
+    qDebug() << "TreeViewManager: 返回上一级目录";
+}

+ 106 - 0
OriginalWnd/treeviewmanager.h

@@ -0,0 +1,106 @@
+#ifndef TREEVIEWMANAGER_H
+#define TREEVIEWMANAGER_H
+
+#include <QWidget>
+#include <QTreeView>
+#include <QJsonObject>
+#include <QStandardItemModel>
+#include <QMap>
+#include <QCheckBox>
+#include <QJsonDocument>
+#include <QJsonArray>
+#include <QFile>
+#include <QVBoxLayout>
+#include <QLabel>
+#include <QLineEdit>
+#include <QComboBox>
+#include <QRadioButton>
+#include <QButtonGroup>
+#include <QDebug>
+#include <QPushButton>
+#include <QStyleFactory>
+class TreeViewManager : public QWidget
+{
+    Q_OBJECT
+
+public:
+    /**
+     * @brief 构造函数
+     * @param parent 父窗口
+     * @param downView 完整目录树的视图
+     * @param widget2 父组件,用于确定导航栏位置
+     * @param horizontalLayout2 用于计算导航栏宽度
+     */
+    explicit TreeViewManager(QWidget *parent, QWidget *widget2);
+
+    /**
+     * @brief 加载 JSON 数据并初始化树视图
+     * @param filePath JSON 文件路径
+     */
+    void loadJsonFromFile(const QString &filePath);
+
+    void loadTreeData(const QJsonDocument &doc);
+    //void setupTreeData();
+    void applyCustomStyles();
+
+    /**
+     * @brief 更新导航栏内容,根据点击的目录项动态显示
+     * @param index 点击的目录项索引
+     */
+    void updateNavigationBar(const QModelIndex &index);
+
+private:
+    // 界面组件
+    QWidget *widget2;                            // 父组件,用于确定导航栏位置
+
+    QTreeView *treeViewDown;                     // 完整目录树
+    QStandardItemModel *downModel;               // 树状结构模型
+
+    QWidget *navigationWidget;                   // 动态导航栏窗口
+    QVBoxLayout *navigationLayout;               // 导航栏布局
+
+    QPushButton *buttonOpenFile; // 返回一级菜单
+    QPushButton *buttonUp;       // 遍历导航向上
+    QPushButton *buttonDown;     // 遍历导航向下
+    QPushButton *buttonLeft;     // 进入下一级目录
+    QPushButton *buttonRight;    // 返回上一级目录
+    QModelIndex getNextIndex(const QModelIndex &currentIndex);
+
+
+    void setupButton();     // 创建并初始化按钮
+
+    /**
+     * @brief 构建目录树
+     * @param jsonObj JSON 数据对象
+     * @param parent 父节点
+     */
+    void buildTree(const QJsonObject &jsonObj, QStandardItem *parent);
+
+    /**
+     * @brief 显示字段属性(仅用于构建树,不涉及字段窗口)
+     * @param fields 字段数据
+     */
+    //void displayFields(const QJsonObject &fields);
+
+    /**
+     * @brief 显示三级目录的字段内容(打开新窗口)
+     * @param fields 字段数据
+     */
+    void displayThirdLevelFields(const QJsonObject &fields);
+
+    /**
+     * @brief 更新导航栏窗口的几何位置
+     */
+    void updateNavigationWidgetGeometry();
+
+
+private slots:
+    void onButtonOpenFileClicked(); // 槽函数:返回一级菜单
+    void onButtonUpClicked();       // 槽函数:遍历导航向上
+    void onButtonDownClicked();     // 槽函数:遍历导航向下
+    void onButtonLeftClicked();     // 槽函数:进入下一级目录
+    void onButtonRightClicked();    // 槽函数:返回上一级目录
+
+};
+
+#endif // TREEVIEWMANAGER_H

+ 21 - 0
build/Desktop_Qt_5_15_2_MinGW_64_bit-Debug/.qmake.stash

@@ -0,0 +1,21 @@
+QMAKE_CXX.QT_COMPILER_STDCXX = 201402L
+QMAKE_CXX.QMAKE_GCC_MAJOR_VERSION = 8
+QMAKE_CXX.QMAKE_GCC_MINOR_VERSION = 1
+QMAKE_CXX.QMAKE_GCC_PATCH_VERSION = 0
+QMAKE_CXX.COMPILER_MACROS = \
+    QT_COMPILER_STDCXX \
+    QMAKE_GCC_MAJOR_VERSION \
+    QMAKE_GCC_MINOR_VERSION \
+    QMAKE_GCC_PATCH_VERSION
+QMAKE_CXX.INCDIRS = \
+    D:/app/Qt/Tools/mingw810_64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++ \
+    D:/app/Qt/Tools/mingw810_64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/x86_64-w64-mingw32 \
+    D:/app/Qt/Tools/mingw810_64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/backward \
+    D:/app/Qt/Tools/mingw810_64/lib/gcc/x86_64-w64-mingw32/8.1.0/include \
+    D:/app/Qt/Tools/mingw810_64/lib/gcc/x86_64-w64-mingw32/8.1.0/include-fixed \
+    D:/app/Qt/Tools/mingw810_64/x86_64-w64-mingw32/include
+QMAKE_CXX.LIBDIRS = \
+    D:/app/Qt/Tools/mingw810_64/lib/gcc/x86_64-w64-mingw32/8.1.0 \
+    D:/app/Qt/Tools/mingw810_64/lib/gcc \
+    D:/app/Qt/Tools/mingw810_64/x86_64-w64-mingw32/lib \
+    D:/app/Qt/Tools/mingw810_64/lib

二進制
build/Desktop_Qt_5_15_2_MinGW_64_bit-Debug/.qtc_clangd/.cache/clangd/index/Demo001_1.cpp.240723ABE1FC2C1B.idx


二進制
build/Desktop_Qt_5_15_2_MinGW_64_bit-Debug/.qtc_clangd/.cache/clangd/index/Demo001_1.h.68728DEA7E9F2AB3.idx


二進制
build/Desktop_Qt_5_15_2_MinGW_64_bit-Debug/.qtc_clangd/.cache/clangd/index/Demo001_2.cpp.2575B014FF9BDD6D.idx


二進制
build/Desktop_Qt_5_15_2_MinGW_64_bit-Debug/.qtc_clangd/.cache/clangd/index/Demo001_2.h.0225BC5F9D1244D2.idx


二進制
build/Desktop_Qt_5_15_2_MinGW_64_bit-Debug/.qtc_clangd/.cache/clangd/index/Demo001_3.cpp.B3367E8A71A4769A.idx


二進制
build/Desktop_Qt_5_15_2_MinGW_64_bit-Debug/.qtc_clangd/.cache/clangd/index/Demo001_3.h.259B6AB845DF963D.idx


二進制
build/Desktop_Qt_5_15_2_MinGW_64_bit-Debug/.qtc_clangd/.cache/clangd/index/Group.cpp.A1F5820AF438D13B.idx


二進制
build/Desktop_Qt_5_15_2_MinGW_64_bit-Debug/.qtc_clangd/.cache/clangd/index/Group.h.5CE9D4A18E1DC6E3.idx


二進制
build/Desktop_Qt_5_15_2_MinGW_64_bit-Debug/.qtc_clangd/.cache/clangd/index/ImageWidget.cpp.FF4AB04D1490A615.idx


二進制
build/Desktop_Qt_5_15_2_MinGW_64_bit-Debug/.qtc_clangd/.cache/clangd/index/ImageWidget.h.9B7F833764F22487.idx


二進制
build/Desktop_Qt_5_15_2_MinGW_64_bit-Debug/.qtc_clangd/.cache/clangd/index/ImageWidget_nodrag.cpp.2F3DE47BD880054D.idx


二進制
build/Desktop_Qt_5_15_2_MinGW_64_bit-Debug/.qtc_clangd/.cache/clangd/index/ImageWidget_nodrag.h.01359DF0C05040E9.idx


二進制
build/Desktop_Qt_5_15_2_MinGW_64_bit-Debug/.qtc_clangd/.cache/clangd/index/Login.cpp.18FDEEFCC2C6D7B6.idx


二進制
build/Desktop_Qt_5_15_2_MinGW_64_bit-Debug/.qtc_clangd/.cache/clangd/index/Login.h.BF75476C75DAB116.idx


二進制
build/Desktop_Qt_5_15_2_MinGW_64_bit-Debug/.qtc_clangd/.cache/clangd/index/MainWnd.cpp.6CC56E51F71517DE.idx


二進制
build/Desktop_Qt_5_15_2_MinGW_64_bit-Debug/.qtc_clangd/.cache/clangd/index/MainWnd.h.B9509468BEC18C3E.idx


二進制
build/Desktop_Qt_5_15_2_MinGW_64_bit-Debug/.qtc_clangd/.cache/clangd/index/OriginalWnd.cpp.43B66912F8C62F9C.idx


二進制
build/Desktop_Qt_5_15_2_MinGW_64_bit-Debug/.qtc_clangd/.cache/clangd/index/OriginalWnd.h.989C5478F0CC3E94.idx


二進制
build/Desktop_Qt_5_15_2_MinGW_64_bit-Debug/.qtc_clangd/.cache/clangd/index/QApplication.A93C160D4734A0BE.idx


二進制
build/Desktop_Qt_5_15_2_MinGW_64_bit-Debug/.qtc_clangd/.cache/clangd/index/QButtonGroup.CFCE5B2A463A2320.idx


二進制
build/Desktop_Qt_5_15_2_MinGW_64_bit-Debug/.qtc_clangd/.cache/clangd/index/QCheckBox.96F115A63B1D41CF.idx


二進制
build/Desktop_Qt_5_15_2_MinGW_64_bit-Debug/.qtc_clangd/.cache/clangd/index/QCloseEvent.E4D2C68862FF6332.idx


二進制
build/Desktop_Qt_5_15_2_MinGW_64_bit-Debug/.qtc_clangd/.cache/clangd/index/QComboBox.410383E0990DB52F.idx


二進制
build/Desktop_Qt_5_15_2_MinGW_64_bit-Debug/.qtc_clangd/.cache/clangd/index/QDateTime.CE24CBEEEE400D46.idx


二進制
build/Desktop_Qt_5_15_2_MinGW_64_bit-Debug/.qtc_clangd/.cache/clangd/index/QDebug.1CC754F61714111F.idx


二進制
build/Desktop_Qt_5_15_2_MinGW_64_bit-Debug/.qtc_clangd/.cache/clangd/index/QFile.B2307BA2E3F5E29C.idx


二進制
build/Desktop_Qt_5_15_2_MinGW_64_bit-Debug/.qtc_clangd/.cache/clangd/index/QFileDialog.B655E7C801A99988.idx


二進制
build/Desktop_Qt_5_15_2_MinGW_64_bit-Debug/.qtc_clangd/.cache/clangd/index/QFrame.F5D7679CECCB49E9.idx


二進制
build/Desktop_Qt_5_15_2_MinGW_64_bit-Debug/.qtc_clangd/.cache/clangd/index/QJsonArray.C077F93B166448FC.idx


二進制
build/Desktop_Qt_5_15_2_MinGW_64_bit-Debug/.qtc_clangd/.cache/clangd/index/QJsonDocument.C35CC7F5A4FAC8E1.idx


二進制
build/Desktop_Qt_5_15_2_MinGW_64_bit-Debug/.qtc_clangd/.cache/clangd/index/QJsonObject.B083B46CBFF9C454.idx


二進制
build/Desktop_Qt_5_15_2_MinGW_64_bit-Debug/.qtc_clangd/.cache/clangd/index/QLabel.134BBA620E062EBA.idx


二進制
build/Desktop_Qt_5_15_2_MinGW_64_bit-Debug/.qtc_clangd/.cache/clangd/index/QLineEdit.6D3E154C6486418E.idx


二進制
build/Desktop_Qt_5_15_2_MinGW_64_bit-Debug/.qtc_clangd/.cache/clangd/index/QMainWindow.462130A3C4930C8A.idx


二進制
build/Desktop_Qt_5_15_2_MinGW_64_bit-Debug/.qtc_clangd/.cache/clangd/index/QMap.9E85F4BD18F25DCF.idx


二進制
build/Desktop_Qt_5_15_2_MinGW_64_bit-Debug/.qtc_clangd/.cache/clangd/index/QMouseEvent.03112649795D4EA2.idx


二進制
build/Desktop_Qt_5_15_2_MinGW_64_bit-Debug/.qtc_clangd/.cache/clangd/index/QPainter.5664D055789979A8.idx


二進制
build/Desktop_Qt_5_15_2_MinGW_64_bit-Debug/.qtc_clangd/.cache/clangd/index/QPixmap.E7298A4763622FA8.idx


二進制
build/Desktop_Qt_5_15_2_MinGW_64_bit-Debug/.qtc_clangd/.cache/clangd/index/QPushButton.BA2ED29E58F574DE.idx


二進制
build/Desktop_Qt_5_15_2_MinGW_64_bit-Debug/.qtc_clangd/.cache/clangd/index/QRadioButton.50451BEB931B0889.idx


二進制
build/Desktop_Qt_5_15_2_MinGW_64_bit-Debug/.qtc_clangd/.cache/clangd/index/QScrollArea.B65B51F11723F11C.idx


二進制
build/Desktop_Qt_5_15_2_MinGW_64_bit-Debug/.qtc_clangd/.cache/clangd/index/QSettings.7946B34C9BE002F7.idx


二進制
build/Desktop_Qt_5_15_2_MinGW_64_bit-Debug/.qtc_clangd/.cache/clangd/index/QSlider.507C0577B962E468.idx


二進制
build/Desktop_Qt_5_15_2_MinGW_64_bit-Debug/.qtc_clangd/.cache/clangd/index/QStackedWidget.9969D70315C16E27.idx


二進制
build/Desktop_Qt_5_15_2_MinGW_64_bit-Debug/.qtc_clangd/.cache/clangd/index/QStandardItemModel.BAF084AADEAD86AD.idx


二進制
build/Desktop_Qt_5_15_2_MinGW_64_bit-Debug/.qtc_clangd/.cache/clangd/index/QStatusBar.320C2FECF590F27C.idx


二進制
build/Desktop_Qt_5_15_2_MinGW_64_bit-Debug/.qtc_clangd/.cache/clangd/index/QStyleFactory.85E29A082D5B0639.idx


二進制
build/Desktop_Qt_5_15_2_MinGW_64_bit-Debug/.qtc_clangd/.cache/clangd/index/QTimer.5919EDDE18EADB9B.idx


二進制
build/Desktop_Qt_5_15_2_MinGW_64_bit-Debug/.qtc_clangd/.cache/clangd/index/QToolButton.19517A9893BFA483.idx


二進制
build/Desktop_Qt_5_15_2_MinGW_64_bit-Debug/.qtc_clangd/.cache/clangd/index/QTreeView.8838245AA30A31AD.idx


二進制
build/Desktop_Qt_5_15_2_MinGW_64_bit-Debug/.qtc_clangd/.cache/clangd/index/QVBoxLayout.D3624E654C6AE2FA.idx


二進制
build/Desktop_Qt_5_15_2_MinGW_64_bit-Debug/.qtc_clangd/.cache/clangd/index/QVariant.18E837BA0D1DC18A.idx


二進制
build/Desktop_Qt_5_15_2_MinGW_64_bit-Debug/.qtc_clangd/.cache/clangd/index/QWidget.8BA1F7FF12C88F64.idx


二進制
build/Desktop_Qt_5_15_2_MinGW_64_bit-Debug/.qtc_clangd/.cache/clangd/index/__stdarg___gnuc_va_list.h.927B679101421888.idx


二進制
build/Desktop_Qt_5_15_2_MinGW_64_bit-Debug/.qtc_clangd/.cache/clangd/index/__stdarg___va_copy.h.EBC6A4864E90D5A7.idx


二進制
build/Desktop_Qt_5_15_2_MinGW_64_bit-Debug/.qtc_clangd/.cache/clangd/index/__stdarg_va_arg.h.8AB7E6FF1CF58A89.idx


二進制
build/Desktop_Qt_5_15_2_MinGW_64_bit-Debug/.qtc_clangd/.cache/clangd/index/__stdarg_va_copy.h.10CDF121A25BB1EB.idx


二進制
build/Desktop_Qt_5_15_2_MinGW_64_bit-Debug/.qtc_clangd/.cache/clangd/index/__stdarg_va_list.h.7AACC11FC3EAC2D2.idx


二進制
build/Desktop_Qt_5_15_2_MinGW_64_bit-Debug/.qtc_clangd/.cache/clangd/index/__stddef_max_align_t.h.146DF9454A8E4AC2.idx


二進制
build/Desktop_Qt_5_15_2_MinGW_64_bit-Debug/.qtc_clangd/.cache/clangd/index/__stddef_null.h.D06DD619A41FB4CB.idx


二進制
build/Desktop_Qt_5_15_2_MinGW_64_bit-Debug/.qtc_clangd/.cache/clangd/index/__stddef_nullptr_t.h.3E92F8CD65377B6B.idx


二進制
build/Desktop_Qt_5_15_2_MinGW_64_bit-Debug/.qtc_clangd/.cache/clangd/index/__stddef_offsetof.h.E267E9870AF7329C.idx


二進制
build/Desktop_Qt_5_15_2_MinGW_64_bit-Debug/.qtc_clangd/.cache/clangd/index/__stddef_ptrdiff_t.h.05B5A0C56F9AD276.idx


二進制
build/Desktop_Qt_5_15_2_MinGW_64_bit-Debug/.qtc_clangd/.cache/clangd/index/__stddef_size_t.h.6A38DDE20820A133.idx


二進制
build/Desktop_Qt_5_15_2_MinGW_64_bit-Debug/.qtc_clangd/.cache/clangd/index/__stddef_wchar_t.h.656391B36E25A28F.idx


二進制
build/Desktop_Qt_5_15_2_MinGW_64_bit-Debug/.qtc_clangd/.cache/clangd/index/__stddef_wint_t.h.DDE87AC288F574EA.idx


二進制
build/Desktop_Qt_5_15_2_MinGW_64_bit-Debug/.qtc_clangd/.cache/clangd/index/_mingw.h.8492550075D5A494.idx


二進制
build/Desktop_Qt_5_15_2_MinGW_64_bit-Debug/.qtc_clangd/.cache/clangd/index/_mingw_ddk.h.D39B7B0EBFAADDBE.idx


二進制
build/Desktop_Qt_5_15_2_MinGW_64_bit-Debug/.qtc_clangd/.cache/clangd/index/_mingw_directx.h.28495A5C2E8B5030.idx


二進制
build/Desktop_Qt_5_15_2_MinGW_64_bit-Debug/.qtc_clangd/.cache/clangd/index/_mingw_mac.h.CE8B52168943178B.idx


二進制
build/Desktop_Qt_5_15_2_MinGW_64_bit-Debug/.qtc_clangd/.cache/clangd/index/_mingw_off_t.h.439CF20ACEF2F913.idx


二進制
build/Desktop_Qt_5_15_2_MinGW_64_bit-Debug/.qtc_clangd/.cache/clangd/index/_mingw_print_pop.h.DF4C76A1FDC7CAAF.idx


Some files were not shown because too many files changed in this diff