更新数据绑定程序

This commit is contained in:
15712809671 2025-05-25 11:32:25 +08:00
parent a4969a8aba
commit 183d51b538
17 changed files with 787 additions and 495 deletions

View File

@ -13,7 +13,7 @@ int main(int argc, char* argv[]) {
Application app(argc, argv); Application app(argc, argv);
app.setAttribute(Qt::AA_DontCreateNativeWidgetSiblings); app.setAttribute(Qt::AA_DontCreateNativeWidgetSiblings);
InstallCrashHandler(); //InstallCrashHandler();
RecourceHelper::ChangeSkin("default"); RecourceHelper::ChangeSkin("default");

View File

@ -27,6 +27,8 @@ void OESceneUI::InitUI(OsgViewUI* ui) {
return; return;
} }
return;
compositeWidgetManager_ = new CompositeWidgetManager(); compositeWidgetManager_ = new CompositeWidgetManager();
compositeWidgetManager_->AttachViewUI(ui); compositeWidgetManager_->AttachViewUI(ui);
zoomManager_ = new ZoomManager(); zoomManager_ = new ZoomManager();
@ -43,6 +45,9 @@ void OESceneUI::InitUI(OsgViewUI* ui) {
} }
void OESceneUI::OnResize(double width, double height) { void OESceneUI::OnResize(double width, double height) {
return;
dyt_check(compositeWidgetManager_); dyt_check(compositeWidgetManager_);
dyt_check(zoomManager_); dyt_check(zoomManager_);

View File

@ -96,38 +96,30 @@
</message> </message>
<message> <message>
<location filename="../ui/Menu/ChartPlotMenu.ui" line="28"/> <location filename="../ui/Menu/ChartPlotMenu.ui" line="28"/>
<source>Wave文件</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/Menu/ChartPlotMenu.ui" line="41"/>
<source>Report文件</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/Menu/ChartPlotMenu.ui" line="54"/>
<source>RD文件</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/Menu/ChartPlotMenu.ui" line="67"/>
<source>Matlab文件</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/Menu/ChartPlotMenu.ui" line="80"/>
<source>Run Simu</source> <source>Run Simu</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
</context> </context>
<context>
<name>CodeEdtUI</name>
<message>
<location filename="../ui/Layout/CodeEdtUI.cpp" line="74"/>
<source>matlab editor</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/Layout/CodeEdtUI.cpp" line="82"/>
<source>&amp;bat</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/Layout/CodeEdtUI.cpp" line="102"/>
<source>&amp;Control</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/Layout/CodeEdtUI.cpp" line="104"/>
<source>&amp;Run</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/Layout/CodeEdtUI.cpp" line="107"/>
<source>&amp;Save</source>
<translation type="unfinished"></translation>
</message>
</context>
<context> <context>
<name>CodeEdtUIClass</name> <name>CodeEdtUIClass</name>
<message> <message>
@ -612,7 +604,7 @@
</message> </message>
<message> <message>
<location filename="../ui/MainWindow.cpp" line="175"/> <location filename="../ui/MainWindow.cpp" line="175"/>
<source>Matlab File</source> <source>bat File</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
@ -923,43 +915,43 @@
<context> <context>
<name>QtConeWaveComponentManager</name> <name>QtConeWaveComponentManager</name>
<message> <message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8848"/> <location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8731"/>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8857"/> <location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8740"/>
<source>ConeWaveComponent</source> <source>ConeWaveComponent</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8944"/> <location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8827"/>
<source>Height</source> <source>Height</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8951"/> <location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8834"/>
<source>Radius</source> <source>Radius</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8958"/> <location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8841"/>
<source>levelCount</source> <source>levelCount</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8965"/> <location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8848"/>
<source>levelHeight</source> <source>levelHeight</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8972"/> <location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8855"/>
<source>Color1</source> <source>Color1</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8979"/> <location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8862"/>
<source>Color2</source> <source>Color2</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8986"/> <location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8869"/>
<source>Color3</source> <source>Color3</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
@ -1065,28 +1057,28 @@
<context> <context>
<name>QtDashedLineComponentManager</name> <name>QtDashedLineComponentManager</name>
<message> <message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="9171"/> <location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="9054"/>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="9180"/> <location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="9063"/>
<source>DashedLineComponent</source> <source>DashedLineComponent</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="9249"/> <location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="9132"/>
<source>Start</source> <source>Start</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="9256"/> <location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="9139"/>
<source>End</source> <source>End</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="9263"/> <location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="9146"/>
<source>Radius</source> <source>Radius</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="9270"/> <location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="9153"/>
<source>Color</source> <source>Color</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
@ -1102,12 +1094,12 @@
<context> <context>
<name>QtEntityPropertyManager</name> <name>QtEntityPropertyManager</name>
<message> <message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8328"/> <location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8211"/>
<source>Name</source> <source>Name</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8335"/> <location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8218"/>
<source>Transform</source> <source>Transform</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
@ -1189,13 +1181,13 @@
<context> <context>
<name>QtMeshComponetManager</name> <name>QtMeshComponetManager</name>
<message> <message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8442"/> <location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8325"/>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8451"/> <location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8334"/>
<source>MeshComponent</source> <source>MeshComponent</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8524"/> <location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8407"/>
<source>Mesh</source> <source>Mesh</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
@ -1226,16 +1218,10 @@
<context> <context>
<name>QtOsgViewWidget</name> <name>QtOsgViewWidget</name>
<message> <message>
<location filename="../viewer/QtOsgViewWidget.cpp" line="131"/>
<location filename="../viewer/QtOsgViewWidget.cpp" line="139"/> <location filename="../viewer/QtOsgViewWidget.cpp" line="139"/>
<source>warning</source> <source>warning</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<location filename="../viewer/QtOsgViewWidget.cpp" line="131"/>
<source>default workspace failed</source>
<translation type="unfinished"></translation>
</message>
<message> <message>
<location filename="../viewer/QtOsgViewWidget.cpp" line="139"/> <location filename="../viewer/QtOsgViewWidget.cpp" line="139"/>
<source>open dyt file failed</source> <source>open dyt file failed</source>
@ -1245,13 +1231,13 @@
<context> <context>
<name>QtPathComponentManager</name> <name>QtPathComponentManager</name>
<message> <message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8601"/> <location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8484"/>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8610"/> <location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8493"/>
<source>PathComponent</source> <source>PathComponent</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8683"/> <location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8566"/>
<source>Path</source> <source>Path</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
@ -1501,45 +1487,20 @@
<context> <context>
<name>QtWorkspacePropertyManager</name> <name>QtWorkspacePropertyManager</name>
<message> <message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8059"/> <location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8012"/>
<source>Name</source> <source>Name</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8066"/> <location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8019"/>
<source>Description</source> <source>Description</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8073"/> <location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8026"/>
<source>Timestep</source> <source>Timestep</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8080"/>
<source>SimMatlab</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8087"/>
<source>MatlabParam</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8094"/>
<source>Wave</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8101"/>
<source>RD</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8108"/>
<source>Report</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>SignalIndicatorLampUI</name> <name>SignalIndicatorLampUI</name>

View File

@ -5,6 +5,16 @@
#include <QLabel> #include <QLabel>
#include <QTimer> #include <QTimer>
#include <QApplication>
#include <QMainWindow>
#include <QMouseEvent>
#include <QDrag>
#include <QMimeData>
#include <QJsonObject>
#include <QTextStream>
#include <QFile>
#include <QJsonDocument>
class DockWidgetTitleBar : public QWidget { class DockWidgetTitleBar : public QWidget {
Q_OBJECT Q_OBJECT
@ -43,9 +53,128 @@ protected:
void resizeEvent(QResizeEvent* e) override; void resizeEvent(QResizeEvent* e) override;
void paintEvent(QPaintEvent* e) override; void paintEvent(QPaintEvent* e) override;
void mousePressEvent(QMouseEvent* event) override {
if (event->button() == Qt::LeftButton)
m_dragStartPosition = event->pos();
QDockWidget::mousePressEvent(event);
}
void mouseMoveEvent(QMouseEvent* event) override {
if (!(event->buttons() & Qt::LeftButton))
return;
if ((event->pos() - m_dragStartPosition).manhattanLength() < QApplication::startDragDistance())
return;
QDrag* drag = new QDrag(this);
QMimeData* mimeData = new QMimeData;
mimeData->setData("application/x-dockwidget", QByteArray());
drag->setMimeData(mimeData);
drag->exec(Qt::MoveAction);
}
private: private:
void OnClose(); void OnClose();
private: private:
DockWidgetTitleBar* titleBar_{ nullptr }; DockWidgetTitleBar* titleBar_{ nullptr };
};
QPoint m_dragStartPosition;
};
class CustomMainWindow : public QMainWindow {
Q_OBJECT
public:
CustomMainWindow(QWidget* parent = nullptr) : QMainWindow(parent) {
setAcceptDrops(true);
}
void saveStateToFile(const QString& filename) {
QByteArray state = saveState(); // 获取窗口状态
QByteArray base64 = state.toBase64(); // 转换为 Base64 字符串
QFile file(filename);
if (file.open(QIODevice::WriteOnly | QIODevice::Text)) {
QTextStream out(&file);
out << base64; // 写入文本文件
file.close();
}
}
void saveDocksToJson(const QString& filename) {
QJsonObject mainData;
// 保存每个 DockWidget 的属性
for (QDockWidget* dock : findChildren<QDockWidget*>()) {
QJsonObject dockData;
dockData["visible"] = dock->isVisible();
dockData["floating"] = dock->isFloating();
dockData["geometry"] = QString("%1,%2,%3,%4")
.arg(dock->geometry().x())
.arg(dock->geometry().y())
.arg(dock->geometry().width())
.arg(dock->geometry().height());
dockData["area"] = dockWidgetArea(dock); // 停靠区域
mainData[dock->objectName()] = dockData;
}
// 写入文件
QFile file(filename);
if (file.open(QIODevice::WriteOnly)) {
QJsonDocument doc(mainData);
file.write(doc.toJson());
file.close();
}
}
void restoreDocksFromJson(const QString& filename) {
QFile file(filename);
if (!file.open(QIODevice::ReadOnly)) return;
QJsonDocument doc = QJsonDocument::fromJson(file.readAll());
QJsonObject mainData = doc.object();
foreach(const QString & key, mainData.keys()) {
QDockWidget* dock = findChild<QDockWidget*>(key);
if (!dock) continue;
QJsonObject dockData = mainData[key].toObject();
dock->setVisible(dockData["visible"].toBool());
dock->setFloating(dockData["floating"].toBool());
// 解析几何位置
QStringList geom = dockData["geometry"].toString().split(",");
if (geom.size() == 4) {
dock->setGeometry(geom[0].toInt(), geom[1].toInt(),
geom[2].toInt(), geom[3].toInt());
}
// 恢复停靠区域
Qt::DockWidgetArea area = static_cast<Qt::DockWidgetArea>(
dockData["area"].toInt());
addDockWidget(area, dock);
}
}
protected:
void dragEnterEvent(QDragEnterEvent* event) override {
if (event->mimeData()->hasFormat("application/x-dockwidget"))
event->acceptProposedAction();
}
void dropEvent(QDropEvent* event) override {
DockWidget* dock = qobject_cast<DockWidget*>(event->source());
if (dock && dock->parent() != this) {
// 从原窗口移除
QMainWindow* oldParent = qobject_cast<QMainWindow*>(dock->parent());
if (oldParent) oldParent->removeDockWidget(dock);
// 添加到当前窗口
dock->setParent(this);
addDockWidget(Qt::RightDockWidgetArea, dock);
dock->show();
event->acceptProposedAction();
}
}
};

View File

@ -71,7 +71,7 @@ void CodeEdtUI::AttachDock(DockWidget* dockWidget)
DockTitleBar* dockTitleBar = new DockTitleBar; DockTitleBar* dockTitleBar = new DockTitleBar;
dockTitleBar->SetTitle(tr("matlab editor")); dockTitleBar->SetTitle(u8"bat文件");
dockWidget->SetDockWidgetTitleBar(dockTitleBar); dockWidget->SetDockWidgetTitleBar(dockTitleBar);
} }
@ -79,7 +79,7 @@ void CodeEdtUI::AttachDock(DockWidget* dockWidget)
void CodeEdtUI::InitBat() void CodeEdtUI::InitBat()
{ {
{ {
QMenu* fileMenu = menuBar()->addMenu(tr("&bat")); QMenu* fileMenu = menuBar()->addMenu(u8"文件");
QDir dir(RecourceHelper::Get().GetBasePath() + "/bat"); QDir dir(RecourceHelper::Get().GetBasePath() + "/bat");
QFileInfoList fileInfoList = dir.entryInfoList(QDir::Files | QDir::NoDotAndDotDot | QDir::NoSymLinks); QFileInfoList fileInfoList = dir.entryInfoList(QDir::Files | QDir::NoDotAndDotDot | QDir::NoSymLinks);
@ -99,12 +99,12 @@ void CodeEdtUI::InitBat()
} }
{ {
QMenu* ctrlMenu = menuBar()->addMenu(tr("&Control")); QMenu* ctrlMenu = menuBar()->addMenu(u8"控制");
QAction* runAction = new QAction(tr("&Run"), this); QAction* runAction = new QAction(tr(u8"执行"), this);
ctrlMenu->addAction(runAction); ctrlMenu->addAction(runAction);
QAction* saveAction = new QAction(tr("&Save"), this); QAction* saveAction = new QAction(u8"保存", this);
ctrlMenu->addAction(saveAction); ctrlMenu->addAction(saveAction);
connect(runAction, &QAction::triggered, this, &CodeEdtUI::runFile); connect(runAction, &QAction::triggered, this, &CodeEdtUI::runFile);

View File

@ -36,338 +36,364 @@
#include "ui_MainWindow.h" #include "ui_MainWindow.h"
MainWindow::MainWindow(QWidget* parent) MainWindow::MainWindow(QWidget* parent)
: QMainWindow(parent) : QMainWindow(parent)
, ui(new Ui::MainWindow) { , ui(new Ui::MainWindow) {
ui->setupUi(this); ui->setupUi(this);
InitUI(); InitUI();
} }
MainWindow::~MainWindow() { MainWindow::~MainWindow() {
OsgViewer::Get().Uninitialize(); OsgViewer::Get().Uninitialize();
delete ui; delete ui;
} }
void MainWindow::InitUI() { void MainWindow::InitUI() {
tabWidget_ = new QTabWidget; tabWidget_ = new QTabWidget;
tabWidget_->setTabPosition(QTabWidget::South); tabWidget_->setTabPosition(QTabWidget::South);
tabWidget_->tabBar()->setMinimumWidth(300); tabWidget_->tabBar()->setMinimumWidth(300);
ui->viewWidget->layout()->addWidget(tabWidget_); ui->viewWidget->layout()->addWidget(tabWidget_);
pSettingUI = new LayoutSettingUI(); pSettingUI = new LayoutSettingUI();
const QString uiLaytouPath = RecourceHelper::Get().GetBasePath() + "/workspace/UILayout.xml"; const QString uiLaytouPath = RecourceHelper::Get().GetBasePath() + "/workspace/UILayout.xml";
pSettingUI->InitConfig(uiLaytouPath); pSettingUI->InitConfig(uiLaytouPath);
//pSettingUI->show(); //pSettingUI->show();
connect(pSettingUI, &LayoutSettingUI::signalUpdate, this, &MainWindow::InitDockLayout); connect(pSettingUI, &LayoutSettingUI::signalUpdate, this, &MainWindow::InitDockLayout);
setCorner(Qt::BottomLeftCorner, Qt::LeftDockWidgetArea); setCorner(Qt::BottomLeftCorner, Qt::LeftDockWidgetArea);
setCorner(Qt::BottomRightCorner, Qt::RightDockWidgetArea); setCorner(Qt::BottomRightCorner, Qt::RightDockWidgetArea);
DockWidget* model = new DockWidget(tr("model elements"), 0); DockWidget* model = new DockWidget(tr("model elements"), 0);
// addDockWidget(pSettingUI->GetArea("ModelBrowser"), model); // addDockWidget(pSettingUI->GetArea("ModelBrowser"), model);
modelBrowser_ = new ModelBrowser(0); modelBrowser_ = new ModelBrowser(0);
modelBrowser_->AttachDock(model); modelBrowser_->AttachDock(model);
m_mapDockWidget.insert("ModelBrowser", model); m_mapDockWidget.insert("ModelBrowser", model);
DockWidget* attribte = new DockWidget(tr("attribte"), 0); DockWidget* attribte = new DockWidget(tr("attribte"), 0);
//addDockWidget(pSettingUI->GetArea("PropertyBrowser"), attribte); //addDockWidget(pSettingUI->GetArea("PropertyBrowser"), attribte);
propertyBrowser_ = new PropertyBrowser(0); propertyBrowser_ = new PropertyBrowser(0);
propertyBrowser_->AttachDock(attribte); propertyBrowser_->AttachDock(attribte);
m_mapDockWidget.insert("PropertyBrowser", attribte); m_mapDockWidget.insert("PropertyBrowser", attribte);
connect(modelBrowser_, &ModelBrowser::WorkSpaceChange, propertyBrowser_, &PropertyBrowser::OnWorkSpaceChange); connect(modelBrowser_, &ModelBrowser::WorkSpaceChange, propertyBrowser_, &PropertyBrowser::OnWorkSpaceChange);
connect(modelBrowser_, &ModelBrowser::EntityChange, propertyBrowser_, &PropertyBrowser::OnEntityChange); connect(modelBrowser_, &ModelBrowser::EntityChange, propertyBrowser_, &PropertyBrowser::OnEntityChange);
qtOsgViewWidget_ = new QtOsgViewWidget; qtOsgViewWidget_ = new QtOsgViewWidget;
qtOsgViewWidget_->Initialize(); qtOsgViewWidget_->Initialize();
m_mapDockWidget.insert("PropertyBrowser", attribte); m_mapDockWidget.insert("PropertyBrowser", attribte);
QString wavePath ="", speedPath = "", rdPath = "", matlabParam=""; QString wavePath = "", speedPath = "", rdPath = "", matlabParam = "";
if (WorkSpaceManager::Get().GetCurrent()) if (WorkSpaceManager::Get().GetCurrent())
{ {
if (!WorkSpaceManager::Get().GetCurrent()->GetWavePath().isEmpty()) if (!WorkSpaceManager::Get().GetCurrent()->GetWavePath().isEmpty())
{ {
wavePath = RecourceHelper::Get().GetBasePath() + "/" + WorkSpaceManager::Get().GetCurrent()->GetWavePath(); wavePath = RecourceHelper::Get().GetBasePath() + "/" + WorkSpaceManager::Get().GetCurrent()->GetWavePath();
} }
if (!WorkSpaceManager::Get().GetCurrent()->GetReportPath().isEmpty()) if (!WorkSpaceManager::Get().GetCurrent()->GetReportPath().isEmpty())
{ {
speedPath = RecourceHelper::Get().GetBasePath() + "/" + WorkSpaceManager::Get().GetCurrent()->GetReportPath(); speedPath = RecourceHelper::Get().GetBasePath() + "/" + WorkSpaceManager::Get().GetCurrent()->GetReportPath();
} }
if (!WorkSpaceManager::Get().GetCurrent()->GetRDPath().isEmpty()) if (!WorkSpaceManager::Get().GetCurrent()->GetRDPath().isEmpty())
{ {
rdPath = RecourceHelper::Get().GetBasePath() + "/" + WorkSpaceManager::Get().GetCurrent()->GetRDPath(); rdPath = RecourceHelper::Get().GetBasePath() + "/" + WorkSpaceManager::Get().GetCurrent()->GetRDPath();
} }
if (!WorkSpaceManager::Get().GetCurrent()->GetMatlabParam().isEmpty()) if (!WorkSpaceManager::Get().GetCurrent()->GetMatlabParam().isEmpty())
{ {
matlabParam = RecourceHelper::Get().GetBasePath() + "/" + WorkSpaceManager::Get().GetCurrent()->GetMatlabParam(); matlabParam = RecourceHelper::Get().GetBasePath() + "/" + WorkSpaceManager::Get().GetCurrent()->GetMatlabParam();
} }
} }
DockWidget* fitCurveDock = new DockWidget(tr("Wave Curve"), 0); DockWidget* fitCurveDock = new DockWidget(tr("Wave Curve"), 0);
fitCurveDlg_ = new FitCurveDialog(1); fitCurveDlg_ = new FitCurveDialog(1);
fitCurveDlg_->AttachDock(fitCurveDock); fitCurveDlg_->AttachDock(fitCurveDock);
m_mapDockWidget.insert("WaveCurveDialog", fitCurveDock); m_mapDockWidget.insert("WaveCurveDialog", fitCurveDock);
fitCurveDlg_->InitWaveFile(wavePath); fitCurveDlg_->InitWaveFile(wavePath);
DockWidget* fitLgCurveDock = new DockWidget(tr("Speed Curve"), 0); DockWidget* fitLgCurveDock = new DockWidget(tr("Speed Curve"), 0);
fitYLgCurveDlg_ = new FitCurveDialog(1); fitYLgCurveDlg_ = new FitCurveDialog(1);
fitYLgCurveDlg_->AttachDock(fitLgCurveDock); fitYLgCurveDlg_->AttachDock(fitLgCurveDock);
m_mapDockWidget.insert("SpeedCurveDialog", fitLgCurveDock); m_mapDockWidget.insert("SpeedCurveDialog", fitLgCurveDock);
fitYLgCurveDlg_->InitReportFile(speedPath); fitYLgCurveDlg_->InitReportFile(speedPath);
DockWidget* surfaceCurveDock = new DockWidget(tr("3D Curve"), 0); DockWidget* surfaceCurveDock = new DockWidget(tr("3D Curve"), 0);
surfaceDlg_ = new SurfaceDialog();
surfaceDlg_->AttachDock(surfaceCurveDock);
m_mapDockWidget.insert("3DCurveDialog", surfaceCurveDock);
surfaceDlg_->InitRD(rdPath); surfaceDlg_ = new SurfaceDialog();
surfaceDlg_->AttachDock(surfaceCurveDock);
m_mapDockWidget.insert("3DCurveDialog", surfaceCurveDock);
{ surfaceDlg_->InitRD(rdPath);
targetUITable_ = new TargetListWgt;
QStringList headerLabels; {
headerLabels << tr("Target number") << tr("Signal-to-noise ratio") //QString::fromLocal8Bit("目标编号") << QString::fromLocal8Bit("信噪比") targetUITable_ = new TargetListWgt;
<< tr("Azimuth line of sight") << tr("Pitch gaze angle") // QString::fromLocal8Bit("方位视线角") << QString::fromLocal8Bit("俯仰视线角")
<< tr("azimuth") << tr("Pitch angle") // QString::fromLocal8Bit("方位角") << QString::fromLocal8Bit("俯仰角")
<< tr("attribute") << tr("Doppler") // QString::fromLocal8Bit("属性") << QString::fromLocal8Bit("多普勒")
<< tr("course") << tr("Speed") // QString::fromLocal8Bit("航向") << QString::fromLocal8Bit("航速")
<< tr("longitude") << tr("latitude") // QString::fromLocal8Bit("经度") << QString::fromLocal8Bit("纬度")
<< tr("distance") << tr("velocity") // QString::fromLocal8Bit("距离") << QString::fromLocal8Bit("速度")
<< tr("Radial dimensions") << tr("Target RCS"); // QString::fromLocal8Bit("径向尺寸") << QString::fromLocal8Bit("目标RCS");
targetUITable_->SetHeader(headerLabels); QStringList headerLabels;
//const QString reportPath = RecourceHelper::Get().GetBasePath() + "/workspace/Report.txt"; headerLabels << tr("Target number") << tr("Signal-to-noise ratio") //QString::fromLocal8Bit("目标编号") << QString::fromLocal8Bit("信噪比")
targetUITable_->InitFile(speedPath, 50); << tr("Azimuth line of sight") << tr("Pitch gaze angle") // QString::fromLocal8Bit("方位视线角") << QString::fromLocal8Bit("俯仰视线角")
<< tr("azimuth") << tr("Pitch angle") // QString::fromLocal8Bit("方位角") << QString::fromLocal8Bit("俯仰角")
<< tr("attribute") << tr("Doppler") // QString::fromLocal8Bit("属性") << QString::fromLocal8Bit("多普勒")
<< tr("course") << tr("Speed") // QString::fromLocal8Bit("航向") << QString::fromLocal8Bit("航速")
<< tr("longitude") << tr("latitude") // QString::fromLocal8Bit("经度") << QString::fromLocal8Bit("纬度")
<< tr("distance") << tr("velocity") // QString::fromLocal8Bit("距离") << QString::fromLocal8Bit("速度")
<< tr("Radial dimensions") << tr("Target RCS"); // QString::fromLocal8Bit("径向尺寸") << QString::fromLocal8Bit("目标RCS");
DockWidget* dataTableDock = new DockWidget(tr("Report Table"), 0); targetUITable_->SetHeader(headerLabels);
// addDockWidget(pSettingUI->GetArea("TargetListWgt"), dataTableDock); //const QString reportPath = RecourceHelper::Get().GetBasePath() + "/workspace/Report.txt";
targetUITable_->AttachDock(dataTableDock); targetUITable_->InitFile(speedPath, 50);
m_mapDockWidget.insert("TargetListWgt_Table", dataTableDock);
} DockWidget* dataTableDock = new DockWidget(tr("Report Table"), 0);
// addDockWidget(pSettingUI->GetArea("TargetListWgt"), dataTableDock);
targetUITable_->AttachDock(dataTableDock);
m_mapDockWidget.insert("TargetListWgt_Table", dataTableDock);
const QString lampPath = RecourceHelper::Get().GetBasePath() + "/workspace/Lamp.txt"; }
DockWidget* signalIndicatorLampDock = new DockWidget(tr("Signal Indicator Lamp"), 0); const QString lampPath = RecourceHelper::Get().GetBasePath() + "/workspace/Lamp.txt";
signalIndicatorLampUI_ = new SignalIndicatorLampUI;
signalIndicatorLampUI_->AttachDock(signalIndicatorLampDock);
signalIndicatorLampUI_->InitLamp(lampPath);
m_mapDockWidget.insert("SignalIndicatorLampUI", signalIndicatorLampDock); DockWidget* signalIndicatorLampDock = new DockWidget(tr("Signal Indicator Lamp"), 0);
signalIndicatorLampUI_ = new SignalIndicatorLampUI;
signalIndicatorLampUI_->AttachDock(signalIndicatorLampDock);
signalIndicatorLampUI_->InitLamp(lampPath);
DockWidget* addParamSettingDock = new DockWidget(tr("ParamSetting"), 0); m_mapDockWidget.insert("SignalIndicatorLampUI", signalIndicatorLampDock);
addParamDlg_ = new AddParamSetting(matlabParam);
addParamDlg_->AttachDock(addParamSettingDock);
m_mapDockWidget.insert("ParamSetting", addParamSettingDock);
DockWidget* matlabDock = new DockWidget(tr("Matlab File"), 0); DockWidget* addParamSettingDock = new DockWidget(tr("ParamSetting"), 0);
matlabFileDlg_ = new CodeEdtUI; addParamDlg_ = new AddParamSetting(matlabParam);
matlabFileDlg_->AttachDock(matlabDock); addParamDlg_->AttachDock(addParamSettingDock);
m_mapDockWidget.insert("Matlab", matlabDock); m_mapDockWidget.insert("ParamSetting", addParamSettingDock);
ui->discript->setText(tr("name: 5year 0412")); DockWidget* matlabDock = new DockWidget(tr("bat File"), 0);
//ui->status->setText(tr("start: no start")); matlabFileDlg_ = new CodeEdtUI;
matlabFileDlg_->AttachDock(matlabDock);
m_mapDockWidget.insert("Matlab", matlabDock);
InitDockLayout(); ui->discript->setText(tr("name: 5year 0412"));
//ui->status->setText(tr("start: no start"));
//ui->viewWidget->layout()->addWidget(qtOsgViewWidget_);
qtOsgViewWidget_->LoadDefaultScene();
OsgViewer::Get().Initialize();
OsgViewer::Get().OnFrame();
#if 1 InitDockLayout();
// MatlabObject* mtlb = new MatlabObject;
MatlabObject::GetInstance()->RunMatlabFile(""); //ui->viewWidget->layout()->addWidget(qtOsgViewWidget_);
qtOsgViewWidget_->LoadDefaultScene();
OsgViewer::Get().Initialize();
OsgViewer::Get().OnFrame();
#if 0
// MatlabObject* mtlb = new MatlabObject;
MatlabObject::GetInstance()->RunMatlabFile("");
#endif // 1 #endif // 1
} }
void MainWindow::InitDockLayout() { void MainWindow::InitDockLayout() {
while (tabWidget_->count() > 0) { while (tabWidget_->count() > 0) {
tabWidget_->removeTab(0); tabWidget_->removeTab(0);
} }
QVariantList listTab = pSettingUI->GetAreaLayout().toList(); tabWidget_->tabBar()->setExpanding(true);
for (int i = 0; i < listTab.size(); i++) {
QVariantMap mapTab = listTab[i].toMap();
QString strTabName = mapTab.value("Name").toString();
QMainWindow* mainWindow_ = new QMainWindow; QVariantList listTab = pSettingUI->GetAreaLayout().toList();
connect(mainWindow_, &QMainWindow::tabifiedDockWidgetActivated, this, &MainWindow::OnTabifiedDockWidgetActivated); for (int i = 0; i < listTab.size(); i++) {
QVariantMap mapTab = listTab[i].toMap();
QString strTabName = mapTab.value("Name").toString();
QVariantList listDocArea = mapTab.value("Widget").toList(); CustomMainWindow* mainWindow_ = new CustomMainWindow;
mainWindow_->setDockOptions(QMainWindow::AllowNestedDocks |
QMainWindow::AllowTabbedDocks | QMainWindow::AnimatedDocks |
QMainWindow::ForceTabbedDocks | QMainWindow::VerticalTabs);
tabWidget_->insertTab(i, mainWindow_, strTabName); connect(mainWindow_, &QMainWindow::tabifiedDockWidgetActivated, this, &MainWindow::OnTabifiedDockWidgetActivated);
if (listDocArea[0].toList().size() > 0) {
mainWindow_->setCentralWidget(qtOsgViewWidget_);
OsgViewer::Get().Initialize();
OsgViewer::Get().OnFrame();
} else {
mainWindow_->takeCentralWidget();
}
QVariantList listDocArea = mapTab.value("Widget").toList();
if (listDocArea.size() > 0) { tabWidget_->insertTab(i, mainWindow_, strTabName);
QDockWidget* lastDock = nullptr; if (listDocArea[0].toList().size() > 0) {
mainWindow_->setCentralWidget(qtOsgViewWidget_);
OsgViewer::Get().Initialize();
OsgViewer::Get().OnFrame();
}
else {
mainWindow_->takeCentralWidget();
}
for (int j = 1; j < listDocArea.size(); j++) { if (listDocArea.size() > 0) {
Qt::DockWidgetArea dockArea; QDockWidget* lastDock = nullptr;
if (j == 1) {
dockArea = Qt::LeftDockWidgetArea;
} else if (j == 2) {
dockArea = Qt::TopDockWidgetArea;
} else if (j == 3) {
dockArea = Qt::RightDockWidgetArea;
} else if (j == 4) {
dockArea = Qt::BottomDockWidgetArea;
}
QVariantList listDocAreaChild = listDocArea[j].toList(); for (int j = 1; j < listDocArea.size(); j++) {
for (int m = 0; m < listDocAreaChild.size(); m++) { Qt::DockWidgetArea dockArea;
QVariant varWidget = listDocAreaChild[m]; if (j == 1) {
dockArea = Qt::LeftDockWidgetArea;
}
else if (j == 2) {
dockArea = Qt::TopDockWidgetArea;
}
else if (j == 3) {
dockArea = Qt::RightDockWidgetArea;
}
else if (j == 4) {
dockArea = Qt::BottomDockWidgetArea;
}
if (varWidget.type() == QVariant::String) { QVariantList listDocAreaChild = listDocArea[j].toList();
QDockWidget* pDock = m_mapDockWidget.value(varWidget.toString()); for (int m = 0; m < listDocAreaChild.size(); m++) {
if (pDock == nullptr) { QVariant varWidget = listDocAreaChild[m];
continue;
}
mainWindow_->addDockWidget(dockArea, pDock);
lastDock = pDock;
} else {
QVariantList listWidget = varWidget.toList();
for (int k = 0; k < listWidget.size(); k++) {
QDockWidget* pDock = m_mapDockWidget.value(listWidget[k].toString());
mainWindow_->addDockWidget(dockArea, pDock);
if (k == 0) { if (varWidget.type() == QVariant::String) {
if (lastDock) { QDockWidget* pDock = m_mapDockWidget.value(varWidget.toString());
mainWindow_->splitDockWidget(lastDock, pDock, Qt::Vertical); if (pDock == nullptr) {
} continue;
} else { }
mainWindow_->splitDockWidget(lastDock, pDock, Qt::Horizontal); mainWindow_->addDockWidget(dockArea, pDock);
} lastDock = pDock;
}
else {
QVariantList listWidget = varWidget.toList();
for (int k = 0; k < listWidget.size(); k++) {
QDockWidget* pDock = m_mapDockWidget.value(listWidget[k].toString());
mainWindow_->addDockWidget(dockArea, pDock);
lastDock = pDock; if (k == 0) {
} if (lastDock) {
} mainWindow_->splitDockWidget(lastDock, pDock, Qt::Vertical);
} }
} }
} else {
} mainWindow_->splitDockWidget(lastDock, pDock, Qt::Horizontal);
}
/* AddDockArea("DockLeftArea"); lastDock = pDock;
AddDockArea("DockTopArea"); }
AddDockArea("DockRightArea"); }
AddDockArea("DockBottomArea");*/ }
}
}
}
tabWidget_->tabBar()->setMinimumWidth(500);
/* AddDockArea("DockLeftArea");
AddDockArea("DockTopArea");
AddDockArea("DockRightArea");
AddDockArea("DockBottomArea");*/
} }
void MainWindow::AddDockArea(const QString& strArea) { void MainWindow::AddDockArea(const QString& strArea) {
Qt::DockWidgetArea dockArea; Qt::DockWidgetArea dockArea;
Qt::Orientation orient; Qt::Orientation orient;
if (strArea == "DockLeftArea") { if (strArea == "DockLeftArea") {
dockArea = Qt::LeftDockWidgetArea; dockArea = Qt::LeftDockWidgetArea;
orient = Qt::Vertical; orient = Qt::Vertical;
} else if (strArea == "DockTopArea") { }
dockArea = Qt::TopDockWidgetArea; else if (strArea == "DockTopArea") {
orient = Qt::Horizontal; dockArea = Qt::TopDockWidgetArea;
} else if (strArea == "DockRightArea") { orient = Qt::Horizontal;
dockArea = Qt::RightDockWidgetArea; }
orient = Qt::Vertical; else if (strArea == "DockRightArea") {
} else if (strArea == "DockBottomArea") { dockArea = Qt::RightDockWidgetArea;
dockArea = Qt::BottomDockWidgetArea; orient = Qt::Vertical;
orient = Qt::Horizontal; }
} else { else if (strArea == "DockBottomArea") {
return; dockArea = Qt::BottomDockWidgetArea;
} orient = Qt::Horizontal;
}
else {
return;
}
QList<QDockWidget*> listAdd; QList<QDockWidget*> listAdd;
QVariant varArea = pSettingUI->GetAreaLayout(); QVariant varArea = pSettingUI->GetAreaLayout();
if (varArea.isValid()) { if (varArea.isValid()) {
QVariantList listWidget = varArea.toList(); QVariantList listWidget = varArea.toList();
for each(QVariant varWidget in listWidget) { for each (QVariant varWidget in listWidget) {
if (varWidget.type() == QVariant::String) { if (varWidget.type() == QVariant::String) {
QDockWidget* pDock = m_mapDockWidget.value(varWidget.toString()); QDockWidget* pDock = m_mapDockWidget.value(varWidget.toString());
addDockWidget(dockArea, pDock); addDockWidget(dockArea, pDock);
listAdd.push_back(pDock); listAdd.push_back(pDock);
} else { }
QDockWidget* pLastDock = nullptr; else {
QVariantList listTab = varWidget.toList(); QDockWidget* pLastDock = nullptr;
for each(QVariant tabChild in listTab) { QVariantList listTab = varWidget.toList();
QDockWidget* pDock = m_mapDockWidget.value(tabChild.toString()); for each (QVariant tabChild in listTab) {
addDockWidget(dockArea, pDock); QDockWidget* pDock = m_mapDockWidget.value(tabChild.toString());
addDockWidget(dockArea, pDock);
if (pLastDock) { if (pLastDock) {
//tabifyDockWidget(pLastDock, pDock); //tabifyDockWidget(pLastDock, pDock);
splitDockWidget(pLastDock, pDock, Qt::Horizontal); splitDockWidget(pLastDock, pDock, Qt::Horizontal);
} }
listAdd.push_back(pDock); listAdd.push_back(pDock);
pLastDock = pDock; pLastDock = pDock;
} }
} }
} }
} }
QList<int> listSpliter; QList<int> listSpliter;
for (size_t i = 0; i < listAdd.size(); i++) { for (size_t i = 0; i < listAdd.size(); i++) {
listSpliter.push_back(1); listSpliter.push_back(1);
} }
resizeDocks(listAdd, listSpliter, orient);
}
void MainWindow::SaveDockStatus()
{
resizeDocks(listAdd, listSpliter, orient);
} }
void MainWindow::OnTabifiedDockWidgetActivated(QDockWidget* dockWidget) { void MainWindow::OnTabifiedDockWidgetActivated(QDockWidget* dockWidget) {
if (dockWidget) { //if (dockWidget) {
QMainWindow* mainWindow = qobject_cast<QMainWindow*>(dockWidget->parentWidget()); // QMainWindow* mainWindow = qobject_cast<QMainWindow*>(dockWidget->parentWidget());
if (mainWindow) { // if (mainWindow) {
mainWindow->removeDockWidget(dockWidget); // mainWindow->removeDockWidget(dockWidget);
} // }
// tabWidget_->setCurrentWidget(dockWidget->parentWidget()); // // tabWidget_->setCurrentWidget(dockWidget->parentWidget());
} //}
} }
void MainWindow::slotShowUISetting() { void MainWindow::slotShowUISetting() {
pSettingUI->show(); pSettingUI->show();
} }
void MainWindow::slotResetWorkSpace() void MainWindow::slotResetWorkSpace()
{ {
QString wavePath = "", speedPath = "", rdPath = ""; QString wavePath = "", speedPath = "", rdPath = "";
if (WorkSpaceManager::Get().GetCurrent()) if (WorkSpaceManager::Get().GetCurrent())
{ {
if (!WorkSpaceManager::Get().GetCurrent()->GetWavePath().isEmpty()) if (!WorkSpaceManager::Get().GetCurrent()->GetWavePath().isEmpty())
{ {
wavePath = RecourceHelper::Get().GetBasePath() + "/" + WorkSpaceManager::Get().GetCurrent()->GetWavePath(); wavePath = WorkSpaceManager::Get().GetCurrent()->GetWavePath();
} //wavePath = RecourceHelper::Get().GetBasePath() + "/" + WorkSpaceManager::Get().GetCurrent()->GetWavePath();
}
if (!WorkSpaceManager::Get().GetCurrent()->GetReportPath().isEmpty()) if (!WorkSpaceManager::Get().GetCurrent()->GetReportPath().isEmpty())
{ {
speedPath = RecourceHelper::Get().GetBasePath() + "/" + WorkSpaceManager::Get().GetCurrent()->GetReportPath(); speedPath = WorkSpaceManager::Get().GetCurrent()->GetReportPath();
} //speedPath = RecourceHelper::Get().GetBasePath() + "/" + WorkSpaceManager::Get().GetCurrent()->GetReportPath();
}
if (!WorkSpaceManager::Get().GetCurrent()->GetRDPath().isEmpty()) if (!WorkSpaceManager::Get().GetCurrent()->GetRDPath().isEmpty())
{ {
rdPath = RecourceHelper::Get().GetBasePath() + "/" + WorkSpaceManager::Get().GetCurrent()->GetRDPath(); rdPath = WorkSpaceManager::Get().GetCurrent()->GetRDPath();
} //rdPath = RecourceHelper::Get().GetBasePath() + "/" + WorkSpaceManager::Get().GetCurrent()->GetRDPath();
} }
}
fitCurveDlg_->InitWaveFile(wavePath); fitCurveDlg_->InitWaveFile(wavePath);
fitYLgCurveDlg_->InitReportFile(speedPath); fitYLgCurveDlg_->InitReportFile(speedPath);
surfaceDlg_->InitRD(rdPath); surfaceDlg_->InitRD(rdPath);
targetUITable_->InitFile(speedPath, 50); targetUITable_->InitFile(speedPath, 50);
} }

View File

@ -46,6 +46,8 @@ private:
void InitDockLayout(); void InitDockLayout();
void AddDockArea(const QString& strArea); void AddDockArea(const QString& strArea);
void SaveDockStatus();
protected: protected:
void OnTabifiedDockWidgetActivated(QDockWidget* dockWidget); void OnTabifiedDockWidgetActivated(QDockWidget* dockWidget);

View File

@ -6,6 +6,8 @@
#include "workspace/WorkSpaceManager.h" #include "workspace/WorkSpaceManager.h"
#include <qmessagebox.h> #include <qmessagebox.h>
#include <qfiledialog.h>
ChartPlotMenu::ChartPlotMenu(QWidget *parent) ChartPlotMenu::ChartPlotMenu(QWidget *parent)
: QWidget(parent) : QWidget(parent)
{ {
@ -24,13 +26,9 @@ void ChartPlotMenu::InitMenu()
connect(ui.toolButton, &QToolButton::clicked, this, [=] { connect(ui.toolButton, &QToolButton::clicked, this, [=] {
if (WorkSpaceManager::Get().GetCurrent()) if (WorkSpaceManager::Get().GetCurrent())
{ {
QString strFile = WorkSpaceManager::Get().GetCurrent()->GetSimMatlab(); QString strFile = WorkSpaceManager::Get().GetCurrent()->GetSimMatlab();
if (!strFile.isEmpty()) if (!strFile.isEmpty())
{ {
strFile = RecourceHelper::Get().GetBasePath() + "/" + WorkSpaceManager::Get().GetCurrent()->GetSimMatlab();
//MatlabObject::GetInstance()->RunMatlabFile("D:\\DYT\\TestGUI\\xierutest.m");
MatlabObject::GetInstance()->RunMatlabFile(strFile); MatlabObject::GetInstance()->RunMatlabFile(strFile);
} }
else else
@ -39,4 +37,147 @@ void ChartPlotMenu::InitMenu()
} }
} }
}); });
connect(ui.toolButton_2, &QToolButton::clicked, this, [=] {
auto current = WorkSpaceManager::Get().GetCurrent();
if (nullptr == current) {
QMessageBox::information(nullptr, QString::fromLocal8Bit("提示"), QString::fromLocal8Bit("请先创建空间!"));
return;
}
QString strSel = QFileDialog::getOpenFileName(this, u8"选择仿真运行文件", RecourceHelper::Get().GetBasePath() + "/workspace/", "*.m");
if (strSel.isEmpty()) {
LOG_WARN("选择文件为空");
return;
}
const QString old = current->GetSimMatlab();
if (old == strSel) {
LOG_INFO("选择文件与当前文件相同");
return;
} else if (!old.isEmpty()) {
if (QMessageBox::Yes == QMessageBox::question(nullptr,
QString::fromLocal8Bit("询问"),
QString::fromLocal8Bit("替换当前仿真文件!"),
QMessageBox::Yes | QMessageBox::No)
) {
if (!QFile::remove(old)) {
LOG_WARN("删除文件失败");
QMessageBox::information(nullptr,
QString::fromLocal8Bit("提示"),
QString::fromLocal8Bit("删除文件失败!"));
return;
}
}
}
current->SetSimMatlab(strSel);
});
connect(ui.toolButton_5, &QToolButton::clicked, this, [=] {
auto current = WorkSpaceManager::Get().GetCurrent();
if (nullptr == current) {
QMessageBox::information(nullptr, QString::fromLocal8Bit("提示"), QString::fromLocal8Bit("请先创建空间!"));
return;
}
QString strSel = QFileDialog::getOpenFileName(this, u8"选择Wave文件", RecourceHelper::Get().GetBasePath() + "/workspace/", "*.txt");
if (strSel.isEmpty()) {
LOG_WARN("选择文件为空");
return;
}
const QString old = current->GetWavePath();
if (old == strSel) {
LOG_INFO("选择文件与当前文件相同");
return;
}
else if (!old.isEmpty()) {
if (QMessageBox::Yes == QMessageBox::question(nullptr,
QString::fromLocal8Bit("询问"),
QString::fromLocal8Bit("替换当前Wave文件"),
QMessageBox::Yes | QMessageBox::No)
) {
if (!QFile::remove(old)) {
LOG_WARN("删除文件失败");
QMessageBox::information(nullptr,
QString::fromLocal8Bit("提示"),
QString::fromLocal8Bit("删除文件失败!"));
return;
}
}
}
current->SetWavePath(strSel);
});
connect(ui.toolButton_3, &QToolButton::clicked, this, [=] {
auto current = WorkSpaceManager::Get().GetCurrent();
if (nullptr == current) {
QMessageBox::information(nullptr, QString::fromLocal8Bit("提示"), QString::fromLocal8Bit("请先创建空间!"));
return;
}
QString strSel = QFileDialog::getOpenFileName(this, u8"选择RD文件", RecourceHelper::Get().GetBasePath() + "/workspace/", "*.txt");
if (strSel.isEmpty()) {
LOG_WARN("选择文件为空");
return;
}
const QString old = current->GetRDPath();
if (old == strSel) {
LOG_INFO("选择文件与当前文件相同");
return;
}
else if (!old.isEmpty()) {
if (QMessageBox::Yes == QMessageBox::question(nullptr,
QString::fromLocal8Bit("询问"),
QString::fromLocal8Bit("替换当前RD文件"),
QMessageBox::Yes | QMessageBox::No)
) {
if (!QFile::remove(old)) {
LOG_WARN("删除文件失败");
QMessageBox::information(nullptr,
QString::fromLocal8Bit("提示"),
QString::fromLocal8Bit("删除文件失败!"));
return;
}
}
}
current->SetRDPath(strSel);
});
connect(ui.toolButton_4, &QToolButton::clicked, this, [=] {
auto current = WorkSpaceManager::Get().GetCurrent();
if (nullptr == current) {
QMessageBox::information(nullptr, QString::fromLocal8Bit("提示"), QString::fromLocal8Bit("请先创建空间!"));
return;
}
QString strSel = QFileDialog::getOpenFileName(this, u8"选择Report文件", RecourceHelper::Get().GetBasePath() + "/workspace/", "*.txt");
if (strSel.isEmpty()) {
LOG_WARN("选择文件为空");
return;
}
const QString old = current->GetReportPath();
if (old == strSel) {
LOG_INFO("选择文件与当前文件相同");
return;
}
else if (!old.isEmpty()) {
if (QMessageBox::Yes == QMessageBox::question(nullptr,
QString::fromLocal8Bit("询问"),
QString::fromLocal8Bit("替换当前Report文件"),
QMessageBox::Yes | QMessageBox::No)
) {
if (!QFile::remove(old)) {
LOG_WARN("删除文件失败");
QMessageBox::information(nullptr,
QString::fromLocal8Bit("提示"),
QString::fromLocal8Bit("删除文件失败!"));
return;
}
}
}
current->SetReportPath(strSel);
});
} }

View File

@ -16,6 +16,58 @@
<layout class="QHBoxLayout" name="horizontalLayout_2"> <layout class="QHBoxLayout" name="horizontalLayout_2">
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout"> <layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QToolButton" name="toolButton_5">
<property name="minimumSize">
<size>
<width>60</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>Wave文件</string>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="toolButton_4">
<property name="minimumSize">
<size>
<width>60</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>Report文件</string>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="toolButton_3">
<property name="minimumSize">
<size>
<width>60</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>RD文件</string>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="toolButton_2">
<property name="minimumSize">
<size>
<width>60</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>Matlab文件</string>
</property>
</widget>
</item>
<item> <item>
<widget class="QToolButton" name="toolButton"> <widget class="QToolButton" name="toolButton">
<property name="minimumSize"> <property name="minimumSize">

View File

@ -7875,22 +7875,10 @@ public:
QMap<const QtProperty*, QtProperty*> m_properyToName; QMap<const QtProperty*, QtProperty*> m_properyToName;
QMap<const QtProperty*, QtProperty*> m_properyToDescription; QMap<const QtProperty*, QtProperty*> m_properyToDescription;
QMap<const QtProperty*, QtProperty*> m_properyToTimestep; QMap<const QtProperty*, QtProperty*> m_properyToTimestep;
QMap<const QtProperty*, QtProperty*> m_properyToSimMatlab;
QMap<const QtProperty*, QtProperty*> m_properyToMatlabParam;
QMap<const QtProperty*, QtProperty*> m_properyToWave;
QMap<const QtProperty*, QtProperty*> m_properyToReport;
QMap<const QtProperty*, QtProperty*> m_properyToRD;
QMap<const QtProperty*, QtProperty*> m_nameToPropery; QMap<const QtProperty*, QtProperty*> m_nameToPropery;
QMap<const QtProperty*, QtProperty*> m_descriptionToPropery; QMap<const QtProperty*, QtProperty*> m_descriptionToPropery;
QMap<const QtProperty*, QtProperty*> m_timestepToPropery; QMap<const QtProperty*, QtProperty*> m_timestepToPropery;
QMap<const QtProperty*, QtProperty*> m_simMatlabToPropery;
QMap<const QtProperty*, QtProperty*> m_matlabParamToPropery;
QMap<const QtProperty*, QtProperty*> m_waveToPropery;
QMap<const QtProperty*, QtProperty*> m_reportToPropery;
QMap<const QtProperty*, QtProperty*> m_rdToPropery;
}; };
void QtWorkspacePropertyManagerPrivate::slotStringChanged(QtProperty* property, QString value) { void QtWorkspacePropertyManagerPrivate::slotStringChanged(QtProperty* property, QString value) {
@ -7906,11 +7894,7 @@ void QtWorkspacePropertyManagerPrivate::slotStringChanged(QtProperty* property,
QWorkspaceAttribute c = m_values[prop]; QWorkspaceAttribute c = m_values[prop];
c.SetTimeStep(value); c.SetTimeStep(value);
q_ptr->setValue(prop, c); q_ptr->setValue(prop, c);
} else if (QtProperty* prop = m_simMatlabToPropery.value(property, 0)) { }
QWorkspaceAttribute c = m_values[prop];
c.SetSimMatlab(value);
q_ptr->setValue(prop, c);
}
} }
void QtWorkspacePropertyManagerPrivate::slotPropertyDestroyed(QtProperty* property) { void QtWorkspacePropertyManagerPrivate::slotPropertyDestroyed(QtProperty* property) {
@ -7928,31 +7912,6 @@ void QtWorkspacePropertyManagerPrivate::slotPropertyDestroyed(QtProperty* proper
m_timestepToPropery[subProp] = 0; m_timestepToPropery[subProp] = 0;
m_timestepToPropery.remove(property); m_timestepToPropery.remove(property);
} }
if (QtProperty* subProp = m_simMatlabToPropery.value(property, nullptr)) {
m_simMatlabToPropery[subProp] = 0;
m_simMatlabToPropery.remove(property);
}
if (QtProperty* subProp = m_matlabParamToPropery.value(property, nullptr)) {
m_matlabParamToPropery[subProp] = 0;
m_matlabParamToPropery.remove(property);
}
if (QtProperty* subProp = m_waveToPropery.value(property, nullptr)) {
m_waveToPropery[subProp] = 0;
m_waveToPropery.remove(property);
}
if (QtProperty* subProp = m_reportToPropery.value(property, nullptr)) {
m_reportToPropery[subProp] = 0;
m_reportToPropery.remove(property);
}
if (QtProperty* subProp = m_rdToPropery.value(property, nullptr)) {
m_rdToPropery[subProp] = 0;
m_rdToPropery.remove(property);
}
} }
QtWorkspacePropertyManager::QtWorkspacePropertyManager(QObject* parent) QtWorkspacePropertyManager::QtWorkspacePropertyManager(QObject* parent)
@ -8037,12 +7996,6 @@ void QtWorkspacePropertyManager::setValue(QtProperty* property, const QWorkspace
d_ptr->m_stringProperyManager->setValue(d_ptr->m_properyToName[property], value.GetName()); d_ptr->m_stringProperyManager->setValue(d_ptr->m_properyToName[property], value.GetName());
d_ptr->m_stringProperyManager->setValue(d_ptr->m_properyToDescription[property], value.GetDescription()); d_ptr->m_stringProperyManager->setValue(d_ptr->m_properyToDescription[property], value.GetDescription());
d_ptr->m_filesProperyManager->setValue(d_ptr->m_properyToTimestep[property], value.GetTimeStep()); d_ptr->m_filesProperyManager->setValue(d_ptr->m_properyToTimestep[property], value.GetTimeStep());
d_ptr->m_filesProperyManager->setValue(d_ptr->m_properyToSimMatlab[property], value.GetSimMatlab());
d_ptr->m_filesProperyManager->setValue(d_ptr->m_properyToMatlabParam[property], value.GetMatlabParam());
d_ptr->m_filesProperyManager->setValue(d_ptr->m_properyToWave[property], value.GetWavePath());
d_ptr->m_filesProperyManager->setValue(d_ptr->m_properyToReport[property], value.GetReportPath());
d_ptr->m_filesProperyManager->setValue(d_ptr->m_properyToRD[property], value.GetRDPath());
emit propertyChanged(property); emit propertyChanged(property);
emit valueChanged(property, value); emit valueChanged(property, value);
@ -8075,41 +8028,6 @@ void QtWorkspacePropertyManager::initializeProperty(QtProperty* property) {
d_ptr->m_properyToTimestep[property] = prop; d_ptr->m_properyToTimestep[property] = prop;
d_ptr->m_timestepToPropery[prop] = property; d_ptr->m_timestepToPropery[prop] = property;
property->addSubProperty(prop); property->addSubProperty(prop);
prop = d_ptr->m_filesProperyManager->addProperty();
prop->setPropertyName(tr("SimMatlab"));
d_ptr->m_filesProperyManager->setValueOnly(prop, val.GetSimMatlab());
d_ptr->m_properyToSimMatlab[property] = prop;
d_ptr->m_simMatlabToPropery[prop] = property;
property->addSubProperty(prop);
prop = d_ptr->m_filesProperyManager->addProperty();
prop->setPropertyName(tr("MatlabParam"));
d_ptr->m_filesProperyManager->setValueOnly(prop, val.GetMatlabParam());
d_ptr->m_properyToMatlabParam[property] = prop;
d_ptr->m_matlabParamToPropery[prop] = property;
property->addSubProperty(prop);
prop = d_ptr->m_filesProperyManager->addProperty();
prop->setPropertyName(tr("Wave"));
d_ptr->m_filesProperyManager->setValueOnly(prop, val.GetWavePath());
d_ptr->m_properyToWave[property] = prop;
d_ptr->m_waveToPropery[prop] = property;
property->addSubProperty(prop);
prop = d_ptr->m_filesProperyManager->addProperty();
prop->setPropertyName(tr("RD"));
d_ptr->m_filesProperyManager->setValueOnly(prop, val.GetRDPath());
d_ptr->m_properyToRD[property] = prop;
d_ptr->m_rdToPropery[prop] = property;
property->addSubProperty(prop);
prop = d_ptr->m_filesProperyManager->addProperty();
prop->setPropertyName(tr("Report"));
d_ptr->m_filesProperyManager->setValueOnly(prop, val.GetReportPath());
d_ptr->m_properyToReport[property] = prop;
d_ptr->m_reportToPropery[prop] = property;
property->addSubProperty(prop);
} }
/*! /*!
@ -8136,41 +8054,6 @@ void QtWorkspacePropertyManager::uninitializeProperty(QtProperty* property) {
delete prop; delete prop;
} }
d_ptr->m_properyToTimestep.remove(property); d_ptr->m_properyToTimestep.remove(property);
prop = d_ptr->m_simMatlabToPropery[property];
if (prop) {
d_ptr->m_simMatlabToPropery.remove(prop);
delete prop;
}
d_ptr->m_properyToSimMatlab.remove(property);
prop = d_ptr->m_matlabParamToPropery[property];
if (prop) {
d_ptr->m_matlabParamToPropery.remove(prop);
delete prop;
}
d_ptr->m_properyToMatlabParam.remove(property);
prop = d_ptr->m_waveToPropery[property];
if (prop) {
d_ptr->m_waveToPropery.remove(prop);
delete prop;
}
d_ptr->m_properyToWave.remove(property);
prop = d_ptr->m_reportToPropery[property];
if (prop) {
d_ptr->m_reportToPropery.remove(prop);
delete prop;
}
d_ptr->m_properyToReport.remove(property);
prop = d_ptr->m_rdToPropery[property];
if (prop) {
d_ptr->m_rdToPropery.remove(prop);
delete prop;
}
d_ptr->m_properyToRD.remove(property);
} }
#pragma endregion #pragma endregion

View File

@ -128,7 +128,7 @@ void QtOsgViewWidget::LoadDefaultScene(void) {
dyt_check(nullptr != activeScene_); dyt_check(nullptr != activeScene_);
if (nullptr == WorkSpaceManager::Get().LoadDefaultWorkspace(activeScene_)) { if (nullptr == WorkSpaceManager::Get().LoadDefaultWorkspace(activeScene_)) {
LOG_ERROR("load default workspace failed"); LOG_ERROR("load default workspace failed");
QMessageBox::warning(this, tr("warning"), tr("default workspace failed")); //QMessageBox::warning(this, tr("warning"), tr("default workspace failed"));
} }
} }

View File

@ -14,6 +14,7 @@
#include "xml/tinyxml2.h" #include "xml/tinyxml2.h"
#include "common/SpdLogger.h" #include "common/SpdLogger.h"
#include "entities/Entity.h" #include "entities/Entity.h"
#include "utils/FileUtils.h"
//#include "workspace/WorkSpaceItemGroup.h" //#include "workspace/WorkSpaceItemGroup.h"
//#include "workspace/WorkSpaceRiverGroup.h" //#include "workspace/WorkSpaceRiverGroup.h"
//#include "workspace/WorkSpaceRiverNetGroup.h" //#include "workspace/WorkSpaceRiverNetGroup.h"
@ -38,6 +39,76 @@ const QString WorkSpace::GetDir() const {
return info.absolutePath(); return info.absolutePath();
} }
void WorkSpace::SetSimMatlab(const QString& path) {
QFileInfo fileInfo(path);
QString dirPath = QString("%1/%2").arg(GetDir(), fileInfo.fileName());
bool sucess = FileUtils::CopyFileToPath(path, dirPath, true);
LOG_INFO("copy simmatlab file {}: {} to {}",
path.toLocal8Bit().data(),
dirPath.toLocal8Bit().data(),
sucess);
simMatlabPath_ = fileInfo.fileName();
}
const QString WorkSpace::GetSimMatlab() const {
QString path = QString("%1/%2").arg(GetDir(), simMatlabPath_);
return path;
}
void WorkSpace::SetWavePath(const QString& path)
{
QFileInfo fileInfo(path);
QString dirPath = QString("%1/%2").arg(GetDir(), fileInfo.fileName());
bool sucess = FileUtils::CopyFileToPath(path, dirPath, true);
LOG_INFO("copy Wave file {}: {} to {}",
path.toLocal8Bit().data(),
dirPath.toLocal8Bit().data(),
sucess);
waveFile_ = fileInfo.fileName();
}
const QString WorkSpace::GetWavePath() const
{
QString path = QString("%1/%2").arg(GetDir(), waveFile_);
return path;
}
void WorkSpace::SetReportPath(const QString& path)
{
QFileInfo fileInfo(path);
QString dirPath = QString("%1/%2").arg(GetDir(), fileInfo.fileName());
bool sucess = FileUtils::CopyFileToPath(path, dirPath, true);
LOG_INFO("copy Wave file {}: {} to {}",
path.toLocal8Bit().data(),
dirPath.toLocal8Bit().data(),
sucess);
reportFile_ = fileInfo.fileName();
}
const QString WorkSpace::GetReportPath() const
{
QString path = QString("%1/%2").arg(GetDir(), reportFile_);
return path;
}
void WorkSpace::SetRDPath(const QString& path)
{
QFileInfo fileInfo(path);
QString dirPath = QString("%1/%2").arg(GetDir(), fileInfo.fileName());
bool sucess = FileUtils::CopyFileToPath(path, dirPath, true);
LOG_INFO("copy RD file {}: {} to {}",
path.toLocal8Bit().data(),
dirPath.toLocal8Bit().data(),
sucess);
rdFile_ = fileInfo.fileName();
}
const QString WorkSpace::GetRDPath() const
{
QString path = QString("%1/%2").arg(GetDir(), rdFile_);
return path;
}
void WorkSpace::AddEntity(Entity* entity) { void WorkSpace::AddEntity(Entity* entity) {
if (nullptr == entity) { if (nullptr == entity) {
LOG_WARN("entity is nullptr"); LOG_WARN("entity is nullptr");

View File

@ -46,12 +46,8 @@ public:
inline const QString& GetDescribe() const { inline const QString& GetDescribe() const {
return describe_; return describe_;
} }
inline void SetSimMatlab(const QString& path) { void SetSimMatlab(const QString& path);
simMatlabPath_ = path; const QString GetSimMatlab() const;
}
inline const QString GetSimMatlab() const {
return simMatlabPath_;
}
inline void SetMatlabParam(const QString& path) { inline void SetMatlabParam(const QString& path) {
matlabParamPath_ = path; matlabParamPath_ = path;
@ -60,26 +56,14 @@ public:
return matlabParamPath_; return matlabParamPath_;
} }
inline void SetWavePath(const QString& path) { void SetWavePath(const QString& path);
waveFile_ = path; const QString GetWavePath() const;
}
inline const QString GetWavePath() const {
return waveFile_;
}
inline void SetReportPath(const QString& path) { void SetReportPath(const QString& path) ;
reportFile_ = path; const QString GetReportPath() const;
}
inline const QString GetReportPath() const {
return reportFile_;
}
inline void SetRDPath(const QString& path) { void SetRDPath(const QString& path);
rdFile_ = path; const QString GetRDPath() const;
}
inline const QString GetRDPath() const {
return rdFile_;
}
inline void SetHomeViewpoint(const osgEarth::Viewpoint& viewpoint) { inline void SetHomeViewpoint(const osgEarth::Viewpoint& viewpoint) {
homeViewpoint_ = viewpoint; homeViewpoint_ = viewpoint;
@ -137,6 +121,11 @@ Q_SIGNALS:
void TimestepChanged(class Timestep* timestep); void TimestepChanged(class Timestep* timestep);
void LampStatusChanged(class LampStatus* lampStatus); void LampStatusChanged(class LampStatus* lampStatus);
protected:
const QString& GetSimMatlabName() const {
return simMatlabPath_;
}
private: private:
QString name_; QString name_;
QString uuid_; QString uuid_;
@ -155,6 +144,8 @@ private:
std::vector<class Entity*> entities_; std::vector<class Entity*> entities_;
OEScene* scene_{ nullptr }; OEScene* scene_{ nullptr };
class Timestep* timestep_{ nullptr }; class Timestep* timestep_{ nullptr };
class LampStatus* lampStatus_{ nullptr }; class LampStatus* lampStatus_{ nullptr };
friend class WorkSpaceXMLWrite;
}; };

View File

@ -155,6 +155,33 @@ bool WorkSpaceXMLParse::ParseChart(const tinyxml2::XMLElement* element)
return true; return true;
} }
bool WorkSpaceXMLParse::ParseSimMatlab(const tinyxml2::XMLElement* element)
{
if (nullptr == element) {
LOG_WARN("element is nullptr");
return false;
}
const tinyxml2::XMLElement* xmlElement = element->FirstChildElement();
while (nullptr != xmlElement) {
const char* name = xmlElement->Name();
if (0 == strcmp(name, "SimMatlab"))
{
QVariantMap varChart;
const tinyxml2::XMLAttribute* attribute = xmlElement->FirstAttribute();
while (nullptr != attribute) {
WorkSpaceManager::Get().GetCurrent()->SetSimMatlab(QString::fromLocal8Bit(attribute->Value()));
attribute = attribute->Next();
}
}
xmlElement = xmlElement->NextSiblingElement();
}
return true;
}
bool WorkSpaceXMLParse::ParseReport(const tinyxml2::XMLElement* element) bool WorkSpaceXMLParse::ParseReport(const tinyxml2::XMLElement* element)
{ {
QString strFile = ""; QString strFile = "";
@ -208,6 +235,9 @@ bool WorkSpaceXMLParse::Load(const QString& dyt) {
else if (0 == strcmp(name, "ReportInfo")) { else if (0 == strcmp(name, "ReportInfo")) {
ParseReport(xmlElement); ParseReport(xmlElement);
} }
else if (0 == strcmp(name, "SimMatlab")) {
ParseSimMatlab(xmlElement);
}
xmlElement = xmlElement->NextSiblingElement(); xmlElement = xmlElement->NextSiblingElement();
} }

View File

@ -34,6 +34,7 @@ private:
bool ParseEntities(const tinyxml2::XMLElement* element); bool ParseEntities(const tinyxml2::XMLElement* element);
bool ParseChart(const tinyxml2::XMLElement* element); bool ParseChart(const tinyxml2::XMLElement* element);
bool ParseReport(const tinyxml2::XMLElement* element); bool ParseReport(const tinyxml2::XMLElement* element);
bool ParseSimMatlab(const tinyxml2::XMLElement* element);
private: private:
QString name_; QString name_;

View File

@ -114,7 +114,7 @@ bool WorkSpaceXMLWrite::SaveChart(tinyxml2::XMLElement* scene, tinyxml2::XMLDocu
tinyxml2::XMLElement* chart = doc->NewElement("SimMatlab"); tinyxml2::XMLElement* chart = doc->NewElement("SimMatlab");
charts->LinkEndChild(chart); charts->LinkEndChild(chart);
chart->SetAttribute("SimMatlab", workSpace_->GetSimMatlab().toLocal8Bit().constData()); chart->SetAttribute("SimMatlab", workSpace_->GetSimMatlabName().toLocal8Bit().constData());
} }
return true; return true;

View File

@ -28,12 +28,12 @@
<DockRightArea Name="右侧区域"/> <DockRightArea Name="右侧区域"/>
<DockBottomArea Name="下方区域"/> <DockBottomArea Name="下方区域"/>
</MainWindow> </MainWindow>
<MainWindow Name="Matlab文件编辑"> <MainWindow Name="bat文件管理">
<CentralWidget Name="中心区域"/> <CentralWidget Name="中心区域"/>
<DockLeftArea Name="左侧区域"/> <DockLeftArea Name="左侧区域"/>
<DockTopArea Name="上方区域"/> <DockTopArea Name="上方区域"/>
<DockRightArea Name="右侧区域"> <DockRightArea Name="右侧区域">
<Widget Plugin="Matlab" Name="参数设置"/> <Widget Plugin="Matlab" Name="bat文件"/>
</DockRightArea> </DockRightArea>
<DockBottomArea Name="下方区域"/> <DockBottomArea Name="下方区域"/>
</MainWindow> </MainWindow>