1.加载可视解释模版,批量曲线没有加载显示问题。

2,修改不锁头的情况下,拖拽滚动条渲染问题。
This commit is contained in:
DESKTOP-450PEFP\mainc 2026-06-17 14:05:32 +08:00
parent 4d51f38aae
commit 22ded03dcb
11 changed files with 159 additions and 37 deletions

View File

@ -25,7 +25,7 @@ signals:
void sig_Open();
void sig_ResizeHeight(QString strUuid, int nHei);
void sig_ResizeDepth(QString strUuid, int nHei, float fDepthLowerY);
void sig_ResizeDepth(QString strUuid, int nHei, float fDepthUpperY, float fDepthLowerY);
void sig_Risize();
void sig_AddOne();
void sig_AddLine(int indexID);

View File

@ -197,7 +197,7 @@ void FormDraw::setDrawData(QStringList listdt, QJsonObject objInfo)
curv->setDepthY(m_iY1, m_iY2);
curv->initGeometry(m_strUuid, m_iScale, dW);
// ===== 性能优化: 开启批量模式, 推迟 replot 到 DisplayLines 完成 =====
curv->beginBatchLoad();
//curv->beginBatchLoad();
curv->show();
if ("tdtObject" == strType)
@ -3252,7 +3252,7 @@ QMyCustomPlot* FormDraw::addTableLine(QString strUuid, QString strSlfName, QStri
curv->setDepthY(m_iY1, m_iY2);
curv->initGeometry(m_strUuid, m_iScale, m_nTrackW);
// ===== 性能优化: 开启批量模式, 推迟 replot =====
curv->beginBatchLoad();
//curv->beginBatchLoad();
curv->show();
if (strLineName == "FRAC_HOLE.TABLE")
@ -3566,7 +3566,7 @@ void FormDraw::s_addLine(QString strUuid, QString strSlfName, QString strWellNam
}
//
QMyCustomPlot *curv = new QMyCustomPlot(this, strSlfName, strWellName, strTrackName, strLineName);
QMyCustomPlot *curv = new QMyCustomPlot(this, strSlfName, strWellName, strTrackName, strLineName, "curveObject");
//绑定m_formTrack方便关联formInfo
curv->m_formTrack = m_formTrack;
m_curv = curv;
@ -3605,10 +3605,10 @@ void FormDraw::s_AddLine_Property(QString strUuid, QString strSlfName, QString s
}
//
QMyCustomPlot *curv = new QMyCustomPlot(this, strSlfName, strWellName, strTrackName, strLineName);
QMyCustomPlot *curv = new QMyCustomPlot(this, strSlfName, strWellName, strTrackName, strLineName, "curveObject");
//绑定m_formTrack方便关联formInfo
curv->m_formTrack = m_formTrack;
curv->beginBatchLoad();
//curv->beginBatchLoad();
curv->show();
initForm(curv, strSlfName, strLineName,
newLeftScale, newRightScale, strScaleType, lineColor, width, lineStyle, listOtherProperty);
@ -5118,7 +5118,7 @@ void FormDraw::initForm(QMyCustomPlot *widget, QString strSlfName, QString strLi
widget->yAxis->setScaleType(QCPAxis::stLinear);
}
// 加入曲线列表
m_vecCurv << widget;
//m_vecCurv << widget;
if (m_formTrack == NULL)
return;

View File

@ -33,7 +33,7 @@ FormImage::FormImage(QWidget *parent, QString strSlfName, QString strWellName, Q
//connect(CallManage::getInstance(), SIGNAL(sig_vertScrollBarChanged_santu_Print(QString, int, int)), this, SLOT(vertScrollBarChanged_Print(QString, int, int)));
connect(CallManage::getInstance(), SIGNAL(sig_vertScrollBarChanged(QString, double, double, double)), this, SLOT(vertScrollBarChanged(QString, double, double, double)));
connect(CallManage::getInstance(), SIGNAL(sig_vertScrollBarChanged_setGeometry(QString, double, double, double, double)), this, SLOT(vertScrollBarChanged_setGeometry(QString, double, double, double, double)));
connect(CallManage::getInstance(), SIGNAL(sig_ResizeDepth(QString, int, float)), this, SLOT(s_ResizeDepth(QString, int, float)));
connect(CallManage::getInstance(), SIGNAL(sig_ResizeDepth(QString, int, float, float)), this, SLOT(s_ResizeDepth(QString, int, float, float)));
//黑白图
connect(CallManage::getInstance(), SIGNAL(sig_changeBlack(QString, bool)), this, SLOT(s_changeBlack(QString, bool)));
}
@ -293,14 +293,14 @@ void FormImage::paintEvent(QPaintEvent*)
}
void FormImage::s_ResizeDepth(QString strUuid, int nHeight, float fDepthLowerY)
void FormImage::s_ResizeDepth(QString strUuid, int nHeight, float fDepthUpperY, float fDepthLowerY)
{
if (m_strUuid != strUuid)
return;
this->setFixedHeight(nHeight);
//m_fTopY = fDepthUpperY;
this->setFixedHeight(nHeight * m_nbb);
m_fDepthLowerY = qAbs(fDepthLowerY);
m_fAddY = m_fDepthLowerY - m_fTopY;
m_fAddY = (m_fDepthLowerY - m_fTopY) * m_nbb;
}
void FormImage::s_changeBlack(QString strUuid, bool bBlack)

View File

@ -95,6 +95,7 @@ public:
float m_fDepthLowerY = 0.0f;
float m_fAddY = 29.0f;
int m_nbb = 3;
int schemIndex = 1;
int colornum = 256;
// 黑白图
@ -103,7 +104,7 @@ public:
//void DrawWave(QPainter* pdc, QRectF mrt1);
public slots:
void s_ResizeDepth(QString strUuid, int nHeight, float fDepthLowerY);
void s_ResizeDepth(QString strUuid, int nHeight, float fDepthUpperY, float fDepthLowerY);
// 黑白图
void s_changeBlack(QString strUuid, bool bBlack);

View File

@ -49,7 +49,7 @@ FormWave::FormWave(QWidget *parent, QString strSlfName, QString strWellName, QSt
//connect(CallManage::getInstance(), SIGNAL(sig_vertScrollBarChanged_santu_Print(QString, int, int)), this, SLOT(vertScrollBarChanged_Print(QString, int, int)));
connect(CallManage::getInstance(), SIGNAL(sig_vertScrollBarChanged(QString, double, double, double)), this, SLOT(vertScrollBarChanged(QString, double, double, double)));
connect(CallManage::getInstance(), SIGNAL(sig_vertScrollBarChanged_setGeometry(QString, double, double, double, double)), this, SLOT(vertScrollBarChanged_setGeometry(QString, double, double, double, double)));
connect(CallManage::getInstance(), SIGNAL(sig_ResizeDepth(QString, int, float)), this, SLOT(s_ResizeDepth(QString, int, float)));
connect(CallManage::getInstance(), SIGNAL(sig_ResizeDepth(QString, int, float, float)), this, SLOT(s_ResizeDepth(QString, int, float, float)));
//黑白图
connect(CallManage::getInstance(), SIGNAL(sig_changeBlack(QString, bool)), this, SLOT(s_changeBlack(QString, bool)));
}
@ -96,6 +96,8 @@ void FormWave::setDepthY(float fy1, float fy2)
void FormWave::updateDepthY(float fy1, float fy2)
{
qDebug() << "FormWave::updateDepthY->" << fy1 << ":" << fy2;
this->m_iY1 = fy1;
this->m_iY2 = fy2;
m_fTopY = qAbs(this->m_iY2);
@ -316,14 +318,14 @@ void FormWave::paintEvent(QPaintEvent*)
}
void FormWave::s_ResizeDepth(QString strUuid, int nHeight, float fDepthLowerY)
void FormWave::s_ResizeDepth(QString strUuid, int nHeight, float fDepthUpperY, float fDepthLowerY)
{
if (m_strUuid != strUuid)
return;
this->setFixedHeight(nHeight);
//m_fTopY = qAbs(fDepthUpperY);
this->setFixedHeight(nHeight*m_nbb);
m_fDepthLowerY = qAbs(fDepthLowerY);
m_fAddY = m_fDepthLowerY - m_fTopY;
m_fAddY = (m_fDepthLowerY - m_fTopY) * m_nbb;
}
void FormWave::s_changeBlack(QString strUuid, bool bBlack)
@ -525,8 +527,6 @@ void FormWave::DrawWave(QPainter* pdc, QRectF mrt1)
float ddep = (y1 - y0);
rt = mrt;
QRectF rtd = mrt;
QRectF tt;
if (m_flRlev2 <= 0) m_flRlev2 = 0.1;
int Mode = m_pInfo->m_nCurveMode;// objViewInfo->GetLogarithmic();
//objViewInfo->m_Rlev = waveinfo.DepLevel;

View File

@ -95,6 +95,7 @@ public:
float m_fDepthLowerY = 0.0f;
float m_fAddY = 19.0f;
int m_nbb = 3;
int schemIndex = 1;
int colornum = 256;
// 黑白图
@ -103,7 +104,7 @@ public:
//void DrawWave(QPainter* pdc, QRectF mrt1);
public slots:
void s_ResizeDepth(QString strUuid, int nHeight, float fDepthLowerY);
void s_ResizeDepth(QString strUuid, int nHeight, float fDepthUpperY, float fDepthLowerY);
// 黑白图
void s_changeBlack(QString strUuid, bool bBlack);
//斜井三图一表

View File

@ -751,6 +751,7 @@ int FormWell::setColWidth_ZoomIn(float fNewZoom)
return iWellWidth;
}
void FormWell::setWellProperty(QVariantList listVal)
{
QString strGroup = listVal.at(0).toString();
@ -772,7 +773,7 @@ void FormWell::setWellProperty(QVariantList listVal)
ui->tableWidget->hideRow(0);
ui->tableWidget->update();
}
//m_pMainWinCurve->SetScrollBar_Geometry();
m_pMainWinCurve->SetScrollBar_Geometry();
}
return;
}

View File

@ -258,7 +258,7 @@ void MainWindow::initTitleBar()
{
QMenuBar* m_MenuBar = this->menuBar();
m_MenuBar->setStyleSheet("QMenuBar{font-size: 10.5pt; min-height:28px;}");
m_MenuBar->hide();
//m_MenuBar->hide();
//
QMenu* m_projectMenu = this->menuBar()->addMenu(tr("工区管理(&F)"));
//添加子菜单

View File

@ -394,8 +394,9 @@ void MainWindowCurve::SetScrollBar_Geometry_ByHand()
m_iTableSize_Head2 = iTableSize_Head2;
m_nObjLayerH = m_iTableSize_Head2;
double topDep = getVisibleTopDepth();
m_dBottomDepth = this->getVisibleBottomDepth();
emit CallManage::getInstance()->sig_ResizeDepth(m_strUuid, m_nObjDrawH, m_dBottomDepth);
emit CallManage::getInstance()->sig_ResizeDepth(m_strUuid, m_nObjDrawH, topDep, m_dBottomDepth);
ui->verticalScrollBar_2->setRange(0, iTableSize_Head_Biggest - iTableSize_Head);
ui->verticalScrollBar_2->setValue(0);
@ -534,8 +535,9 @@ MainWindowCurve::~MainWindowCurve()
void MainWindowCurve::resizeEvent(QResizeEvent *event)
{
double topDep = getVisibleTopDepth();
m_dBottomDepth = this->getVisibleBottomDepth();
emit CallManage::getInstance()->sig_ResizeDepth(m_strUuid, m_nObjDrawH, m_dBottomDepth);
emit CallManage::getInstance()->sig_ResizeDepth(m_strUuid, m_nObjDrawH, topDep, m_dBottomDepth);
emit sig_resizeWindow();
@ -640,6 +642,7 @@ void MainWindowCurve::vertScrollBarChanged(int iValue)
{
double value = (double)iValue/100;
qDebug() << "#MainWindowCurve::vertScrollBarChanged " << value;
//AppendConsole(PAI_INFO, "鼠标滚动开始");
double low = -m_iY1;
double upper = -m_iY2;
@ -696,6 +699,7 @@ void MainWindowCurve::vertScrollBarChanged(int iValue)
{
iNumShow++;
}
if(m_iCurPage == iNumShow)
{
double iCurValue = dDelta - (double)(iNumShow-1)*dScrollHeight;
@ -753,6 +757,12 @@ void MainWindowCurve::vertScrollBarChanged(int iValue)
emit CallManage::getInstance()->sig_vertScrollBarChanged(m_strUuid, iCurValue, -m_iY1, -m_iY2);//(iNumShow-1)*dScrollHeight_setGeometry
// 修复滚动跳动: 翻页时同步发送 setGeometry 信号
double iCurValue_setGeom = dDelta - (double)(iNumShow-1)*dScrollHeight;
if (m_iCurPage == 1)
{
int iTableWellTrack_height = ui->tableWidget_2->rowHeight(0) + (5) + iTableSize_Head - 1;
double headerDepth = (double)iTableWellTrack_height * (double)m_iScale / (100.0 * g_dPixelPerCm); // 米
iCurValue_setGeom = /*dDelta -*/ headerDepth;// / (abs(m_iY1) - abs(m_iY2));
}
emit CallManage::getInstance()->sig_vertScrollBarChanged_setGeometry(m_strUuid, iCurValue_setGeom, dScrollHeight_setGeometry, 0, value);
}
else if(value==upper)
@ -778,31 +788,127 @@ void MainWindowCurve::vertScrollBarChanged(int iValue)
emit CallManage::getInstance()->sig_vertScrollBarChanged_setGeometry(m_strUuid, 0, dScrollHeight_setGeometry, 0, value);
}
//if (!m_fixwellsectionHeaderAc->isChecked())
//{
// double topDep = getVisibleTopDepth();
// m_dBottomDepth = this->getVisibleBottomDepth();
// qDebug() << " ## getVisibleTopDepth==" << topDep;
// //emit CallManage::getInstance()->sig_ResizeDepth(m_strUuid, m_nObjDrawH, topDep, m_dBottomDepth);
//}
//通知界面重设范围(三图一表)
emit CallManage::getInstance()->sig_vertScrollBarChanged_santuyibiao(m_strUuid, value, -m_iY1, -m_iY2);
//AppendConsole(PAI_INFO, "鼠标滚动结束");
}
// 获取 centralwidget 可视区域顶部深度(米)
// 原理:滚动条值 value = -(当前顶部深度), 即 topDepth = -value
double MainWindowCurve::getVisibleTopDepth() const
// 深度坐标约定:
// m_iY1 负值表示深端(如 -1000 = 1000mm_iY2 负值表示浅端(如 0 = 0m
// verticalScrollBar range = [0, 100000]value 越大表示越深
// topDepth(米) = value / 100正数
double MainWindowCurve::getVisibleTopDepth()
{
double value = (double)ui->verticalScrollBar->value() / 100.0;
return -value; // 顶部深度(浅端,较小值)
if (!m_fixwellsectionHeaderAc->isChecked())
{
// 不锁头模式:直接用 tableWidget_2 的实际滚动位置计算
// 不依赖外层 value 和 tableWidget_2 滚动之间的映射关系
if (m_iCurPage > 1)
{
// 第2页以上外层 value 直接是该页起始深度,已验证正确
return value;
}
else
{
// 第1页用外层滚动条 value 直接计算,不依赖 tableWidget_2 内部滚动
// 不锁头第1页时value 就是可视区域顶部的深度
// 当头部iTableWellTrack_height还在可视区域内时数据区顶部深度 = upper
// 当头部滚出后,数据区顶部深度随滚动增加
double upper = (double)(-m_iY2);
double value = (double)ui->verticalScrollBar->value() / 100.0;
// 使用与 vertScrollBarChanged 中相同的头部高度计算
int iTableSize_Head = 100 + m_nObjLayerH;
if(!m_bShowTrackHead)
{
iTableSize_Head = m_nObjLayerH;
}
int headerPx = ui->tableWidget_2->rowHeight(0) + 5 + iTableSize_Head - 1;
double headerDepth = (double)headerPx * (double)m_iScale / (100.0 * g_dPixelPerCm); // 米
double scrollOffset = value - upper; // 从最浅端开始的滚动深度(米)
if (scrollOffset <= headerDepth)
{
// 头部还在可见区域,数据区顶部 = 最浅端(头部遮挡了数据区顶部)
return upper;
}
else
{
// 头部已滚出,数据区顶部 = 最浅端 + (scrollOffset - headerDepth)
double result = upper + (scrollOffset - headerDepth);
return result;
}
}
}
// 锁头模式value 直接是顶部深度
return value;
}
// 获取 centralwidget 可视区域底部深度(米)
// 原理bottomDepth = topDepth + 可视高度(深度单位)
// 同时更新 m_nObjDrawH 为精确的绘图区域像素高度(扣除可见头部
double MainWindowCurve::getVisibleBottomDepth()
{
double value = (double)ui->verticalScrollBar->value() / 100.0;
double topDepth = -value;
double topDepth = getVisibleTopDepth();
if (!m_fixwellsectionHeaderAc->isChecked() && m_iCurPage <= 1)
{
// 不锁头第1页精确计算可见绘图区域的深度范围
// 需扣除当前仍可见的头部像素,因为头部不显示数据
QRect rect2 = ui->centralwidget->geometry();
int left = 0, top = 0, right = 0, bottom = 0;
if (ui->centralwidget->layout())
ui->centralwidget->layout()->getContentsMargins(&left, &top, &right, &bottom);
// 使用与 vertScrollBarChanged 中相同的头部高度计算
int iTableSize_Head = 100 + m_nObjLayerH;
if(!m_bShowTrackHead)
{
iTableSize_Head = m_nObjLayerH;
}
int headerPx = ui->tableWidget_2->rowHeight(0) + 5 + iTableSize_Head - 1;
double headerDepth = (double)headerPx * (double)m_iScale / (100.0 * g_dPixelPerCm); // 米
double value = (double)ui->verticalScrollBar->value() / 100.0;
double upper = (double)(-m_iY2);
double scrollOffset = value - upper; // 从最浅端开始的滚动深度(米)
int screenDrawPx = rect2.height() - 10 - top - bottom - 4;
double screenDrawDepth = (double)screenDrawPx * (double)m_iScale / (100.0 * g_dPixelPerCm); // 米
// 道头还有多少深度没滚出
double remainingHeaderDepth = qMax(0.0, headerDepth - scrollOffset);
// 屏幕上可见的道头深度(不超过屏幕深度)
double visibleHeaderDepth = qMin(screenDrawDepth, remainingHeaderDepth);
// 数据区实际显示深度
double dataDepthRange = qMax(0.0, screenDrawDepth - visibleHeaderDepth);
// m_nObjDrawH 是像素值,由 dataDepthRange 转回像素
m_nObjDrawH = (int)(dataDepthRange * 100.0 * g_dPixelPerCm / (double)m_iScale);
// qDebug() << "#getVisibleBottomDepth[page1]: value=" << value
// << "scrollOffset=" << scrollOffset
// << "headerPx=" << headerPx
// << "headerDepth=" << headerDepth
// << "visibleHeaderDepth=" << visibleHeaderDepth
// << "dataDepthRange=" << dataDepthRange
// << "m_nObjDrawH=" << m_nObjDrawH;
return topDepth + dataDepthRange;
}
int iScreenHeight = getScreenHeight();
// iScreenHeight 单位是 0.01m除以100转为米
double visibleDepthRange = (double)iScreenHeight / 100.0;
return topDepth - visibleDepthRange;
return topDepth + visibleDepthRange;
}
int MainWindowCurve::getScreenHeight()
@ -4614,8 +4720,9 @@ void MainWindowCurve::s_hvDraw()
{
restoreOriginalCentralWidget();
}
double topDep = getVisibleTopDepth();
m_dBottomDepth = this->getVisibleBottomDepth();
emit CallManage::getInstance()->sig_ResizeDepth(m_strUuid, m_nObjDrawH, m_dBottomDepth);
emit CallManage::getInstance()->sig_ResizeDepth(m_strUuid, m_nObjDrawH, topDep, m_dBottomDepth);
}
//显示/隐藏图头
@ -4729,6 +4836,10 @@ void MainWindowCurve::s_showHeadTable()
}
double topDep = getVisibleTopDepth();
m_dBottomDepth = this->getVisibleBottomDepth();
emit CallManage::getInstance()->sig_ResizeDepth(m_strUuid, m_nObjDrawH, topDep, m_dBottomDepth);
}
QJsonObject MainWindowCurve::makeJson()
@ -6317,8 +6428,9 @@ void MainWindowCurve::s_changeDepth(QString strUuid, QString strSlfName, QString
//设置高度
//jyl ui->tableWidget_2->setRowHeight(1, (int)dHightOne);
double topDep = getVisibleTopDepth();
m_dBottomDepth = this->getVisibleBottomDepth();
emit CallManage::getInstance()->sig_ResizeDepth(m_strUuid, m_nObjDrawH, m_dBottomDepth);
emit CallManage::getInstance()->sig_ResizeDepth(m_strUuid, m_nObjDrawH, topDep, m_dBottomDepth);
//
progressBar->deleteLater();
//update();
@ -7187,6 +7299,7 @@ void MainWindowCurve::ShowTableHead_All()
int iTableSize_Head1 = 0;
int iTableSize_Head2 = 0;
getTableSize_Head_Biggest(iTableSize_Head_Biggest, iTableSize_Head1, iTableSize_Head2);
m_nObjLayerH = iTableSize_Head_Biggest - iTableSize_Head1;
//
int columnCount = ui->tableWidget_2->columnCount();//总列数
for(int i=0; i<columnCount; i++)

View File

@ -42,7 +42,7 @@ public:
void getTableSize_Head_Biggest(int &iHight, int &iHight1, int &iHight2);//展开FormIndo后获取真正的高度最大值
void setTableSize_Well();
// 获取 centralwidget 可视区域顶部/底部深度(米)
double getVisibleTopDepth() const;
double getVisibleTopDepth();
double getVisibleBottomDepth();
// 获取绘图区域显示厘米
int getScreenHeight();

View File

@ -66,7 +66,11 @@ QMyCustomPlot::QMyCustomPlot(QWidget *parent, QString strSlfName, QString strWel
m_cuPen = m_formDraw->m_cuPen;
m_zhongPen = m_formDraw->m_zhongPen;
m_xiPen = m_formDraw->m_xiPen;
m_formDraw->addCusPlot(this);
if (m_strType == "curveObject")
{
m_formDraw->addCusPlot(this);
}
}
mSizeHandleManager = new QCPSizeHandleManager(this);
@ -10819,6 +10823,7 @@ void QMyCustomPlot::setDepthY(float fy1, float fy2)
void QMyCustomPlot::updateDepthY(float fy1, float fy2)
{
qDebug() << "QMyCustomPlot::updateDepthY->" << fy1 << ":" << fy2;
this->m_iY1 = fy1;
this->m_iY2 = fy2;
m_fTopY = fy2;
@ -12349,6 +12354,7 @@ void QMyCustomPlot::vertScrollBarChanged(QString strUuid, double value, double l
{
return;
}
qDebug() << " ##############vertScrollBarChanged " << low << "," << upper;
// NOTE: 不在此处 setGeometry(0,0,...), 由 vertScrollBarChanged_setGeometry 统一管理位置
FormInfo* pInfo = m_formTrack->getFormInfoByParameters(m_strUuid, m_strWellName, m_strTrackName, m_strLineName);
if (pInfo == NULL)