From 8b1520c162292c6c4afa96fc28e8c8004cd65746 Mon Sep 17 00:00:00 2001 From: "DESKTOP-450PEFP\\mainc" Date: Wed, 15 Apr 2026 14:23:53 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=B3=A2=E5=88=97=E9=97=AE?= =?UTF-8?q?=E9=A2=98=EF=BC=8C=E6=B7=BB=E5=8A=A0=E6=98=BE=E7=A4=BA=E5=BC=82?= =?UTF-8?q?=E5=B8=B8=EF=BC=8C=E6=B3=A2=E5=88=97=E9=9A=90=E8=97=8F=E7=BD=91?= =?UTF-8?q?=E6=A0=BC=E7=BB=98=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- logPlus/formdraw.cpp | 44 +++++++-------------------------- logPlus/logplus.vcxproj | 5 ++++ logPlus/logplus.vcxproj.filters | 15 +++++++++++ logPlus/qmycustomplot.cpp | 38 +++++++++++----------------- 4 files changed, 43 insertions(+), 59 deletions(-) diff --git a/logPlus/formdraw.cpp b/logPlus/formdraw.cpp index 7a763ec..f033378 100644 --- a/logPlus/formdraw.cpp +++ b/logPlus/formdraw.cpp @@ -3067,45 +3067,19 @@ void FormDraw::s_addWave(QString strUuid, QString strSlfName, QString strWellNam QMyCustomPlot *curv = new QMyCustomPlot(this, strSlfName, strWellName, strTrackName, strWaveName); //绑定m_formTrack,方便关联formInfo curv->m_formTrack = m_formTrack; - curv->m_strUuid = m_strUuid; + curv->m_bRowGridVisible = false; + curv->m_bColGridVisible = false; + curv->setScaleX(0, 264); + curv->setDepthY(m_iY1, m_iY2); + double nW = m_nTrackW; + if (nW <= 0) + nW = g_iOneWidth; + curv->initGeometry(m_strUuid, m_iScale, nW); + curv->m_bX2Y = false; - //背景设置成透明色 - curv->setBackground(Qt::transparent); - curv->setStyleSheet("background: transparent;"); - // - //QRect rect = this->rect(); - //curv->setGeometry(rect.left(),rect.top(), rect.width(), rect.height()); - - double dHight = 0; - dHight = (m_iY2-m_iY1)*100.0/(double)m_iScale * g_dPixelPerCm; - if(g_iShow==1) - { - //显示刻度 - dHight = dHight+30; - } - - qDebug() << "FormDraw dHight=" << QString::number((int)dHight); - if(dHight>32767) - { - dHight = 32767; - } - - //curv->setMaximumHeight((int)dHight); - //curv->setViewport(QRect(0, 0, g_iOneWidth, (int)dHight));//7500-3184 - double nW = m_nTrackW; - if (nW < 0) - nW = g_iOneWidth; - curv->setGeometry(0, 0, nW, (int)dHight);//7500-3184 - - - //curv->resize(INT_MAX, INT_MAX); // 使用 INT_MAX 来避免16位整数的限制 - // QSizePolicy policy(QSizePolicy::Expanding, QSizePolicy::Expanding); - // curv->setSizePolicy(policy); curv->show(); - curv->m_iY1 = m_iY1; - curv->m_iY2 = m_iY2; int _nSamples = 0; if(g_iSupport3D) { diff --git a/logPlus/logplus.vcxproj b/logPlus/logplus.vcxproj index 22ec5b3..c5aa8b2 100644 --- a/logPlus/logplus.vcxproj +++ b/logPlus/logplus.vcxproj @@ -11,6 +11,7 @@ + @@ -29,6 +30,7 @@ + @@ -99,6 +101,7 @@ + @@ -137,6 +140,7 @@ + @@ -185,6 +189,7 @@ + {BE733E79-9D41-44C5-A0A3-048959EE70A0} diff --git a/logPlus/logplus.vcxproj.filters b/logPlus/logplus.vcxproj.filters index 8822ab4..4142fa6 100644 --- a/logPlus/logplus.vcxproj.filters +++ b/logPlus/logplus.vcxproj.filters @@ -74,6 +74,9 @@ common + + Header Files + @@ -262,6 +265,9 @@ Header Files + + Header Files + @@ -480,6 +486,12 @@ Source Files + + Source Files + + + Source Files + @@ -547,5 +559,8 @@ Form Files + + Form Files + \ No newline at end of file diff --git a/logPlus/qmycustomplot.cpp b/logPlus/qmycustomplot.cpp index ebc8ace..b30db1d 100644 --- a/logPlus/qmycustomplot.cpp +++ b/logPlus/qmycustomplot.cpp @@ -43,6 +43,13 @@ QMyCustomPlot::QMyCustomPlot(QWidget *parent, QString strSlfName, QString strWel m_strTrackName = strTrackName; m_strLineName = strLineName; + // 创建一个新的顶层图层(如果还没有) + if (!this->layer("topLayer")) { + this->addLayer("topLayer"); + } + // 移动这个图层到所有图层的最上方 + this->moveLayer(this->layer("topLayer"), this->layer("grid")); // -1 表示移动到列表末尾,即最顶层 + FormDraw* pFormDw = qobject_cast(parent); if (pFormDw) { @@ -356,31 +363,9 @@ void QMyCustomPlot::initWave(QString strSlfName, QString strWaveName) } delete[] value; - - float f = 264 / 269.0f; - // m_iY1 = 0.0 -_EDep; - // m_iY2 = 0.0 -_SDep; - //------------------------ - widget->m_iY1 = m_iY1; - widget->m_iY2 = m_iY2; // if (!widget->m_bX2Y) { - widget->xAxis->setRange(vmin, vmax); - widget->yAxis->setRange(m_iY1, m_iY2); - widget->axisRect()->setupFullAxesBox(); - // - widget->xAxis->ticker()->setTickCount(10);//x个主刻度 - widget->yAxis->ticker()->setTickCount(60);//y个主刻度 - - widget->xAxis->setTicks(false); - widget->yAxis->setTicks(false); - widget->xAxis2->setTicks(false); - widget->yAxis2->setTicks(false); - widget->xAxis->setTickLabels(false); - widget->yAxis->setTickLabels(false); - widget->xAxis2->setTickLabels(false); - widget->xAxis2->setTickLabels(false); widget->xAxis->setVisible(false); widget->xAxis2->setVisible(false); widget->yAxis->setVisible(false); @@ -394,7 +379,7 @@ void QMyCustomPlot::initWave(QString strSlfName, QString strWaveName) widget->m_bX2Y = true; } widget->m_fmin = vmin; - widget->m_fmax = vmax * f; + widget->m_fmax = vmax; //------------------- // set up the QCPColorMap: @@ -640,7 +625,8 @@ QCPColorMap * QMyCustomPlot::updateWave() int ny = m_nSamples; m_colorMap->data()->setSize(nx, ny); // 我们希望彩色地图有nx*ny的数据点 - m_colorMap->data()->setRange(QCPRange(0 - m_EDep, 0 - m_SDep), QCPRange(this->m_fmin, this->m_fmax)); + float f = 264 / 269.0f; + m_colorMap->data()->setRange(QCPRange(0 - m_EDep, 0 - m_SDep), QCPRange(this->m_iX1, this->m_iX2*f)); for (int xIndex = 0; xIndex < nx; ++xIndex) { @@ -675,6 +661,7 @@ QCPColorMap * QMyCustomPlot::updateWave() m_colorMap->data()->setCell(nx - xIndex - 1, yIndex, dz); } } + //m_colorMap->setDataRange(QCPRange(m_fmin, m_fmax)); return m_colorMap; } @@ -10122,6 +10109,8 @@ void QMyCustomPlot::setScaleX(float fx1, float fx2) pGline->point1->setCoords(fx1, -1);//位置 pGline->point2->setCoords(fx1, -2);//位置 m_vecColGrid << pGline; + + pGline->setLayer("topLayer"); } } @@ -10191,6 +10180,7 @@ void QMyCustomPlot::drawGrid(bool b) pGline->point1->setCoords(1, -nabs1);//位置 pGline->point2->setCoords(2, -nabs1);//位置 } + pGline->setLayer("topLayer"); m_vecRowGrid << pGline; } }