Prechádzať zdrojové kódy

完善了删除功能

lal 2 rokov pred
rodič
commit
c1d7d40fe7
10 zmenil súbory, kde vykonal 1896 pridanie a 67 odobranie
  1. 196 0
      dialog.ui
  2. 45 0
      geshi
  3. 390 63
      mainwindow.cpp
  4. 6 4
      mainwindow.h
  5. 932 0
      mainwindow.ui
  6. 45 0
      test_tool1.pro
  7. 263 0
      test_tool1.pro.user
  8. 15 0
      tool.cpp
  9. 1 0
      tool.h
  10. 3 0
      格式.js

+ 196 - 0
dialog.ui

@@ -0,0 +1,196 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>Dialog</class>
+ <widget class="QDialog" name="Dialog">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>400</width>
+    <height>300</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>Dialog</string>
+  </property>
+  <layout class="QVBoxLayout" name="verticalLayout">
+   <item>
+    <widget class="QWidget" name="widget" native="true">
+     <layout class="QVBoxLayout" name="verticalLayout_2">
+      <item>
+       <widget class="QWidget" name="widget_2" native="true">
+        <widget class="QLabel" name="label">
+         <property name="geometry">
+          <rect>
+           <x>10</x>
+           <y>10</y>
+           <width>91</width>
+           <height>16</height>
+          </rect>
+         </property>
+         <property name="text">
+          <string>项目名称:</string>
+         </property>
+         <property name="alignment">
+          <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+         </property>
+        </widget>
+        <widget class="QTextEdit" name="pro_name">
+         <property name="geometry">
+          <rect>
+           <x>120</x>
+           <y>10</y>
+           <width>161</width>
+           <height>21</height>
+          </rect>
+         </property>
+        </widget>
+       </widget>
+      </item>
+      <item>
+       <widget class="QWidget" name="widget_3" native="true">
+        <widget class="QLabel" name="label_2">
+         <property name="geometry">
+          <rect>
+           <x>10</x>
+           <y>10</y>
+           <width>91</width>
+           <height>16</height>
+          </rect>
+         </property>
+         <property name="text">
+          <string>app id:</string>
+         </property>
+         <property name="alignment">
+          <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+         </property>
+        </widget>
+        <widget class="QTextEdit" name="app_id">
+         <property name="geometry">
+          <rect>
+           <x>120</x>
+           <y>10</y>
+           <width>161</width>
+           <height>21</height>
+          </rect>
+         </property>
+        </widget>
+       </widget>
+      </item>
+      <item>
+       <widget class="QWidget" name="widget_4" native="true">
+        <widget class="QLabel" name="label_3">
+         <property name="geometry">
+          <rect>
+           <x>0</x>
+           <y>10</y>
+           <width>101</width>
+           <height>20</height>
+          </rect>
+         </property>
+         <property name="text">
+          <string>配置服务器前缀:</string>
+         </property>
+        </widget>
+        <widget class="QTextEdit" name="config_server_pre">
+         <property name="geometry">
+          <rect>
+           <x>120</x>
+           <y>10</y>
+           <width>161</width>
+           <height>21</height>
+          </rect>
+         </property>
+        </widget>
+       </widget>
+      </item>
+      <item>
+       <widget class="QWidget" name="widget_6" native="true">
+        <widget class="QLabel" name="label_4">
+         <property name="geometry">
+          <rect>
+           <x>0</x>
+           <y>10</y>
+           <width>101</width>
+           <height>20</height>
+          </rect>
+         </property>
+         <property name="text">
+          <string>文件服务器前缀:</string>
+         </property>
+        </widget>
+        <widget class="QTextEdit" name="file_serverpre">
+         <property name="geometry">
+          <rect>
+           <x>120</x>
+           <y>10</y>
+           <width>161</width>
+           <height>21</height>
+          </rect>
+         </property>
+         <property name="html">
+          <string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
+&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;meta charset=&quot;utf-8&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
+p, li { white-space: pre-wrap; }
+hr { height: 1px; border-width: 0; }
+li.unchecked::marker { content: &quot;\2610&quot;; }
+li.checked::marker { content: &quot;\2612&quot;; }
+&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'.AppleSystemUIFont'; font-size:13pt; font-weight:400; font-style:normal;&quot;&gt;
+&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+         </property>
+        </widget>
+       </widget>
+      </item>
+      <item>
+       <widget class="QWidget" name="widget_8" native="true">
+        <layout class="QHBoxLayout" name="horizontalLayout">
+         <item>
+          <widget class="QPushButton" name="pushButton">
+           <property name="text">
+            <string>取消</string>
+           </property>
+           <property name="checkable">
+            <bool>true</bool>
+           </property>
+           <property name="checked">
+            <bool>true</bool>
+           </property>
+          </widget>
+         </item>
+         <item>
+          <spacer name="horizontalSpacer">
+           <property name="orientation">
+            <enum>Qt::Horizontal</enum>
+           </property>
+           <property name="sizeHint" stdset="0">
+            <size>
+             <width>40</width>
+             <height>20</height>
+            </size>
+           </property>
+          </spacer>
+         </item>
+         <item>
+          <widget class="QPushButton" name="pushButton_2">
+           <property name="text">
+            <string>确认</string>
+           </property>
+           <property name="checkable">
+            <bool>true</bool>
+           </property>
+           <property name="checked">
+            <bool>true</bool>
+           </property>
+          </widget>
+         </item>
+        </layout>
+       </widget>
+      </item>
+     </layout>
+    </widget>
+   </item>
+  </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>

+ 45 - 0
geshi

@@ -0,0 +1,45 @@
+{
+    "preject_list":[
+                        {
+                            "project_name":"pro1",
+                            "app_id":"app1",
+                            "config_server_pre":".../",
+                            "file_server_pre":".../",
+                            "pro_config":"config.json",
+                            "test_group_list":[
+                               {
+                               "test_group_name":"1",
+                               "test_version_list":{
+                                       "dispatch_policy":"policy.json",
+                                       "group":[
+                                           {
+                                               "group_name":"1",
+                                               "file_list":["1","2"]
+                                           },
+                                           {
+                                               "group_name":"2",
+                                               "file_list":["1","2"]
+                                           }
+                                       ]
+                                   }
+                               },{
+                                "test_group_name":"2",
+                                   "test_version_list":{
+                                                         "dispatch_policy":"policy.json",
+                                       "group":[
+                                                  {
+                                                      "group_name":"1",
+                                                      "file_list":["1","2"]
+                                                  },
+                                           {
+                                               "group_name":"2",
+                                               "file_list":["1","2"]
+                                           }
+                                       ]
+                               }
+                               }
+
+                           ]
+                       }
+    ]
+}

+ 390 - 63
mainwindow.cpp

@@ -70,21 +70,21 @@ MainWindow::MainWindow(QWidget *parent)
         layout6->addWidget(my2);
         ui->frame_4->setLayout(layout6);
         connect(my2, &MyListWidget::operationCompleted, this, &MainWindow::handleOperationCompleted);
-        connect(my2, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(on_listWidget_customContextMenuRequested(QPoint)));
+        connect(my2, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(on_listWidget_2_customContextMenuRequested(QPoint)));
         my3=new MyListWidget();
         my3->setObjectName("listWidget_3");
         QVBoxLayout *layout7 = new QVBoxLayout();
         layout7->addWidget(my3);
         ui->frame_5->setLayout(layout7);
         connect(my3, &MyListWidget::operationCompleted, this, &MainWindow::handleOperationCompleted);
-        connect(my3, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(on_listWidget_customContextMenuRequested(QPoint)));
+        connect(my3, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(on_listWidget_3_customContextMenuRequested(QPoint)));
         my4=new MyListWidget();
         my4->setObjectName("listWidget_4");
         QVBoxLayout *layout8 = new QVBoxLayout();
         layout8->addWidget(my4);
         ui->frame_6->setLayout(layout8);
         connect(my4, &MyListWidget::operationCompleted, this, &MainWindow::handleOperationCompleted);
-        connect(my4, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(on_listWidget_customContextMenuRequested(QPoint)));
+        connect(my4, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(on_listWidget_4_customContextMenuRequested(QPoint)));
 
     QString folder = "/users/lal/documents/RedInterstitialData/HotUpdate2";
     root_pro_path=folder;
@@ -106,15 +106,21 @@ MainWindow::MainWindow(QWidget *parent)
     // 从JSON对象中提取数据
     QJA = QJO.value("children").toArray();
 
+
+    ////////////////////////////////////////////////
     ui->treeView->setContextMenuPolicy(Qt::CustomContextMenu);
-    connect(ui->treeView, &QTreeView::customContextMenuRequested, this, &MainWindow::slotTreeMenu);
+    connect(ui->treeView, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(slotTreeMenu(QPoint)));
+
+
     //初始化treeview 和 combobox
     QTreeView *treeView=ui->treeView;
+
     QStandardItemModel* model=new QStandardItemModel(treeView);
     model->setHorizontalHeaderLabels(QStringList()<<QStringLiteral("名称"));
     treeView->setModel(model);
 
     initTreeView(model->invisibleRootItem(),QJA);
+
     qDebug()<<"QJA"<<QJA;
 
     //初始化右边
@@ -315,6 +321,8 @@ void MainWindow::initTreeView(QStandardItem* parentItem,const QJsonArray& jsonAr
             initTreeView(item, childrenArray);
         }
     }
+    ui->treeView->clearSelection();
+    ui->treeView->setCurrentIndex(QModelIndex());
 
 }
 
@@ -350,63 +358,27 @@ void MainWindow::inittreeview(QJsonValueRef ref)
     ui->treeView->setModel(model);
 }
 
-void MainWindow::on_pushButton_4_clicked()
-{
-    QList<QStandardItem*> items1;
-    QStandardItemModel *model1 = static_cast<QStandardItemModel*>(ui->treeView->model());
-    QStandardItem* item2 = new QStandardItem(QStringLiteral("新建测试"));
-    items1.append(item2);
-    model1->appendRow(items1);
-
 
 
-}
-
 void MainWindow::slotTreeMenu(const QPoint &pos)
 {
-    QString qss = "QMenu{color:#E8E8E8;background:#4D4D4D;margin:2px;}\
-                QMenu::item{padding:3px 20px 3px 20px;}\
-                QMenu::indicator{width:13px;height:13px;}\
-                QMenu::item:selected{color:#E8E8E8;border:0px solid #575757;background:#1E90FF;}\
-                QMenu::separator{height:1px;background:#757575;}";
-
-    QMenu menu;
-    menu.setStyleSheet(qss);    //可以给菜单设置样式
-
-    QModelIndex curIndex = ui->treeView->indexAt(pos);      //当前点击的元素的index
-    QModelIndex index = curIndex.sibling(curIndex.row(),0); //该行的第1列元素的index
-    if (index.isValid())
-    {
-        //可获取元素的文本、data,进行其他判断处理
-        //QStandardItem* item = mModel->itemFromIndex(index);
-        //QString text = item->text();
-        //QVariant data = item->data(Qt::UserRole + 1);
-        //...
-
-        //添加一行菜单,进行展开
-        menu.addAction(QStringLiteral("删除"), this, SLOT(slotTreeMenuDelete(bool)));
-    }
-    menu.exec(QCursor::pos());  //显示菜单
-}
-
-void MainWindow::slotTreeMenuExpand(bool checked)
-{
-    QModelIndex curIndex = ui->treeView->currentIndex();
-    QModelIndex index = curIndex.sibling(curIndex.row(),0); //同一行第一列元素的index
-    if(index.isValid())
-    {
-        ui->treeView->expand(index);
-    }
-}
-
-void MainWindow::slotTreeMenuCollapse(bool checked)
-{
-    QModelIndex curIndex = ui->treeView->currentIndex();
-    QModelIndex index = curIndex.sibling(curIndex.row(),0); //同一行第一列元素的index
-    if(index.isValid())
-    {
-        ui->treeView->collapse(index);
-    }
+//    QModelIndex curItem = ui->treeView->indexAt( pos );
+//    QModelIndex index = curItem.sibling(curItem.row(),0);
+//    if( !index.isValid() )
+//        return;
+
+//    QMenu *popMenu = new QMenu( this );
+//    QAction *deleteSeed = new QAction(tr("Delete"), this);
+//    QString qss = "QMenu{color:#E8E8E8;background:#4D4D4D;margin:2px;}\
+//        QMenu::item{padding:3px 20px 3px 20px;}\
+//        QMenu::indicator{width:13px;height:13px;}\
+//        QMenu::item:selected{color:#E8E8E8;border:0px solid #575757;background:#1E90FF;}\
+//        QMenu::separator{height:1px;background:#757575;}";
+//        popMenu->setStyleSheet(qss);
+//    popMenu->addAction( deleteSeed );
+//    connect( deleteSeed, SIGNAL(triggered() ), this, SLOT( slotTreeMenuDelete()) );
+//    popMenu->exec(  QCursor::pos()  );
+//    delete popMenu;
 }
 //删除设定为假删除,在窗体退出的时候才更新json文件,并执行删除操作
 /////////到这里
@@ -418,12 +390,17 @@ void MainWindow::slotTreeMenuCollapse(bool checked)
 /// /
 ///
 /// //
-void MainWindow::slotTreeMenuDelete(bool checked)
+void MainWindow::slotTreeMenuDelete()
 {
-    QModelIndex curIndex = ui->treeView->currentIndex();
-    QModelIndex index = curIndex.sibling(curIndex.row(),0); //同一行第一列元素的index
-    qDebug()<<curIndex;
-    qDebug()<<index;
+
+//    QModelIndex curIndex = ui->treeView->currentIndex();
+//    QModelIndex index = curIndex.sibling(curIndex.row(),0); //同一行第一列元素的index
+//    qDebug()<<curIndex;
+//    qDebug()<<index;
+//    QStandardItemModel* model = dynamic_cast<QStandardItemModel*>(ui->treeView->model());
+//    model->removeRow(index.row(), index.parent());
+
+
 }
 
 void MainWindow::initComboBox(QStringList qs){
@@ -500,12 +477,37 @@ void MainWindow::on_treeView_clicked(const QModelIndex &index)
         QString childData = index.data().toString();
         qDebug() << "Second-level Node: " << childData;
         initRight(parentData,childData);
-
     }
 
 
 }
 
+void MainWindow::mousePressEvent(QMouseEvent* event)
+{
+//    // 调用基类的函数处理其他的鼠标点击事件
+//    QMainWindow::mousePressEvent(event);
+
+
+//    // 检查点击的位置是否在 treeView 的边界内
+//    if(ui->treeView->rect().contains(event->pos()))
+//    {
+//        // 转换全局坐标为 treeView 的本地坐标
+//        QPoint treeViewPos = ui->treeView->mapFromGlobal(event->globalPos());
+//        // 检查是否有节点在点击的位置
+//        if(!ui->treeView->indexAt(treeViewPos).isValid())
+//        {
+//                // 在这里执行你的操作...
+//                qDebug() << "点击了 treeView 的空白部分";
+//                ui->treeView->clearSelection();
+//                ui->treeView->setCurrentIndex(QModelIndex());
+//        }
+//    }
+//    else{
+//        ui->treeView->clearSelection();
+//        ui->treeView->setCurrentIndex(QModelIndex());
+//    }
+}
+
 void MainWindow::initRightListwidget(QListWidget* qw,const QJsonArray& qja)
 {
     QStringList dataList;
@@ -831,3 +833,328 @@ void MainWindow::handleOperationCompleted(QString fromfilePath)
         qDebug() << "Source file or target folder does not exist.";
     }
 }
+
+void MainWindow::on_pushButton_4_clicked()
+{
+    QList<QStandardItem*> items1;
+    QStandardItemModel *model1 = static_cast<QStandardItemModel*>(ui->treeView->model());
+    //    QStandardItem* item2 = new QStandardItem(QStringLiteral("新建测试"));
+    QDateTime currentDateTime = QDateTime::currentDateTime();
+    QString currentDateTimeString = currentDateTime.toString("yyyy-MM-dd hh:mm:ss");
+    QStandardItem* item2 = new QStandardItem(currentDateTimeString);
+    QString add_Path=root_pro_path+"/"+ui->comboBox->currentText();
+    QDir dir;
+    if (!dir.exists(add_Path+"/"+currentDateTimeString)) {
+        if (dir.mkpath(add_Path+"/"+currentDateTimeString)) {
+            qDebug() << "Folder created successfully.";
+            QString filePath = add_Path+"/"+"Hotupdate.json";
+
+            QFile file(filePath);
+            if (!file.open(QIODevice::ReadOnly))
+            {
+                    QString errorString = file.errorString();
+                    qDebug() << "Failed to open file: " << errorString;
+                    // 其他错误处理逻辑
+            }
+            QByteArray jsonData = file.readAll();
+
+            file.close();
+            QJsonDocument jsonDoc = QJsonDocument::fromJson(jsonData);
+            if (jsonDoc.isNull()) {
+                    qDebug() << "Failed to parse JSON data.";
+                    return;
+            }
+
+            // 将 JSON 数据转换为对象
+            QJsonObject jsonObj = jsonDoc.object();
+
+            // 使用 jsonObj 进行进一步操作,例如读取特定的键值对
+            QJsonObject newQ;
+            QJsonArray newA;
+            newQ.insert("children",newA);
+            newQ.insert("name",currentDateTimeString);
+            QJsonArray qaa=jsonObj["children"].toArray();
+            qaa.append(newQ);
+            jsonObj["children"]=qaa;
+            tool::writeJsonFile(filePath,jsonObj);
+            items1.append(item2);
+            model1->appendRow(items1);
+
+
+        } else {
+            qDebug() << "Failed to create folder.";
+        }
+    } else {
+        qDebug() << "Folder already exists.";
+    }
+
+
+
+}
+
+void MainWindow::on_pushButton_5_clicked()
+{
+    // 获取选择模型
+    QItemSelectionModel* selectionModel = ui->treeView->selectionModel();
+    if (selectionModel)
+    {
+        // 获取当前选中的节点的索引
+        QModelIndexList selectedIndexes = selectionModel->selectedIndexes();
+        QModelIndex parentIndex = selectedIndexes.first().parent();
+        if(parentIndex.isValid())
+        {
+            QMessageBox::information(this, "提示", "请选中一级节点");
+            return;
+        }
+        // 遍历选中的索引列表
+        foreach (const QModelIndex& index, selectedIndexes)
+        {
+
+
+            // 打印选中节点的数据
+            QVariant data = index.data(Qt::DisplayRole);
+
+            qDebug() << "Selected Node Data: " << data.toString();
+            QString add_Path=root_pro_path+"/"+ui->comboBox->currentText()+"/"+data.toString();
+            QString modify_pro_config = root_pro_path+"/"+ui->comboBox->currentText()+"/"+"Hotupdate.json";
+            //直接对新增的版本添加config.json group1 group2 group3 group4
+            qDebug()<<add_Path;
+            QDir folder(add_Path);
+            QStringList subFolders = folder.entryList(QDir::Dirs | QDir::NoDotAndDotDot); // 获取文件夹列表
+            QString folderCount = QDateTime::currentDateTime().toString("yyyy-MM-dd hh:mm:ss"); // 文件夹数目
+
+            qDebug() << "Number of sub-folders: " << folderCount;
+            //新建版本
+            QDir dir;
+            QString version_path=add_Path+"/"+"version"+folderCount;
+            dir.mkpath(version_path);
+            //新建版本下的子文件夹等
+            dir.mkpath(version_path+"/"+"group1");
+            dir.mkpath(version_path+"/"+"group2");
+            dir.mkpath(version_path+"/"+"group3");
+            dir.mkpath(version_path+"/"+"group4");
+            QString filePath = version_path+"/"+"config.json"; // 指定新文件的路径和名称
+
+            QJsonArray jsonArray;
+            for(int i=0;i<4;i++)
+            {
+                    // add obj
+                    QJsonObject object1;
+                    QJsonArray children1;
+
+                    object1["children"] = children1;
+                    object1["selected"] = "0";
+                    jsonArray.append(object1);
+
+            }
+            QFile file(filePath);
+            if (file.open(QIODevice::WriteOnly | QIODevice::Text))
+            {
+                    QJsonDocument jsonDocument(jsonArray);
+                    QString jsonString = jsonDocument.toJson();
+
+                    QTextStream stream(&file);
+                    stream << jsonString; // 将JSON文本写入文件
+
+                    file.close();
+                    qDebug() << "File written successfully!";
+            }
+            else
+            {
+                    qDebug() << "Failed to write the file!";
+            }
+            //修改项目根json文件 modify_pro_config
+            //folderCount
+            qDebug()<<index.row();
+            QFile file1(modify_pro_config);
+            if (!file1.open(QIODevice::ReadOnly))
+            {
+                    QString errorString = file1.errorString();
+                    qDebug() << "Failed to open file: " << errorString;
+                    // 其他错误处理逻辑
+            }
+            QByteArray jsonData = file1.readAll();
+            QJsonDocument jsonDoc = QJsonDocument::fromJson(jsonData);
+            if (jsonDoc.isNull()) {
+                    qDebug() << "Failed to parse JSON data.";
+                    return;
+            }
+            // 将 JSON 数据转换为对象
+            QJsonObject jsonObj = jsonDoc.object();
+            QJsonArray parentArray = jsonObj["children"].toArray();
+            QJsonObject childObject = parentArray[index.row()].toObject();
+            QJsonArray nestedArray = childObject["children"].toArray();
+//            {
+//                "name": "version1"
+//            }
+            QJsonObject temo1;
+            temo1["name"]="version" + folderCount;
+            nestedArray.append(temo1);
+
+            childObject["children"] = nestedArray;
+            parentArray[index.row()] = childObject;
+            jsonObj["children"] = parentArray;
+            qDebug() << "Modified QJsonObject:" << jsonObj;
+            tool::writeJsonFile(modify_pro_config,jsonObj);
+            //
+
+            QStandardItemModel* model = dynamic_cast<QStandardItemModel*>(ui->treeView->model());
+
+            if (model) {
+                    QStandardItem* parentItem = model->itemFromIndex(index);
+
+                    if (parentItem) {
+                        QStandardItem* childItem = new QStandardItem("version"+folderCount);
+                        parentItem->appendRow(childItem);
+                    }
+            }
+
+
+        }
+    }
+
+
+}
+
+
+void MainWindow::on_comboBox_customContextMenuRequested(const QPoint &pos)
+{
+
+}
+
+
+void MainWindow::on_pushButton_9_clicked()
+{
+
+//    qDebug()<<ui->treeView->currentIndex();
+//     获取被选中的节点
+    QModelIndex selectedIndex = ui->treeView->currentIndex();
+    if(!selectedIndex.isValid())
+    {
+        // 如果没有选中任何节点,则弹出提示框
+        QMessageBox::information(this, "提示", "没有选中任何节点");
+        return;
+    }
+
+    // 检查选中的节点是一级节点还是二级节点
+    if(selectedIndex.parent().isValid())
+    {
+        // 如果选中的节点有父节点,那么它是二级节点
+        // 在这里执行二级节点对应的代码...
+        QMessageBox::StandardButton reply;
+        reply = QMessageBox::question(this, "Test", "确定要删除"+selectedIndex.data().toString(),
+                                      QMessageBox::Yes|QMessageBox::No|QMessageBox::Cancel);
+
+        if (reply == QMessageBox::Yes) {
+            qDebug() << "Yes was clicked";
+            qDebug() << "选中的是二级节点";
+            QModelIndex parentIndex = selectedIndex.parent();
+            QString del_Path=root_pro_path+"/"+ui->comboBox->currentText()+"/"+parentIndex.data().toString()+"/"+selectedIndex.data().toString();
+            QString modify_pro_config = root_pro_path+"/"+ui->comboBox->currentText()+"/"+"Hotupdate.json";
+            //删除文件夹
+            QDir dir(del_Path);
+            dir.removeRecursively();
+            //修改json文件
+            QFile file1(modify_pro_config);
+            if (!file1.open(QIODevice::ReadOnly))
+            {
+                    QString errorString = file1.errorString();
+                    qDebug() << "Failed to open file: " << errorString;
+                    // 其他错误处理逻辑
+            }
+            QByteArray jsonData = file1.readAll();
+            QJsonDocument jsonDoc = QJsonDocument::fromJson(jsonData);
+            if (jsonDoc.isNull()) {
+                    qDebug() << "Failed to parse JSON data.";
+                    return;
+            }
+            // 将 JSON 数据转换为对象
+            QJsonObject jsonObj = jsonDoc.object();
+            QJsonArray parentArray = jsonObj["children"].toArray();
+            QJsonObject childObject = parentArray[parentIndex.row()].toObject();
+            QJsonArray nestedArray = childObject["children"].toArray();
+
+            nestedArray.removeAt(selectedIndex.row());
+
+
+            childObject["children"] = nestedArray;
+            parentArray[parentIndex.row()] = childObject;
+            jsonObj["children"] = parentArray;
+            qDebug() << "Modified QJsonObject:" << jsonObj;
+            tool::writeJsonFile(modify_pro_config,jsonObj);
+
+            QStandardItemModel* model = dynamic_cast<QStandardItemModel*>(ui->treeView->model());
+
+            if (model) {
+                    QStandardItem* parentItem = model->itemFromIndex(parentIndex);
+
+                    if (parentItem) {
+                        parentItem->removeRow(selectedIndex.row());
+                    }
+            }
+
+        } else if (reply == QMessageBox::No) {
+            qDebug() << "No was clicked";
+        } else {
+            qDebug() << "Cancel was clicked";
+        }
+
+
+    }
+    else
+    {
+        // 如果选中的节点没有父节点,那么它是一级节点
+        // 在这里执行一级节点对应的代码...
+        QMessageBox::StandardButton reply;
+        reply = QMessageBox::question(this, "Test", "确定要删除"+selectedIndex.data().toString(),
+                                      QMessageBox::Yes|QMessageBox::No|QMessageBox::Cancel);
+
+        if (reply == QMessageBox::Yes) {
+            qDebug() << "Yes was clicked";
+            qDebug() << "选中的是一级节点";
+            QString del_Path=root_pro_path+"/"+ui->comboBox->currentText()+"/"+selectedIndex.data().toString();
+            QString modify_pro_config = root_pro_path+"/"+ui->comboBox->currentText()+"/"+"Hotupdate.json";
+            //删除文件夹
+            QDir dir(del_Path);
+            dir.removeRecursively();
+            //修改json文件
+            QFile file1(modify_pro_config);
+            if (!file1.open(QIODevice::ReadOnly))
+            {
+                    QString errorString = file1.errorString();
+                    qDebug() << "Failed to open file: " << errorString;
+                    // 其他错误处理逻辑
+            }
+            QByteArray jsonData = file1.readAll();
+            QJsonDocument jsonDoc = QJsonDocument::fromJson(jsonData);
+            if (jsonDoc.isNull()) {
+                    qDebug() << "Failed to parse JSON data.";
+                    return;
+            }
+            // 将 JSON 数据转换为对象
+            QJsonObject jsonObj = jsonDoc.object();
+            QJsonArray parentArray = jsonObj["children"].toArray();
+
+
+            parentArray.removeAt(selectedIndex.row());
+
+
+
+            jsonObj["children"] = parentArray;
+            qDebug() << "Modified QJsonObject:" << jsonObj;
+            tool::writeJsonFile(modify_pro_config,jsonObj);
+
+            QStandardItemModel* model = dynamic_cast<QStandardItemModel*>(ui->treeView->model());
+            model->removeRow(selectedIndex.row());
+
+
+        } else if (reply == QMessageBox::No) {
+            qDebug() << "No was clicked";
+        } else {
+            qDebug() << "Cancel was clicked";
+        }
+
+
+    }
+}
+

+ 6 - 4
mainwindow.h

@@ -29,7 +29,8 @@ public:
     MainWindow(QWidget *parent = nullptr);
 
     ~MainWindow();
-
+protected:
+    void mousePressEvent(QMouseEvent* event) override;
 
 private:
     Ui::MainWindow *ui;
@@ -73,9 +74,7 @@ private slots:
     void on_pushButton_4_clicked();
 
     void slotTreeMenu(const QPoint &pos);
-    void slotTreeMenuExpand(bool checked = false);
-    void slotTreeMenuCollapse(bool checked = false);
-    void slotTreeMenuDelete(bool checked = false);
+    void slotTreeMenuDelete();
 
 
     void on_treeView_clicked(const QModelIndex &index);
@@ -90,5 +89,8 @@ private slots:
     void handleOperationCompleted(QString fromfilePath);
 
 
+    void on_pushButton_5_clicked();
+    void on_comboBox_customContextMenuRequested(const QPoint &pos);
+    void on_pushButton_9_clicked();
 };
 #endif // MAINWINDOW_H

+ 932 - 0
mainwindow.ui

@@ -0,0 +1,932 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>MainWindow</class>
+ <widget class="QMainWindow" name="MainWindow">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>800</width>
+    <height>600</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>MainWindow</string>
+  </property>
+  <property name="styleSheet">
+   <string notr="true"/>
+  </property>
+  <widget class="QWidget" name="centralwidget">
+   <layout class="QVBoxLayout" name="verticalLayout">
+    <item>
+     <widget class="QWidget" name="widget" native="true">
+      <property name="sizePolicy">
+       <sizepolicy hsizetype="Expanding" vsizetype="Preferred">
+        <horstretch>111</horstretch>
+        <verstretch>0</verstretch>
+       </sizepolicy>
+      </property>
+      <property name="maximumSize">
+       <size>
+        <width>16777215</width>
+        <height>45</height>
+       </size>
+      </property>
+      <layout class="QHBoxLayout" name="horizontalLayout_3">
+       <property name="leftMargin">
+        <number>10</number>
+       </property>
+       <property name="topMargin">
+        <number>0</number>
+       </property>
+       <property name="rightMargin">
+        <number>10</number>
+       </property>
+       <property name="bottomMargin">
+        <number>0</number>
+       </property>
+       <item>
+        <widget class="QLabel" name="label">
+         <property name="styleSheet">
+          <string notr="true">color:white;</string>
+         </property>
+         <property name="text">
+          <string>项目</string>
+         </property>
+        </widget>
+       </item>
+       <item>
+        <widget class="QComboBox" name="comboBox">
+         <item>
+          <property name="text">
+           <string>1</string>
+          </property>
+         </item>
+         <item>
+          <property name="text">
+           <string>1</string>
+          </property>
+         </item>
+         <item>
+          <property name="text">
+           <string>1</string>
+          </property>
+         </item>
+         <item>
+          <property name="text">
+           <string>11</string>
+          </property>
+         </item>
+         <item>
+          <property name="text">
+           <string>1</string>
+          </property>
+         </item>
+         <item>
+          <property name="text">
+           <string>1</string>
+          </property>
+         </item>
+         <item>
+          <property name="text">
+           <string>1</string>
+          </property>
+         </item>
+         <item>
+          <property name="text">
+           <string>1</string>
+          </property>
+         </item>
+         <item>
+          <property name="text">
+           <string>1</string>
+          </property>
+         </item>
+         <item>
+          <property name="text">
+           <string>新建项目</string>
+          </property>
+         </item>
+         <item>
+          <property name="text">
+           <string>新建项目</string>
+          </property>
+         </item>
+        </widget>
+       </item>
+       <item>
+        <spacer name="horizontalSpacer">
+         <property name="orientation">
+          <enum>Qt::Horizontal</enum>
+         </property>
+         <property name="sizeHint" stdset="0">
+          <size>
+           <width>40</width>
+           <height>20</height>
+          </size>
+         </property>
+        </spacer>
+       </item>
+       <item>
+        <widget class="QPushButton" name="pushButton">
+         <property name="styleSheet">
+          <string notr="true">color:white;</string>
+         </property>
+         <property name="text">
+          <string>配置</string>
+         </property>
+        </widget>
+       </item>
+       <item>
+        <widget class="QPushButton" name="pushButton_2">
+         <property name="styleSheet">
+          <string notr="true">color:white;</string>
+         </property>
+         <property name="text">
+          <string>新建项目</string>
+         </property>
+        </widget>
+       </item>
+       <item>
+        <widget class="QPushButton" name="pushButton_3">
+         <property name="styleSheet">
+          <string notr="true">color:white;</string>
+         </property>
+         <property name="text">
+          <string>删除项目</string>
+         </property>
+        </widget>
+       </item>
+      </layout>
+     </widget>
+    </item>
+    <item>
+     <widget class="QFrame" name="frame_2">
+      <property name="frameShape">
+       <enum>QFrame::StyledPanel</enum>
+      </property>
+      <property name="frameShadow">
+       <enum>QFrame::Raised</enum>
+      </property>
+      <property name="lineWidth">
+       <number>0</number>
+      </property>
+      <layout class="QHBoxLayout" name="horizontalLayout">
+       <property name="leftMargin">
+        <number>0</number>
+       </property>
+       <property name="topMargin">
+        <number>0</number>
+       </property>
+       <property name="rightMargin">
+        <number>0</number>
+       </property>
+       <property name="bottomMargin">
+        <number>0</number>
+       </property>
+       <item>
+        <widget class="QFrame" name="frame_3">
+         <property name="styleSheet">
+          <string notr="true">color:rgb(0, 0, 0)</string>
+         </property>
+         <property name="frameShape">
+          <enum>QFrame::StyledPanel</enum>
+         </property>
+         <property name="frameShadow">
+          <enum>QFrame::Raised</enum>
+         </property>
+         <property name="lineWidth">
+          <number>-1</number>
+         </property>
+         <layout class="QHBoxLayout" name="horizontalLayout_2">
+          <property name="leftMargin">
+           <number>0</number>
+          </property>
+          <property name="topMargin">
+           <number>0</number>
+          </property>
+          <property name="rightMargin">
+           <number>0</number>
+          </property>
+          <property name="bottomMargin">
+           <number>0</number>
+          </property>
+          <item>
+           <widget class="QWidget" name="widget" native="true">
+            <property name="minimumSize">
+             <size>
+              <width>0</width>
+              <height>0</height>
+             </size>
+            </property>
+            <property name="maximumSize">
+             <size>
+              <width>200</width>
+              <height>16777215</height>
+             </size>
+            </property>
+            <layout class="QVBoxLayout" name="verticalLayout_2">
+             <item>
+              <widget class="QTreeView" name="treeView">
+               <property name="styleSheet">
+                <string notr="true">color:white;</string>
+               </property>
+              </widget>
+             </item>
+             <item>
+              <widget class="QWidget" name="widget_2" native="true">
+               <property name="minimumSize">
+                <size>
+                 <width>0</width>
+                 <height>30</height>
+                </size>
+               </property>
+               <layout class="QHBoxLayout" name="horizontalLayout_4">
+                <item>
+                 <widget class="QPushButton" name="pushButton_9">
+                  <property name="styleSheet">
+                   <string notr="true">color:white;</string>
+                  </property>
+                  <property name="text">
+                   <string>删除</string>
+                  </property>
+                 </widget>
+                </item>
+                <item>
+                 <widget class="QPushButton" name="pushButton_4">
+                  <property name="styleSheet">
+                   <string notr="true">color:white;</string>
+                  </property>
+                  <property name="text">
+                   <string>新增测试</string>
+                  </property>
+                 </widget>
+                </item>
+                <item>
+                 <widget class="QPushButton" name="pushButton_5">
+                  <property name="styleSheet">
+                   <string notr="true">color:white;</string>
+                  </property>
+                  <property name="text">
+                   <string>新增版本</string>
+                  </property>
+                 </widget>
+                </item>
+               </layout>
+              </widget>
+             </item>
+            </layout>
+            <zorder>widget_2</zorder>
+            <zorder>treeView</zorder>
+           </widget>
+          </item>
+          <item>
+           <widget class="QWidget" name="widget_4" native="true">
+            <property name="styleSheet">
+             <string notr="true"/>
+            </property>
+            <layout class="QVBoxLayout" name="verticalLayout_3">
+             <property name="spacing">
+              <number>0</number>
+             </property>
+             <property name="leftMargin">
+              <number>0</number>
+             </property>
+             <property name="topMargin">
+              <number>0</number>
+             </property>
+             <property name="rightMargin">
+              <number>0</number>
+             </property>
+             <property name="bottomMargin">
+              <number>0</number>
+             </property>
+             <item>
+              <widget class="QWidget" name="widget_7" native="true">
+               <layout class="QVBoxLayout" name="verticalLayout_4">
+                <property name="spacing">
+                 <number>0</number>
+                </property>
+                <property name="leftMargin">
+                 <number>12</number>
+                </property>
+                <property name="topMargin">
+                 <number>12</number>
+                </property>
+                <property name="rightMargin">
+                 <number>12</number>
+                </property>
+                <property name="bottomMargin">
+                 <number>12</number>
+                </property>
+                <item>
+                 <widget class="QWidget" name="widget_5" native="true">
+                  <layout class="QHBoxLayout" name="horizontalLayout_7">
+                   <property name="spacing">
+                    <number>0</number>
+                   </property>
+                   <property name="leftMargin">
+                    <number>0</number>
+                   </property>
+                   <property name="topMargin">
+                    <number>0</number>
+                   </property>
+                   <property name="rightMargin">
+                    <number>0</number>
+                   </property>
+                   <property name="bottomMargin">
+                    <number>0</number>
+                   </property>
+                   <item>
+                    <widget class="QWidget" name="widget_11" native="true">
+                     <layout class="QVBoxLayout" name="verticalLayout_5">
+                      <property name="spacing">
+                       <number>0</number>
+                      </property>
+                      <property name="leftMargin">
+                       <number>0</number>
+                      </property>
+                      <property name="topMargin">
+                       <number>0</number>
+                      </property>
+                      <property name="rightMargin">
+                       <number>0</number>
+                      </property>
+                      <property name="bottomMargin">
+                       <number>0</number>
+                      </property>
+                      <item>
+                       <widget class="QWidget" name="widget_13" native="true">
+                        <property name="minimumSize">
+                         <size>
+                          <width>0</width>
+                          <height>25</height>
+                         </size>
+                        </property>
+                        <property name="maximumSize">
+                         <size>
+                          <width>16777215</width>
+                          <height>25</height>
+                         </size>
+                        </property>
+                        <layout class="QHBoxLayout" name="horizontalLayout_9">
+                         <property name="spacing">
+                          <number>0</number>
+                         </property>
+                         <property name="leftMargin">
+                          <number>0</number>
+                         </property>
+                         <property name="topMargin">
+                          <number>0</number>
+                         </property>
+                         <property name="rightMargin">
+                          <number>0</number>
+                         </property>
+                         <property name="bottomMargin">
+                          <number>0</number>
+                         </property>
+                         <item>
+                          <widget class="QLabel" name="label_2">
+                           <property name="minimumSize">
+                            <size>
+                             <width>0</width>
+                             <height>25</height>
+                            </size>
+                           </property>
+                           <property name="styleSheet">
+                            <string notr="true">color:white;</string>
+                           </property>
+                           <property name="text">
+                            <string>测试分组1</string>
+                           </property>
+                          </widget>
+                         </item>
+                         <item>
+                          <widget class="QWidget" name="slide" native="true">
+                           <property name="minimumSize">
+                            <size>
+                             <width>0</width>
+                             <height>25</height>
+                            </size>
+                           </property>
+                           <property name="maximumSize">
+                            <size>
+                             <width>60</width>
+                             <height>16777215</height>
+                            </size>
+                           </property>
+                          </widget>
+                         </item>
+                        </layout>
+                       </widget>
+                      </item>
+                      <item>
+                       <widget class="QWidget" name="widget_group1" native="true">
+                        <layout class="QHBoxLayout" name="horizontalLayout_13">
+                         <item>
+                          <widget class="QFrame" name="frame">
+                           <property name="frameShape">
+                            <enum>QFrame::StyledPanel</enum>
+                           </property>
+                           <property name="frameShadow">
+                            <enum>QFrame::Raised</enum>
+                           </property>
+                          </widget>
+                         </item>
+                        </layout>
+                       </widget>
+                      </item>
+                     </layout>
+                    </widget>
+                   </item>
+                   <item>
+                    <widget class="QWidget" name="widget_12" native="true">
+                     <layout class="QVBoxLayout" name="verticalLayout_6">
+                      <property name="spacing">
+                       <number>0</number>
+                      </property>
+                      <property name="leftMargin">
+                       <number>0</number>
+                      </property>
+                      <property name="topMargin">
+                       <number>0</number>
+                      </property>
+                      <property name="rightMargin">
+                       <number>0</number>
+                      </property>
+                      <property name="bottomMargin">
+                       <number>0</number>
+                      </property>
+                      <item>
+                       <widget class="QWidget" name="widget_16" native="true">
+                        <property name="minimumSize">
+                         <size>
+                          <width>0</width>
+                          <height>25</height>
+                         </size>
+                        </property>
+                        <property name="maximumSize">
+                         <size>
+                          <width>16777215</width>
+                          <height>25</height>
+                         </size>
+                        </property>
+                        <layout class="QHBoxLayout" name="horizontalLayout_10">
+                         <property name="spacing">
+                          <number>0</number>
+                         </property>
+                         <property name="leftMargin">
+                          <number>0</number>
+                         </property>
+                         <property name="topMargin">
+                          <number>0</number>
+                         </property>
+                         <property name="rightMargin">
+                          <number>0</number>
+                         </property>
+                         <property name="bottomMargin">
+                          <number>0</number>
+                         </property>
+                         <item>
+                          <widget class="QLabel" name="label_3">
+                           <property name="minimumSize">
+                            <size>
+                             <width>0</width>
+                             <height>25</height>
+                            </size>
+                           </property>
+                           <property name="styleSheet">
+                            <string notr="true">color:white;</string>
+                           </property>
+                           <property name="text">
+                            <string>测试分组2</string>
+                           </property>
+                          </widget>
+                         </item>
+                         <item>
+                          <widget class="QWidget" name="slide_2" native="true">
+                           <property name="minimumSize">
+                            <size>
+                             <width>0</width>
+                             <height>25</height>
+                            </size>
+                           </property>
+                           <property name="maximumSize">
+                            <size>
+                             <width>60</width>
+                             <height>16777215</height>
+                            </size>
+                           </property>
+                          </widget>
+                         </item>
+                        </layout>
+                       </widget>
+                      </item>
+                      <item>
+                       <widget class="QWidget" name="widget_group2" native="true">
+                        <layout class="QVBoxLayout" name="verticalLayout_9">
+                         <item>
+                          <widget class="QFrame" name="frame_4">
+                           <property name="frameShape">
+                            <enum>QFrame::StyledPanel</enum>
+                           </property>
+                           <property name="frameShadow">
+                            <enum>QFrame::Raised</enum>
+                           </property>
+                          </widget>
+                         </item>
+                        </layout>
+                       </widget>
+                      </item>
+                     </layout>
+                    </widget>
+                   </item>
+                  </layout>
+                 </widget>
+                </item>
+                <item>
+                 <widget class="QWidget" name="widget_3" native="true">
+                  <layout class="QHBoxLayout" name="horizontalLayout_8">
+                   <property name="spacing">
+                    <number>0</number>
+                   </property>
+                   <property name="leftMargin">
+                    <number>0</number>
+                   </property>
+                   <property name="topMargin">
+                    <number>0</number>
+                   </property>
+                   <property name="rightMargin">
+                    <number>0</number>
+                   </property>
+                   <property name="bottomMargin">
+                    <number>0</number>
+                   </property>
+                   <item>
+                    <widget class="QWidget" name="widget_6" native="true">
+                     <layout class="QVBoxLayout" name="verticalLayout_8">
+                      <property name="spacing">
+                       <number>0</number>
+                      </property>
+                      <property name="leftMargin">
+                       <number>0</number>
+                      </property>
+                      <property name="topMargin">
+                       <number>0</number>
+                      </property>
+                      <property name="rightMargin">
+                       <number>0</number>
+                      </property>
+                      <property name="bottomMargin">
+                       <number>0</number>
+                      </property>
+                      <item>
+                       <widget class="QWidget" name="widget_20" native="true">
+                        <property name="minimumSize">
+                         <size>
+                          <width>0</width>
+                          <height>25</height>
+                         </size>
+                        </property>
+                        <property name="maximumSize">
+                         <size>
+                          <width>16777215</width>
+                          <height>25</height>
+                         </size>
+                        </property>
+                        <layout class="QHBoxLayout" name="horizontalLayout_12">
+                         <property name="spacing">
+                          <number>0</number>
+                         </property>
+                         <property name="leftMargin">
+                          <number>0</number>
+                         </property>
+                         <property name="topMargin">
+                          <number>0</number>
+                         </property>
+                         <property name="rightMargin">
+                          <number>0</number>
+                         </property>
+                         <property name="bottomMargin">
+                          <number>0</number>
+                         </property>
+                         <item>
+                          <widget class="QLabel" name="label_6">
+                           <property name="minimumSize">
+                            <size>
+                             <width>0</width>
+                             <height>25</height>
+                            </size>
+                           </property>
+                           <property name="styleSheet">
+                            <string notr="true">color:white;</string>
+                           </property>
+                           <property name="text">
+                            <string>测试分组3</string>
+                           </property>
+                          </widget>
+                         </item>
+                         <item>
+                          <widget class="QWidget" name="slide_3" native="true">
+                           <property name="minimumSize">
+                            <size>
+                             <width>0</width>
+                             <height>25</height>
+                            </size>
+                           </property>
+                           <property name="maximumSize">
+                            <size>
+                             <width>60</width>
+                             <height>16777215</height>
+                            </size>
+                           </property>
+                          </widget>
+                         </item>
+                        </layout>
+                       </widget>
+                      </item>
+                      <item>
+                       <widget class="QWidget" name="widget_group3" native="true">
+                        <layout class="QVBoxLayout" name="verticalLayout_10">
+                         <item>
+                          <widget class="QFrame" name="frame_5">
+                           <property name="frameShape">
+                            <enum>QFrame::StyledPanel</enum>
+                           </property>
+                           <property name="frameShadow">
+                            <enum>QFrame::Raised</enum>
+                           </property>
+                          </widget>
+                         </item>
+                        </layout>
+                       </widget>
+                      </item>
+                     </layout>
+                    </widget>
+                   </item>
+                   <item>
+                    <widget class="QWidget" name="widget_10" native="true">
+                     <layout class="QVBoxLayout" name="verticalLayout_7">
+                      <property name="spacing">
+                       <number>0</number>
+                      </property>
+                      <property name="leftMargin">
+                       <number>0</number>
+                      </property>
+                      <property name="topMargin">
+                       <number>0</number>
+                      </property>
+                      <property name="rightMargin">
+                       <number>0</number>
+                      </property>
+                      <property name="bottomMargin">
+                       <number>0</number>
+                      </property>
+                      <item>
+                       <widget class="QWidget" name="widget_18" native="true">
+                        <property name="minimumSize">
+                         <size>
+                          <width>0</width>
+                          <height>25</height>
+                         </size>
+                        </property>
+                        <property name="maximumSize">
+                         <size>
+                          <width>16777215</width>
+                          <height>25</height>
+                         </size>
+                        </property>
+                        <layout class="QHBoxLayout" name="horizontalLayout_11">
+                         <property name="spacing">
+                          <number>0</number>
+                         </property>
+                         <property name="leftMargin">
+                          <number>0</number>
+                         </property>
+                         <property name="topMargin">
+                          <number>0</number>
+                         </property>
+                         <property name="rightMargin">
+                          <number>0</number>
+                         </property>
+                         <property name="bottomMargin">
+                          <number>0</number>
+                         </property>
+                         <item>
+                          <widget class="QLabel" name="label_5">
+                           <property name="minimumSize">
+                            <size>
+                             <width>0</width>
+                             <height>25</height>
+                            </size>
+                           </property>
+                           <property name="styleSheet">
+                            <string notr="true">color:white;</string>
+                           </property>
+                           <property name="text">
+                            <string>测试分组4</string>
+                           </property>
+                          </widget>
+                         </item>
+                         <item>
+                          <widget class="QWidget" name="slide_4" native="true">
+                           <property name="minimumSize">
+                            <size>
+                             <width>0</width>
+                             <height>25</height>
+                            </size>
+                           </property>
+                           <property name="maximumSize">
+                            <size>
+                             <width>60</width>
+                             <height>16777215</height>
+                            </size>
+                           </property>
+                           <property name="styleSheet">
+                            <string notr="true"/>
+                           </property>
+                          </widget>
+                         </item>
+                        </layout>
+                       </widget>
+                      </item>
+                      <item>
+                       <widget class="QWidget" name="widget_group4" native="true">
+                        <layout class="QVBoxLayout" name="verticalLayout_11">
+                         <item>
+                          <widget class="QFrame" name="frame_6">
+                           <property name="frameShape">
+                            <enum>QFrame::StyledPanel</enum>
+                           </property>
+                           <property name="frameShadow">
+                            <enum>QFrame::Raised</enum>
+                           </property>
+                          </widget>
+                         </item>
+                        </layout>
+                       </widget>
+                      </item>
+                     </layout>
+                    </widget>
+                   </item>
+                  </layout>
+                 </widget>
+                </item>
+               </layout>
+              </widget>
+             </item>
+             <item>
+              <widget class="QWidget" name="widget_8" native="true">
+               <property name="maximumSize">
+                <size>
+                 <width>16777215</width>
+                 <height>50</height>
+                </size>
+               </property>
+               <layout class="QHBoxLayout" name="horizontalLayout_6">
+                <item>
+                 <widget class="QLabel" name="label_4">
+                  <property name="styleSheet">
+                   <string notr="true">color:white;</string>
+                  </property>
+                  <property name="text">
+                   <string>分发策略</string>
+                  </property>
+                 </widget>
+                </item>
+                <item>
+                 <widget class="QTextEdit" name="textEdit">
+                  <property name="maximumSize">
+                   <size>
+                    <width>16777215</width>
+                    <height>20</height>
+                   </size>
+                  </property>
+                  <property name="styleSheet">
+                   <string notr="true">color:white;</string>
+                  </property>
+                 </widget>
+                </item>
+                <item>
+                 <widget class="QPushButton" name="pushButton_6">
+                  <property name="styleSheet">
+                   <string notr="true">color:white;</string>
+                  </property>
+                  <property name="text">
+                   <string>打开所在目录</string>
+                  </property>
+                 </widget>
+                </item>
+               </layout>
+              </widget>
+             </item>
+             <item>
+              <widget class="QWidget" name="widget_9" native="true">
+               <property name="maximumSize">
+                <size>
+                 <width>16777215</width>
+                 <height>40</height>
+                </size>
+               </property>
+               <layout class="QHBoxLayout" name="horizontalLayout_5">
+                <item>
+                 <spacer name="horizontalSpacer_3">
+                  <property name="orientation">
+                   <enum>Qt::Horizontal</enum>
+                  </property>
+                  <property name="sizeHint" stdset="0">
+                   <size>
+                    <width>107</width>
+                    <height>13</height>
+                   </size>
+                  </property>
+                 </spacer>
+                </item>
+                <item>
+                 <widget class="QPushButton" name="pushButton_7">
+                  <property name="styleSheet">
+                   <string notr="true">color:white;</string>
+                  </property>
+                  <property name="text">
+                   <string>测试</string>
+                  </property>
+                 </widget>
+                </item>
+                <item>
+                 <spacer name="horizontalSpacer_2">
+                  <property name="orientation">
+                   <enum>Qt::Horizontal</enum>
+                  </property>
+                  <property name="sizeHint" stdset="0">
+                   <size>
+                    <width>107</width>
+                    <height>13</height>
+                   </size>
+                  </property>
+                 </spacer>
+                </item>
+                <item>
+                 <widget class="QPushButton" name="pushButton_8">
+                  <property name="styleSheet">
+                   <string notr="true">color:white;</string>
+                  </property>
+                  <property name="text">
+                   <string>部署</string>
+                  </property>
+                 </widget>
+                </item>
+                <item>
+                 <spacer name="horizontalSpacer_4">
+                  <property name="orientation">
+                   <enum>Qt::Horizontal</enum>
+                  </property>
+                  <property name="sizeHint" stdset="0">
+                   <size>
+                    <width>107</width>
+                    <height>13</height>
+                   </size>
+                  </property>
+                 </spacer>
+                </item>
+               </layout>
+              </widget>
+             </item>
+            </layout>
+           </widget>
+          </item>
+          <item>
+           <widget class="Line" name="line">
+            <property name="styleSheet">
+             <string notr="true">Color:rgb(0, 0, 0);</string>
+            </property>
+            <property name="frameShadow">
+             <enum>QFrame::Plain</enum>
+            </property>
+            <property name="orientation">
+             <enum>Qt::Vertical</enum>
+            </property>
+           </widget>
+          </item>
+         </layout>
+        </widget>
+       </item>
+      </layout>
+     </widget>
+    </item>
+   </layout>
+  </widget>
+  <widget class="QMenuBar" name="menubar">
+   <property name="geometry">
+    <rect>
+     <x>0</x>
+     <y>0</y>
+     <width>800</width>
+     <height>24</height>
+    </rect>
+   </property>
+  </widget>
+  <widget class="QStatusBar" name="statusbar"/>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>

+ 45 - 0
test_tool1.pro

@@ -0,0 +1,45 @@
+QT       += core gui
+
+greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
+
+CONFIG += c++17
+
+# You can make your code fail to compile if it uses deprecated APIs.
+# In order to do so, uncomment the following line.
+#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000    # disables all the APIs deprecated before Qt 6.0.0
+
+SOURCES += \
+    ../sample_button_slide/custombutton.cpp \
+    ../test_drag/mylistwidget.cpp \
+    custommodel.cpp \
+    customtreeview.cpp \
+    dialog.cpp \
+    listview_ad.cpp \
+    listview_delgate.cpp \
+    main.cpp \
+    mainwindow.cpp \
+    tool.cpp
+
+HEADERS += \
+    ../sample_button_slide/CustomButton.h \
+    ../test_drag/mylistwidget.h \
+    custommodel.h \
+    customtreeview.h \
+    dialog.h \
+    listview_ad.h \
+    listview_delgate.h \
+    mainwindow.h \
+    tool.h
+
+FORMS += \
+    dialog.ui \
+    mainwindow.ui
+
+# Default rules for deployment.
+qnx: target.path = /tmp/$${TARGET}/bin
+else: unix:!android: target.path = /opt/$${TARGET}/bin
+!isEmpty(target.path): INSTALLS += target
+
+DISTFILES += \
+    geshi \
+    格式.js

+ 263 - 0
test_tool1.pro.user

@@ -0,0 +1,263 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE QtCreatorProject>
+<!-- Written by QtCreator 10.0.0, 2023-05-18T19:19:28. -->
+<qtcreator>
+ <data>
+  <variable>EnvironmentId</variable>
+  <value type="QByteArray">{5ac30553-0570-4d7c-beff-078c8863060e}</value>
+ </data>
+ <data>
+  <variable>ProjectExplorer.Project.ActiveTarget</variable>
+  <value type="qlonglong">0</value>
+ </data>
+ <data>
+  <variable>ProjectExplorer.Project.EditorSettings</variable>
+  <valuemap type="QVariantMap">
+   <value type="bool" key="EditorConfiguration.AutoIndent">true</value>
+   <value type="bool" key="EditorConfiguration.AutoSpacesForTabs">false</value>
+   <value type="bool" key="EditorConfiguration.CamelCaseNavigation">true</value>
+   <valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.0">
+    <value type="QString" key="language">Cpp</value>
+    <valuemap type="QVariantMap" key="value">
+     <value type="QByteArray" key="CurrentPreferences">CppGlobal</value>
+    </valuemap>
+   </valuemap>
+   <valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.1">
+    <value type="QString" key="language">QmlJS</value>
+    <valuemap type="QVariantMap" key="value">
+     <value type="QByteArray" key="CurrentPreferences">QmlJSGlobal</value>
+    </valuemap>
+   </valuemap>
+   <value type="qlonglong" key="EditorConfiguration.CodeStyle.Count">2</value>
+   <value type="QByteArray" key="EditorConfiguration.Codec">UTF-8</value>
+   <value type="bool" key="EditorConfiguration.ConstrainTooltips">false</value>
+   <value type="int" key="EditorConfiguration.IndentSize">4</value>
+   <value type="bool" key="EditorConfiguration.KeyboardTooltips">false</value>
+   <value type="int" key="EditorConfiguration.MarginColumn">80</value>
+   <value type="bool" key="EditorConfiguration.MouseHiding">true</value>
+   <value type="bool" key="EditorConfiguration.MouseNavigation">true</value>
+   <value type="int" key="EditorConfiguration.PaddingMode">1</value>
+   <value type="bool" key="EditorConfiguration.PreferSingleLineComments">false</value>
+   <value type="bool" key="EditorConfiguration.ScrollWheelZooming">true</value>
+   <value type="bool" key="EditorConfiguration.ShowMargin">false</value>
+   <value type="int" key="EditorConfiguration.SmartBackspaceBehavior">0</value>
+   <value type="bool" key="EditorConfiguration.SmartSelectionChanging">true</value>
+   <value type="bool" key="EditorConfiguration.SpacesForTabs">true</value>
+   <value type="int" key="EditorConfiguration.TabKeyBehavior">0</value>
+   <value type="int" key="EditorConfiguration.TabSize">8</value>
+   <value type="bool" key="EditorConfiguration.UseGlobal">true</value>
+   <value type="bool" key="EditorConfiguration.UseIndenter">false</value>
+   <value type="int" key="EditorConfiguration.Utf8BomBehavior">1</value>
+   <value type="bool" key="EditorConfiguration.addFinalNewLine">true</value>
+   <value type="bool" key="EditorConfiguration.cleanIndentation">true</value>
+   <value type="bool" key="EditorConfiguration.cleanWhitespace">true</value>
+   <value type="QString" key="EditorConfiguration.ignoreFileTypes">*.md, *.MD, Makefile</value>
+   <value type="bool" key="EditorConfiguration.inEntireDocument">false</value>
+   <value type="bool" key="EditorConfiguration.skipTrailingWhitespace">true</value>
+   <value type="bool" key="EditorConfiguration.tintMarginArea">true</value>
+  </valuemap>
+ </data>
+ <data>
+  <variable>ProjectExplorer.Project.PluginSettings</variable>
+  <valuemap type="QVariantMap">
+   <valuemap type="QVariantMap" key="AutoTest.ActiveFrameworks">
+    <value type="bool" key="AutoTest.Framework.Boost">true</value>
+    <value type="bool" key="AutoTest.Framework.CTest">false</value>
+    <value type="bool" key="AutoTest.Framework.Catch">true</value>
+    <value type="bool" key="AutoTest.Framework.GTest">true</value>
+    <value type="bool" key="AutoTest.Framework.QtQuickTest">true</value>
+    <value type="bool" key="AutoTest.Framework.QtTest">true</value>
+   </valuemap>
+   <valuemap type="QVariantMap" key="AutoTest.CheckStates"/>
+   <value type="int" key="AutoTest.RunAfterBuild">0</value>
+   <value type="bool" key="AutoTest.UseGlobal">true</value>
+   <valuemap type="QVariantMap" key="ClangTools">
+    <value type="bool" key="ClangTools.AnalyzeOpenFiles">true</value>
+    <value type="bool" key="ClangTools.BuildBeforeAnalysis">true</value>
+    <value type="QString" key="ClangTools.DiagnosticConfig">Builtin.DefaultTidyAndClazy</value>
+    <value type="int" key="ClangTools.ParallelJobs">8</value>
+    <valuelist type="QVariantList" key="ClangTools.SelectedDirs"/>
+    <valuelist type="QVariantList" key="ClangTools.SelectedFiles"/>
+    <valuelist type="QVariantList" key="ClangTools.SuppressedDiagnostics"/>
+    <value type="bool" key="ClangTools.UseGlobalSettings">true</value>
+   </valuemap>
+  </valuemap>
+ </data>
+ <data>
+  <variable>ProjectExplorer.Project.Target.0</variable>
+  <valuemap type="QVariantMap">
+   <value type="QString" key="DeviceType">Desktop</value>
+   <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Qt 6.3.1 for macOS</value>
+   <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Qt 6.3.1 for macOS</value>
+   <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">qt.qt6.631.clang_64_kit</value>
+   <value type="qlonglong" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value>
+   <value type="qlonglong" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
+   <value type="qlonglong" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>
+   <valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0">
+    <value type="int" key="EnableQmlDebugging">0</value>
+    <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/Users/lal/QT_pro/build-test_tool1-Qt_6_3_1_for_macOS-Debug</value>
+    <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory.shadowDir">/Users/lal/QT_pro/build-test_tool1-Qt_6_3_1_for_macOS-Debug</value>
+    <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
+     <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
+      <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
+      <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
+      <value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
+      <valuelist type="QVariantList" key="QtProjectManager.QMakeBuildStep.SelectedAbis"/>
+     </valuemap>
+     <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
+      <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
+      <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
+     </valuemap>
+     <value type="qlonglong" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
+     <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">构建</value>
+     <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">构建</value>
+     <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
+    </valuemap>
+    <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
+     <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
+      <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
+      <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
+      <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
+     </valuemap>
+     <value type="qlonglong" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
+     <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">清除</value>
+     <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">清除</value>
+     <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
+    </valuemap>
+    <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
+    <value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
+    <valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.CustomParsers"/>
+    <value type="bool" key="ProjectExplorer.BuildConfiguration.ParseStandardOutput">false</value>
+    <valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
+    <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Debug</value>
+    <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
+    <value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">2</value>
+   </valuemap>
+   <valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.1">
+    <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/Users/lal/QT_pro/build-test_tool1-Qt_6_3_1_for_macOS-Release</value>
+    <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory.shadowDir">/Users/lal/QT_pro/build-test_tool1-Qt_6_3_1_for_macOS-Release</value>
+    <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
+     <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
+      <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
+      <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
+      <value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
+      <valuelist type="QVariantList" key="QtProjectManager.QMakeBuildStep.SelectedAbis"/>
+     </valuemap>
+     <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
+      <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
+      <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
+     </valuemap>
+     <value type="qlonglong" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
+     <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">构建</value>
+     <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">构建</value>
+     <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
+    </valuemap>
+    <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
+     <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
+      <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
+      <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
+      <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
+     </valuemap>
+     <value type="qlonglong" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
+     <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">清除</value>
+     <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">清除</value>
+     <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
+    </valuemap>
+    <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
+    <value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
+    <valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.CustomParsers"/>
+    <value type="bool" key="ProjectExplorer.BuildConfiguration.ParseStandardOutput">false</value>
+    <valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
+    <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Release</value>
+    <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
+    <value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value>
+    <value type="int" key="QtQuickCompiler">0</value>
+   </valuemap>
+   <valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.2">
+    <value type="int" key="EnableQmlDebugging">0</value>
+    <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/Users/lal/QT_pro/build-test_tool1-Qt_6_3_1_for_macOS-Profile</value>
+    <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory.shadowDir">/Users/lal/QT_pro/build-test_tool1-Qt_6_3_1_for_macOS-Profile</value>
+    <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
+     <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
+      <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
+      <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
+      <value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">true</value>
+      <valuelist type="QVariantList" key="QtProjectManager.QMakeBuildStep.SelectedAbis"/>
+     </valuemap>
+     <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
+      <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
+      <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
+     </valuemap>
+     <value type="qlonglong" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
+     <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">构建</value>
+     <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">构建</value>
+     <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
+    </valuemap>
+    <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
+     <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
+      <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
+      <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
+      <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
+     </valuemap>
+     <value type="qlonglong" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
+     <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">清除</value>
+     <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">清除</value>
+     <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
+    </valuemap>
+    <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
+    <value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
+    <valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.CustomParsers"/>
+    <value type="bool" key="ProjectExplorer.BuildConfiguration.ParseStandardOutput">false</value>
+    <valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
+    <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Profile</value>
+    <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
+    <value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value>
+    <value type="int" key="QtQuickCompiler">0</value>
+    <value type="int" key="SeparateDebugInfo">0</value>
+   </valuemap>
+   <value type="qlonglong" key="ProjectExplorer.Target.BuildConfigurationCount">3</value>
+   <valuemap type="QVariantMap" key="ProjectExplorer.Target.DeployConfiguration.0">
+    <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
+     <value type="qlonglong" key="ProjectExplorer.BuildStepList.StepsCount">0</value>
+     <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">部署</value>
+     <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">部署</value>
+     <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Deploy</value>
+    </valuemap>
+    <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">1</value>
+    <valuemap type="QVariantMap" key="ProjectExplorer.DeployConfiguration.CustomData"/>
+    <value type="bool" key="ProjectExplorer.DeployConfiguration.CustomDataEnabled">false</value>
+    <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.DefaultDeployConfiguration</value>
+   </valuemap>
+   <value type="qlonglong" key="ProjectExplorer.Target.DeployConfigurationCount">1</value>
+   <valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0">
+    <value type="bool" key="Analyzer.Perf.Settings.UseGlobalSettings">true</value>
+    <value type="bool" key="Analyzer.QmlProfiler.Settings.UseGlobalSettings">true</value>
+    <value type="bool" key="Analyzer.Valgrind.Settings.UseGlobalSettings">true</value>
+    <valuelist type="QVariantList" key="CustomOutputParsers"/>
+    <value type="int" key="PE.EnvironmentAspect.Base">2</value>
+    <valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
+    <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:/Users/lal/QT_pro/test_tool1/test_tool1.pro</value>
+    <value type="QString" key="ProjectExplorer.RunConfiguration.BuildKey">/Users/lal/QT_pro/test_tool1/test_tool1.pro</value>
+    <value type="bool" key="RunConfiguration.UseCppDebugger">false</value>
+    <value type="bool" key="RunConfiguration.UseCppDebuggerAuto">true</value>
+    <value type="bool" key="RunConfiguration.UseLibrarySearchPath">true</value>
+    <value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
+    <value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
+    <value type="QString" key="RunConfiguration.WorkingDirectory.default">/Users/lal/QT_pro/build-test_tool1-Qt_6_3_1_for_macOS-Debug/test_tool1.app/Contents/MacOS</value>
+   </valuemap>
+   <value type="qlonglong" key="ProjectExplorer.Target.RunConfigurationCount">1</value>
+  </valuemap>
+ </data>
+ <data>
+  <variable>ProjectExplorer.Project.TargetCount</variable>
+  <value type="qlonglong">1</value>
+ </data>
+ <data>
+  <variable>ProjectExplorer.Project.Updater.FileVersion</variable>
+  <value type="int">22</value>
+ </data>
+ <data>
+  <variable>Version</variable>
+  <value type="int">22</value>
+ </data>
+</qtcreator>

+ 15 - 0
tool.cpp

@@ -144,3 +144,18 @@ QStringList tool::getFilesInFolder(const QString& folderPath)
 
     return fileList;
 }
+bool tool::writeJsonFile(const QString& fileName, const QJsonObject& jsonObject)
+{
+    QFile file(fileName);
+    if (!file.open(QIODevice::WriteOnly | QIODevice::Text))
+    {
+        // 文件打开失败处理逻辑
+        return false;
+    }
+
+    QJsonDocument jsonDoc(jsonObject);
+    file.write(jsonDoc.toJson());
+    file.close();
+
+    return true;
+}

+ 1 - 0
tool.h

@@ -17,6 +17,7 @@ public:
     static QStringList getFilesInFolder(const QString& folderPath);
     static const QString dir_path;
     tool(){}
+    static bool writeJsonFile(const QString& fileName, const QJsonObject& jsonObject);
 private:
 
 

+ 3 - 0
格式.js

@@ -0,0 +1,3 @@
+function func() {
+
+}