modify play menu and add label and update sim

This commit is contained in:
brige 2025-07-06 22:34:23 +08:00
parent 57f8c1b6af
commit 63eeca0086
5 changed files with 54 additions and 31 deletions

View File

@ -623,7 +623,7 @@
<context> <context>
<name>ModelTreeWidget</name> <name>ModelTreeWidget</name>
<message> <message>
<location filename="../ui/ModelBrowser/ModelTreeWidget.cpp" line="252"/> <location filename="../ui/ModelBrowser/ModelTreeWidget.cpp" line="254"/>
<source>Release Track</source> <source>Release Track</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
@ -658,22 +658,27 @@
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../ui/ModelBrowser/ModelTreeWidget.cpp" line="260"/> <location filename="../ui/ModelBrowser/ModelTreeWidget.cpp" line="262"/>
<source>Track</source> <source>Track</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../ui/ModelBrowser/ModelTreeWidget.cpp" line="268"/> <location filename="../ui/ModelBrowser/ModelTreeWidget.cpp" line="270"/>
<source>Add Label Component</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/ModelBrowser/ModelTreeWidget.cpp" line="277"/>
<source>Add Mesh Component</source> <source>Add Mesh Component</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../ui/ModelBrowser/ModelTreeWidget.cpp" line="271"/> <location filename="../ui/ModelBrowser/ModelTreeWidget.cpp" line="280"/>
<source>Add Path Component</source> <source>Add Path Component</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../ui/ModelBrowser/ModelTreeWidget.cpp" line="278"/> <location filename="../ui/ModelBrowser/ModelTreeWidget.cpp" line="287"/>
<source>Delete</source> <source>Delete</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
@ -758,7 +763,6 @@
</message> </message>
<message> <message>
<location filename="../ui/Menu/PlayManagerMenu.cpp" line="34"/> <location filename="../ui/Menu/PlayManagerMenu.cpp" line="34"/>
<location filename="../ui/Menu/PlayManagerMenu.cpp" line="41"/>
<location filename="../ui/Menu/PlayManagerMenu.cpp" line="63"/> <location filename="../ui/Menu/PlayManagerMenu.cpp" line="63"/>
<location filename="../ui/Menu/PlayManagerMenu.cpp" line="70"/> <location filename="../ui/Menu/PlayManagerMenu.cpp" line="70"/>
<location filename="../ui/Menu/PlayManagerMenu.cpp" line="81"/> <location filename="../ui/Menu/PlayManagerMenu.cpp" line="81"/>
@ -768,6 +772,11 @@
<source>has not workspace</source> <source>has not workspace</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<location filename="../ui/Menu/PlayManagerMenu.cpp" line="41"/>
<source>not timestep</source>
<translation type="unfinished"></translation>
</message>
<message> <message>
<location filename="../ui/Menu/PlayManagerMenu.cpp" line="48"/> <location filename="../ui/Menu/PlayManagerMenu.cpp" line="48"/>
<location filename="../ui/Menu/PlayManagerMenu.cpp" line="52"/> <location filename="../ui/Menu/PlayManagerMenu.cpp" line="52"/>

View File

@ -55,17 +55,19 @@ void ChartPlotMenu::InitMenu()
LOG_INFO("选择文件与当前文件相同"); LOG_INFO("选择文件与当前文件相同");
return; return;
} else if (!old.isEmpty()) { } else if (!old.isEmpty()) {
if (QMessageBox::Yes == QMessageBox::question(nullptr, if (QFileInfo(old).isFile() && QFile::exists(old)) {
QString::fromLocal8Bit("询问"), if (QMessageBox::Yes == QMessageBox::question(nullptr,
QString::fromLocal8Bit("替换当前仿真文件!"), QString::fromLocal8Bit("询问"),
QMessageBox::Yes | QMessageBox::No) QString::fromLocal8Bit("替换当前仿真文件!"),
) { QMessageBox::Yes | QMessageBox::No)
if (!QFile::remove(old)) { ) {
LOG_WARN("删除文件失败"); if (!QFile::remove(old)) {
QMessageBox::information(nullptr, LOG_WARN("删除文件失败");
QString::fromLocal8Bit("提示"), QMessageBox::information(nullptr,
QString::fromLocal8Bit("删除文件失败!")); QString::fromLocal8Bit("提示"),
return; QString::fromLocal8Bit("删除文件失败!"));
return;
}
} }
} }
} }
@ -129,7 +131,7 @@ void ChartPlotMenu::InitMenu()
return; return;
} }
else if (!old.isEmpty()) { else if (!old.isEmpty()) {
if (QFileInfo(old).isFile()) { if (QFileInfo(old).isFile() && QFile::exists(old)) {
if (QMessageBox::Yes == QMessageBox::question(nullptr, if (QMessageBox::Yes == QMessageBox::question(nullptr,
QString::fromLocal8Bit("询问"), QString::fromLocal8Bit("询问"),
QString::fromLocal8Bit("替换当前RD文件"), QString::fromLocal8Bit("替换当前RD文件"),
@ -167,17 +169,19 @@ void ChartPlotMenu::InitMenu()
return; return;
} }
else if (!old.isEmpty()) { else if (!old.isEmpty()) {
if (QMessageBox::Yes == QMessageBox::question(nullptr, if (QFileInfo(old).isFile() && QFile::exists(old)) {
QString::fromLocal8Bit("询问"), if (QMessageBox::Yes == QMessageBox::question(nullptr,
QString::fromLocal8Bit("替换当前Report文件"), QString::fromLocal8Bit("询问"),
QMessageBox::Yes | QMessageBox::No) QString::fromLocal8Bit("替换当前Report文件"),
) { QMessageBox::Yes | QMessageBox::No)
if (!QFile::remove(old)) { ) {
LOG_WARN("删除文件失败"); if (!QFile::remove(old)) {
QMessageBox::information(nullptr, LOG_WARN("删除文件失败");
QString::fromLocal8Bit("提示"), QMessageBox::information(nullptr,
QString::fromLocal8Bit("删除文件失败!")); QString::fromLocal8Bit("提示"),
return; QString::fromLocal8Bit("删除文件失败!"));
return;
}
} }
} }
} }

View File

@ -38,7 +38,7 @@ void PlayManagerMenu::OnPlay() {
} }
Timestep* timestep = workSpace_->GetTimestep(); Timestep* timestep = workSpace_->GetTimestep();
if (nullptr == timestep) { if (nullptr == timestep) {
QMessageBox::warning(&MainFrame::Get(), tr("warning"), tr("has not workspace"), QMessageBox::warning(&MainFrame::Get(), tr("warning"), tr("not timestep"),
QMessageBox::Ok); QMessageBox::Ok);
LOG_INFO("current is nullptr"); LOG_INFO("current is nullptr");
return; return;

View File

@ -208,6 +208,8 @@ void ModelTreeWidget::OnAddMeshEntity(const QString& mesh, const QString& name)
int count = currentWorkSpace_->GetEntities().size(); int count = currentWorkSpace_->GetEntities().size();
entity->SetName(QString("%1_%2").arg(name).arg(count)); entity->SetName(QString("%1_%2").arg(name).arg(count));
currentWorkSpace_->AddEntity(entity); currentWorkSpace_->AddEntity(entity);
OnAddComponent("LabelComponent", entity);
} }
SceneComponent* ModelTreeWidget::OnAddComponent(const QString& typeName, Entity* entity) { SceneComponent* ModelTreeWidget::OnAddComponent(const QString& typeName, Entity* entity) {
@ -265,7 +267,14 @@ void ModelTreeWidget::PopupEntityMenu(QContextMenuEvent* event, Entity* entity)
); );
} }
QAction* addEntiy = new QAction(tr("Add Mesh Component"), this); QAction* addEntiy = new QAction(tr("Add Label Component"), this);
menu.addAction(addEntiy);
connect(addEntiy, &QAction::triggered, [this, entity]() {
OnAddComponent("LabelComponent", entity);
}
);
addEntiy = new QAction(tr("Add Mesh Component"), this);
menu.addAction(addEntiy); menu.addAction(addEntiy);
addEntiy = new QAction(tr("Add Path Component"), this); addEntiy = new QAction(tr("Add Path Component"), this);

View File

@ -178,6 +178,7 @@ void OsgWidget::resizeEvent(QResizeEvent* event) {
} }
void OsgWidget::paintEvent(QPaintEvent*) { void OsgWidget::paintEvent(QPaintEvent*) {
WorkSpaceManager::Get().OnFrame();
frame(); frame();
} }