支持右键添加/删除固井结论
This commit is contained in:
parent
4af6a26c1e
commit
2e478d3acb
|
|
@ -380,18 +380,7 @@ void TransparentDraggableGujing::onMousePress(QMouseEvent *event)
|
||||||
//event->accept();
|
//event->accept();
|
||||||
|
|
||||||
QMenu menu(nullptr);
|
QMenu menu(nullptr);
|
||||||
QAction *delAction = menu.addAction("删除框图");
|
menu.addAction(QIcon(::GetImagePath() + "icon/Delete.png"), "删除选中对象", this, &TransparentDraggableGujing::onDelRect);
|
||||||
//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.exec(event->globalPos());
|
menu.exec(event->globalPos());
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
|
|
@ -1096,7 +1096,7 @@ void FormDraw::s_delTableLine(QString strUuid, QString strWellName, QString strT
|
||||||
if(form->m_strLineName == strLineName)
|
if(form->m_strLineName == strLineName)
|
||||||
{
|
{
|
||||||
childWidget->deleteLater(); // 安排控件的删除,稍后执行
|
childWidget->deleteLater(); // 安排控件的删除,稍后执行
|
||||||
m_listWaveName.removeOne(strLineName);
|
m_listTableName.removeOne(strLineName);
|
||||||
//break;
|
//break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -877,6 +877,14 @@ void QMyCustomPlot::contextMenuEvent(QContextMenuEvent *event)
|
||||||
menu.exec(event->globalPos());
|
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("添加框图");
|
// QAction *resetAction = menu.addAction("添加框图");
|
||||||
// connect(resetAction, &QAction::triggered, this, &QMyCustomPlot::onAddRect);
|
// 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()
|
void QMyCustomPlot::onAddRect()
|
||||||
{
|
{
|
||||||
double right_Hight = xAxis->pixelToCoord(m_event->pos().y());//x轴展示深度
|
double right_Hight = xAxis->pixelToCoord(m_event->pos().y());//x轴展示深度
|
||||||
|
|
|
||||||
|
|
@ -222,6 +222,9 @@ public slots:
|
||||||
//右键--编辑曲线
|
//右键--编辑曲线
|
||||||
void onEditLine();
|
void onEditLine();
|
||||||
|
|
||||||
|
//右键--编辑固井
|
||||||
|
void onEditGujing();
|
||||||
|
|
||||||
//执行校正
|
//执行校正
|
||||||
void s_RuncorFromPlot(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName);
|
void s_RuncorFromPlot(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user