可视解释的工具条,追加“加载图文件”按钮

This commit is contained in:
jiayulong 2026-05-26 14:29:02 +08:00
parent 5c8784bf9c
commit 88eb156b5e
7 changed files with 94 additions and 5 deletions

View File

@ -329,6 +329,11 @@ signals:
//改变多臂井径属性
void sig_changeMCalsProperty(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, QString strNewLineName);
//关闭当前tab页重新打开新模板
void sig_tabCloseCurrent(QString fileFull, QString fileName);
//加载视图(重新打开)
void sig_ReOpen(QString fileFull, QString fileName);
//
//void sig_addImageToPlot(QMyCustomPlot* customPlot, double left_Low, double right_Hight, QString imagePath);

View File

@ -16,6 +16,7 @@
#include "customtabbar.h"
#include "PropertyWidget.h"
#include "mainwindowsplitter.h"
#include "CallManage.h"
CustomTabWidget::CustomTabWidget(QWidget *parent)
: QWidget(parent)
@ -37,6 +38,9 @@ CustomTabWidget::CustomTabWidget(QWidget *parent)
//关闭tab时信号槽触发的函数
connect(m_pTabBar, SIGNAL(tabCloseRequested(int)),this,SLOT(slot_tabClose(int)));
//关闭当前tab页重新打开新模板
connect(CallManage::getInstance(), SIGNAL(sig_tabCloseCurrent(QString, QString)), this, SLOT(slot_tabCloseCurrent(QString, QString)));
}
CustomTabWidget::~CustomTabWidget()
@ -230,3 +234,28 @@ void CustomTabWidget::slot_tabClose(int index)
//属性清空
PropertyService()->InitCurrentViewInfo();
}
//关闭
void CustomTabWidget::slot_tabCloseCurrent(QString fileFull, QString fileName)
{
QWidget *selectWidget = m_pStackedWidget->currentWidget();
if (selectWidget == NULL)
return;
QString objectName = selectWidget->objectName();
if(objectName == "MainWindowSplitter")
{
int flag = QMessageBox::warning(NULL,"提示",QString("应用模板后当前图文件将废弃,确定应用模板?"),QMessageBox::Yes,QMessageBox::No);
if(flag!=QMessageBox::Yes) return;
}
//移除
int index = m_pTabBar->currentIndex();
removeTab(index);
//属性清空
PropertyService()->InitCurrentViewInfo();
//重新打开新模板
emit CallManage::getInstance()->sig_ReOpen(fileFull, fileName);
}

View File

@ -35,6 +35,7 @@ public:
public slots:
void setCurrentIndex(int);
void slot_tabClose(int index);
void slot_tabCloseCurrent(QString fileFull, QString fileName);
signals:
void tabIsEmpty();

View File

@ -117,6 +117,8 @@ MainWindow::MainWindow(QWidget *parent) :
//向左侧树图,刷新新加对象
connect(CallGlobalManage::getInstance(), SIGNAL(sig_AppendConsole(Priority, const QString)), this, SLOT(s_AppendConsole(Priority, const QString)));
//加载视图(重新打开)
connect(CallManage::getInstance(), SIGNAL(sig_ReOpen(QString, QString)), this, SLOT(s_ReOpen(QString, QString)));
ConvertorManager::GetInstance().LoadAllConvertorPlugin();
QTimer::singleShot(100, this, [=]() {
@ -601,6 +603,17 @@ void MainWindow::s_PluginMsg(QString msg)
qDebug() << "s_PluginMsg:" << msg;
}
//加载视图(重新打开)
void MainWindow::s_ReOpen(QString fileFull, QString fileName)
{
MainWindowSplitter* mainSplitter = new MainWindowSplitter();
mainSplitter->setSplitterWidget(m_projectWidgets);
m_centerWidgets->addTab(mainSplitter, fileName);
MainWindowCurve *mainWindowCurve = mainSplitter->getMainWindowCurve();
mainWindowCurve->Open(fileFull);
}
//可视解释
void MainWindow::s_showView()
{

View File

@ -86,6 +86,8 @@ public slots:
void s_DrawImg();
void s_DrawLine();
//加载视图(重新打开)
void s_ReOpen(QString fileFull, QString fileName);
//可视解释
void s_showView();
//开发工具

View File

@ -538,6 +538,7 @@ void MainWindowCurve::initMainToolBar()
QIcon selectWellIcon(::GetImagePath()+"icon/SelectWells.png");
QIcon fixwellsectionHeaderIcon(::GetImagePath()+"icon/fixwellsectionHeader.png");
QIcon opentemplateIcon(::GetImagePath()+"icon/currtemplite.png");
QIcon saveastemplateIcon(::GetImagePath()+"icon/SaveAsTemplate.png");
QIcon executeDepthShiftIcon(::GetImagePath()+"icon/ExecuteDepthShift.png");
QIcon joindepthIcon(::GetImagePath()+"icon/joindepth.png");
@ -554,6 +555,7 @@ void MainWindowCurve::initMainToolBar()
//Main工具栏
m_selectWellAc = new QAction(selectWellIcon, "设置井", this);
m_fixwellsectionHeaderAc = new QAction(fixwellsectionHeaderIcon, "锁头", this);
m_opentemplateAc = new QAction(opentemplateIcon, "加载图文件", this);
m_saveastemplateAc = new QAction(saveastemplateIcon, "另存为图文件", this);
m_zoominAc = new QAction(zoominIcon, "放大", this);
m_zoomoutAc = new QAction(zoomoutIcon, "缩小", this);
@ -572,6 +574,7 @@ void MainWindowCurve::initMainToolBar()
//add QAction to Widget.
ui->mainToolBar->addAction(m_selectWellAc);
ui->mainToolBar->addAction(m_fixwellsectionHeaderAc); //锁头
ui->mainToolBar->addAction(m_opentemplateAc); //加载图文件
ui->mainToolBar->addAction(m_saveastemplateAc); //另存为图文件
ui->mainToolBar->addSeparator();
ui->mainToolBar->addAction(m_zoominAc); //放大
@ -598,6 +601,7 @@ void MainWindowCurve::initMainToolBar()
connect(m_selectWellAc, &QAction::triggered, this, &MainWindowCurve::s_selectWell);
connect(m_fixwellsectionHeaderAc, &QAction::triggered, this, &MainWindowCurve::s_showHeadTable);
connect(m_opentemplateAc, &QAction::triggered, this, &MainWindowCurve::s_Open);
connect(m_saveastemplateAc, &QAction::triggered, this, &MainWindowCurve::s_Save);
connect(m_zoominAc, &QAction::triggered, this, &MainWindowCurve::s_ZoomIn);
@ -2818,8 +2822,43 @@ void MainWindowCurve::loadStyle(const QString &qssFile)
}
}
void MainWindowCurve::s_Open()
{
//Logdata
QString folderPath;
folderPath = GetLogdataPath();
folderPath = folderPath + g_prjname;
//folderPath = folderPath + "/multiwell.json";
//打开
QString fileFull = "";
fileFull = QFileDialog::getOpenFileName(this,
tr("选择模板"),
folderPath,
tr("多井图文件(*.json)"));
if (fileFull.isEmpty())
{
return;
}
QFileInfo fileInfo(fileFull);
QString fileName = fileInfo.fileName(); // 获取文件名
emit CallManage::getInstance()->sig_tabCloseCurrent(fileFull, fileName);
// //先清空
// ui->tableWidget_2->clear();
// m_listWell.clear();
// m_mapFWell.clear();
// QFileInfo fileInfo(fileFull);
// QString fileName = fileInfo.fileName(); // 获取文件名
// Open(fileFull);
}
void MainWindowCurve::s_Save()
{
//Logdata
QString folderPath;
folderPath = GetLogdataPath();
@ -3739,11 +3778,6 @@ void MainWindowCurve::s_SaveAsSvg()
_slotExport(aa, 4, pngName, strTmpName);
}
//void MainWindowCurve::s_Open(QString fileFull)
//{
//}
//选择井
void MainWindowCurve::s_selectWell()
{
@ -5788,11 +5822,13 @@ void MainWindowCurve::slotDeleteSelectWell()
{
ui->tableWidget_2->removeColumn(column);
m_listWell.clear();
m_mapFWell.clear();
}
else
{
QString strWellName = ui->tableWidget_2->item(iCurrentRow, column)->text();
m_listWell.removeOne(strWellName);
m_mapFWell.remove(strWellName);
//
ui->tableWidget_2->removeColumn(column+1);//空白列,注意先删除空白列,否则列号改变
ui->tableWidget_2->removeColumn(column);
@ -5802,6 +5838,7 @@ void MainWindowCurve::slotDeleteSelectWell()
{
QString strWellName = ui->tableWidget_2->item(iCurrentRow, column)->text();
m_listWell.removeOne(strWellName);
m_mapFWell.remove(strWellName);
//
ui->tableWidget_2->removeColumn(column);
ui->tableWidget_2->removeColumn(column-1);//空白列,注意先删除选中列,否则列号改变

View File

@ -223,6 +223,7 @@ public slots:
public:
QAction* m_selectWellAc = nullptr; //选择井
QAction* m_fixwellsectionHeaderAc = nullptr; //锁头
QAction* m_opentemplateAc = nullptr; //加载图文件
QAction* m_saveastemplateAc = nullptr; //另存为图文件
QAction* m_zoominAc = nullptr; //放大
QAction* m_zoomoutAc = nullptr; //缩小
@ -312,6 +313,7 @@ public slots:
//
void s_selectWell(); //选择井
void s_showHeadTable(); //显示/隐藏图头
void s_Open(); //加载图文件
void s_Save(); //保存图文件
void s_SaveAsPicture(); //导出长图
void s_SaveAsPdf(); //导出PDF