Преглед изворни кода

feature:修改TreeWidget,网格分类

wzj пре 11 месеци
родитељ
комит
bdc3505639

+ 1 - 1
CMakeLists.txt.user

@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE QtCreatorProject>
-<!-- Written by QtCreator 11.0.2, 2023-12-04T15:02:11. -->
+<!-- Written by QtCreator 11.0.2, 2023-12-04T19:48:09. -->
 <qtcreator>
  <data>
   <variable>EnvironmentId</variable>

+ 2 - 0
src/DataProperty/modelTreeItemType.h

@@ -91,6 +91,8 @@ enum TreeItemType
 	IRcomputationparaenv,		///< IR环境参数节点
 	IRcalc,						///< IR计算节点
 
+	modelTemp,
+
 };
 
 extern TreeItemType DATAPROPERTYAPI getTreeItemTypeByString(const QString &type);

+ 15 - 13
src/MainWidgets/TreeWidget.cpp

@@ -90,7 +90,7 @@ namespace MainWidget
 		connect(this, SIGNAL(disPlayProp(DataProperty::DataBase *)), _mainWindow, SIGNAL(updateProperty(DataProperty::DataBase *)));
 		connect(this, SIGNAL(dispalyParaWidget(QWidget *)), _mainWindow, SIGNAL(updateParaWidget(QWidget *)));
 //		connect(this, SIGNAL(startMesherPySig(QString)), this, SLOT(startMesher(QString)));
-
+		connect(this, SIGNAL(importModel()), _mainWindow, SLOT(on_importGeometry()));
 
 	}
 
@@ -110,8 +110,6 @@ namespace MainWidget
 		_modelRoot->setText(0,"几何模型");
 		_modelRoot->setExpanded(true);
 		// _modelRoot->setIcon(0, QIcon(":/QUI/icon/geometry.png"));
-		//设置根节点背景色
-		// _modelRoot->setBackground(0, QBrush(QColor(238, 238, 238)));
 		this->addTopLevelItem(_modelRoot);
 
 
@@ -124,11 +122,14 @@ namespace MainWidget
 		this->addTopLevelItem(_gridRoot);
 		_gridRoot->setExpanded(true);
 			_meshRoot = new QTreeWidgetItem(_gridRoot, TreeItemType::MeshRoot);
-			_meshRoot->setText(0, tr("网格"));
+			_meshRoot->setText(0, tr("流体网格"));
 			_meshRoot->setIcon(0, QIcon(":/QUI/icon/mesh.png"));
 			// _setRoot = new QTreeWidgetItem(_gridRoot, TreeItemType::MeshSetRoot);
 			// _setRoot->setText(0, tr("分组"));
 			// _setRoot->setIcon(0, QIcon(":/QUI/icon/mesh.png"));
+			_IRmeshRoot = new QTreeWidgetItem(_gridRoot, TreeItemType::MeshRoot);
+			_IRmeshRoot->setText(0, tr("红外网格"));
+			_IRmeshRoot->setIcon(0, QIcon(":/QUI/icon/mesh.png"));
 
 		//CFD计算
 		_cfdItem = new QTreeWidgetItem(this);
@@ -249,13 +250,6 @@ namespace MainWidget
 		// _modelRoot->setText(0, tr("几何模型"));
 		// _modelRoot->setExpanded(true);
 
-//		QFileInfo fileInfo(Setting::BusAPI::instance()->getGeoFile());
-//		QString fileNameFull = fileInfo.fileName();
-//		int index = fileNameFull.lastIndexOf('.');
-//		QString fileName = fileNameFull.left(index);
-//		QTreeWidgetItem* fileItem = new QTreeWidgetItem(_modelRoot,TreeItemType::GeoComponentRoot);
-//		fileItem->setText(0,fileName);
-
 		_geoData->sort();
 		blockSignals(true);
 		const int n = _geoData->getGeometrySetCount();
@@ -288,7 +282,11 @@ namespace MainWidget
 					// qDebug() << "component id:" << id;
 				}
 			}
-			
+		}
+		if(_modelRoot->childCount() == 0)
+		{
+			_modelTempItem = new QTreeWidgetItem(_modelRoot, TreeItemType::modelTemp);
+			_modelTempItem->setText(0, tr("单击添加模型"));
 		}
 		blockSignals(false);
 
@@ -319,7 +317,7 @@ namespace MainWidget
 	{
 		_meshRoot->takeChildren();
 
-		_meshRoot->setText(0, "网格");
+		// _meshRoot->setText(0, "网格");
 		const int n = _MeshData->getKernalCount();
 		blockSignals(true);
 		for (int i = 0; i < n; ++i)
@@ -461,6 +459,10 @@ namespace MainWidget
 				IR::IRComponentDialog dlg ;
 				dlg.exec();
 			}
+			case modelTemp:
+			{
+				emit importModel();
+			}
 			// case IRcalc:
 			// {
 			// 	IR::IRCalcDialog dlg ;

+ 3 - 1
src/MainWidgets/TreeWidget.h

@@ -93,7 +93,7 @@ namespace MainWidget
 		void renameCaseComponentSig(int componentID);
 
 		void clickEmpty();
-
+		void importModel();
 	public slots :
 		//更新树
 		void updateTree();
@@ -168,6 +168,7 @@ namespace MainWidget
 		//几何
 		QTreeWidgetItem* _geoRoot{};//几何根节点
 		QTreeWidgetItem* _modelRoot{};//模型节点
+		QTreeWidgetItem* _modelTempItem{};
 		QTreeWidgetItem* _gcroot{};
 		Geometry::GeometryData* _geoData{};
 
@@ -175,6 +176,7 @@ namespace MainWidget
 		MeshData::MeshData* _MeshData{};
 		QTreeWidgetItem* _gridRoot{};//网格根节点
 		QTreeWidgetItem* _meshRoot{};
+		QTreeWidgetItem* _IRmeshRoot{};
 		QTreeWidgetItem* _setRoot{};
 		QTreeWidgetItem* _currentItem{};
 

+ 4 - 3
src/MainWindow/MainWindow.cpp

@@ -487,9 +487,10 @@ namespace GUI {
 		if(filePath.isEmpty())
 			return;
 			
-		QString pycode = QString("MainWindow.openProjectFile(\"%1\")").arg(filePath);
-		qDebug() << pycode;
-		Py::PythonAgent::getInstance()->submit(pycode);
+		emit _signalHandler->openProjectFileSig(filePath);
+		// QString pycode = QString("MainWindow.openProjectFile(\"%1\")").arg(filePath);
+		// qDebug() << pycode;
+		// Py::PythonAgent::getInstance()->submit(pycode);
 	}
 
 	void MainWindow::on_actionSave()

+ 0 - 7
src/Settings/DialogWorkingDir.cpp

@@ -29,7 +29,6 @@ namespace Setting
 
 		connect(_ui->openBnt,&QPushButton::clicked,this,&WorkingDirDialog::onOpenBntClicked);
 		connect(_ui->createBnt,&QPushButton::clicked,this,&WorkingDirDialog::onCreateBntClicked);
-		// connect(this,SIGNAL(currentFile(QString)),_main,SLOT(openRencentFile(QString)));
 		_ui->recentList->setStyleSheet(
 									   "QListWidget{border:none; color:black; }"
 									   "QListWidget::Item{border:none;}"
@@ -69,8 +68,6 @@ namespace Setting
 #endif
 		QString		title = tr("创建项目");
 		QString		dir	  = Setting::BusAPI::instance()->getWorkingDir();
-		//		QString filePath = QFileDialog::getSaveFileName(this, title, dir, fillter);
-
 		QFileDialog dlg(this, title, dir, fillter);
 		dlg.setAcceptMode(QFileDialog::AcceptSave);
 		if(QDialog::Accepted != dlg.exec())
@@ -135,12 +132,10 @@ namespace Setting
 		if(!_ui->recentList->selectedItems().isEmpty())
 		{
 			QString file = _ui->recentList->currentItem()->text();
-			// emit currentFile(file);
 			QString pycode = QString("MainWindow.openProjectFile(\"%1\")").arg(file);
 			qDebug() << pycode;
 			Py::PythonAgent::getInstance()->submit(pycode);
 
-//			_main->setCurrentFile(file);
 			showMain();
 			QDialog::accept();
 		}
@@ -163,13 +158,11 @@ namespace Setting
 
 	void WorkingDirDialog::reject()
 	{
-		//		emit closeMainWindow();
 		QDialog::reject();
 	}
 
 	void WorkingDirDialog::closeEvent(QCloseEvent *e)
 	{
-		//		_main->close();
 		QDialog::closeEvent(e);
 
 	}

+ 106 - 4
src/Settings/DialogWorkingDir.ui

@@ -13,8 +13,56 @@
   <property name="windowTitle">
    <string>Working Dir</string>
   </property>
-  <layout class="QGridLayout" name="gridLayout">
-   <item row="0" column="0">
+  <layout class="QVBoxLayout" name="verticalLayout_2">
+   <property name="spacing">
+    <number>3</number>
+   </property>
+   <property name="leftMargin">
+    <number>2</number>
+   </property>
+   <property name="topMargin">
+    <number>2</number>
+   </property>
+   <property name="rightMargin">
+    <number>2</number>
+   </property>
+   <property name="bottomMargin">
+    <number>2</number>
+   </property>
+   <item>
+    <layout class="QHBoxLayout" name="horizontalLayout_3" stretch="1,8">
+     <item>
+      <widget class="QLabel" name="label_2">
+       <property name="text">
+        <string/>
+       </property>
+       <property name="pixmap">
+        <pixmap resource="../qrc/qianfan.qrc">:/QUI/main.ico</pixmap>
+       </property>
+       <property name="scaledContents">
+        <bool>true</bool>
+       </property>
+      </widget>
+     </item>
+     <item>
+      <widget class="QLabel" name="label_3">
+       <property name="font">
+        <font>
+         <pointsize>19</pointsize>
+         <bold>true</bold>
+        </font>
+       </property>
+       <property name="text">
+        <string>自主可控GJDM平台-NUAA</string>
+       </property>
+       <property name="alignment">
+        <set>Qt::AlignCenter</set>
+       </property>
+      </widget>
+     </item>
+    </layout>
+   </item>
+   <item>
     <layout class="QHBoxLayout" name="horizontalLayout">
      <item>
       <widget class="QLabel" name="label">
@@ -39,7 +87,7 @@
      </item>
     </layout>
    </item>
-   <item row="1" column="0">
+   <item>
     <layout class="QHBoxLayout" name="horizontalLayout_2">
      <item>
       <widget class="QWidget" name="widget" native="true">
@@ -51,6 +99,22 @@
           </property>
          </widget>
         </item>
+        <item>
+         <spacer name="verticalSpacer_2">
+          <property name="orientation">
+           <enum>Qt::Vertical</enum>
+          </property>
+          <property name="sizeType">
+           <enum>QSizePolicy::Fixed</enum>
+          </property>
+          <property name="sizeHint" stdset="0">
+           <size>
+            <width>20</width>
+            <height>20</height>
+           </size>
+          </property>
+         </spacer>
+        </item>
         <item>
          <widget class="QPushButton" name="openBnt">
           <property name="text">
@@ -58,6 +122,42 @@
           </property>
          </widget>
         </item>
+        <item>
+         <spacer name="verticalSpacer_3">
+          <property name="orientation">
+           <enum>Qt::Vertical</enum>
+          </property>
+          <property name="sizeType">
+           <enum>QSizePolicy::Fixed</enum>
+          </property>
+          <property name="sizeHint" stdset="0">
+           <size>
+            <width>20</width>
+            <height>20</height>
+           </size>
+          </property>
+         </spacer>
+        </item>
+        <item>
+         <widget class="QPushButton" name="pushButton_2">
+          <property name="text">
+           <string>License</string>
+          </property>
+         </widget>
+        </item>
+        <item>
+         <spacer name="verticalSpacer">
+          <property name="orientation">
+           <enum>Qt::Vertical</enum>
+          </property>
+          <property name="sizeHint" stdset="0">
+           <size>
+            <width>20</width>
+            <height>40</height>
+           </size>
+          </property>
+         </spacer>
+        </item>
        </layout>
       </widget>
      </item>
@@ -66,7 +166,7 @@
      </item>
     </layout>
    </item>
-   <item row="2" column="0">
+   <item>
     <widget class="QDialogButtonBox" name="buttonBox">
      <property name="orientation">
       <enum>Qt::Horizontal</enum>
@@ -92,6 +192,8 @@
   <include location="../qrc/qianfan.qrc"/>
   <include location="../qrc/qianfan.qrc"/>
   <include location="../qrc/qianfan.qrc"/>
+  <include location="../qrc/qianfan.qrc"/>
+  <include location="../qrc/qianfan.qrc"/>
  </resources>
  <connections>
   <connection>