From 2e478d3acbbada9783f84da5d784619bf6b71e9d Mon Sep 17 00:00:00 2001 From: jiayulong Date: Thu, 26 Feb 2026 18:49:59 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=AF=E6=8C=81=E5=8F=B3=E9=94=AE=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0/=E5=88=A0=E9=99=A4=E5=9B=BA=E4=BA=95=E7=BB=93?= =?UTF-8?q?=E8=AE=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- logPlus/TransparentDraggableGujing.cpp | 13 +----- logPlus/formdraw.cpp | 2 +- logPlus/qmycustomplot.cpp | 55 ++++++++++++++++++++++++++ logPlus/qmycustomplot.h | 3 ++ 4 files changed, 60 insertions(+), 13 deletions(-) diff --git a/logPlus/TransparentDraggableGujing.cpp b/logPlus/TransparentDraggableGujing.cpp index 78c5595..4137812 100644 --- a/logPlus/TransparentDraggableGujing.cpp +++ b/logPlus/TransparentDraggableGujing.cpp @@ -380,18 +380,7 @@ void TransparentDraggableGujing::onMousePress(QMouseEvent *event) //event->accept(); QMenu menu(nullptr); - QAction *delAction = menu.addAction("删除框图"); - //delAction->installEventFilter(this); - connect(delAction, &QAction::triggered, this, &TransparentDraggableGujing::onDelRect); - -// QAction* pItem = menu.exec(event->globalPos()); -// if(pItem == delAction) -// { -// //event->accept(); - -// int ii=0; -// ii++; -// } + menu.addAction(QIcon(::GetImagePath() + "icon/Delete.png"), "删除选中对象", this, &TransparentDraggableGujing::onDelRect); menu.exec(event->globalPos()); return; diff --git a/logPlus/formdraw.cpp b/logPlus/formdraw.cpp index 05f4ea9..07123ae 100644 --- a/logPlus/formdraw.cpp +++ b/logPlus/formdraw.cpp @@ -1096,7 +1096,7 @@ void FormDraw::s_delTableLine(QString strUuid, QString strWellName, QString strT if(form->m_strLineName == strLineName) { childWidget->deleteLater(); // 安排控件的删除,稍后执行 - m_listWaveName.removeOne(strLineName); + m_listTableName.removeOne(strLineName); //break; } } diff --git a/logPlus/qmycustomplot.cpp b/logPlus/qmycustomplot.cpp index 5f7ae7e..d155f11 100644 --- a/logPlus/qmycustomplot.cpp +++ b/logPlus/qmycustomplot.cpp @@ -877,6 +877,14 @@ void QMyCustomPlot::contextMenuEvent(QContextMenuEvent *event) menu.exec(event->globalPos()); } + if (m_strLineName == "GUJING1_RESULT" || m_strLineName == "GUJING2_RESULT" || m_strLineName == "GUJING3_RESULT") + { + QMenu menu(this); + //固井 + menu.addAction(QIcon(::GetImagePath() + "curve.png"), "添加固井结论", this, &QMyCustomPlot::onEditGujing); + menu.exec(event->globalPos()); + } + // QAction *resetAction = menu.addAction("添加框图"); // connect(resetAction, &QAction::triggered, this, &QMyCustomPlot::onAddRect); @@ -1001,6 +1009,53 @@ void QMyCustomPlot::onEditLine() } } +//右键--添加固井 +void QMyCustomPlot::onEditGujing() +{ + this->setInteractions(QCP::iSelectAxes | QCP::iSelectLegend | QCP::iSelectPlottables | QCP::iMultiSelect); // 轴、图例、图表可以被选择,并且是多选的方式 + this->setSelectionRectMode(QCP::srmCustom); // 鼠标框选 + + if(m_bFirstTimeConnect) + { + //信号槽只绑定一次,避免重复绑定 + m_bFirstTimeConnect = false; + + for (int i=0; i < this->graphCount(); ++i) { + QCPGraph *graph = this->graph(i); + graph->setSelectable(QCP::stDataRange); + break; + } + + connect(this->selectionRect(), &QCPSelectionRect::accepted, [this](){ + if(this->m_bDrawRect == false) + { + this->m_bDrawRect = true; + return; + } + // 当选择完成时,获取矩形范围并放大 + QRectF rect = this->selectionRect()->rect(); // 获取选择的矩形区域(像素坐标) + m_bEditRect=true;//当前是否正在编辑曲线。 + + // 转换为坐标轴范围 + double top = rect.top(); + double bottom = rect.bottom(); + + double right_Hight = this->xAxis->pixelToCoord(top); + double left_Low = this->xAxis->pixelToCoord(bottom); + + { + //添加固井结论 + this->addGujingToPlot(left_Low, right_Hight, ::GetGujingSymbolDir());//left_Low, right_Hight + + //取消框选 + this->setInteractions(QCP::iSelectLegend | QCP::iSelectPlottables); + this->setSelectionRectMode(QCP::srmNone); + } + }); + + } +} + void QMyCustomPlot::onAddRect() { double right_Hight = xAxis->pixelToCoord(m_event->pos().y());//x轴展示深度 diff --git a/logPlus/qmycustomplot.h b/logPlus/qmycustomplot.h index 7ac3287..390c7ea 100644 --- a/logPlus/qmycustomplot.h +++ b/logPlus/qmycustomplot.h @@ -222,6 +222,9 @@ public slots: //右键--编辑曲线 void onEditLine(); + //右键--编辑固井 + void onEditGujing(); + //执行校正 void s_RuncorFromPlot(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName);