From d19f3888954a02143577275718fbfdedb8c58c23 Mon Sep 17 00:00:00 2001 From: crqiqi77 Date: Tue, 28 Apr 2026 15:26:55 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=B1=E5=BA=A6=E5=B1=9E=E6=80=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- logPlus/PropertyWidget.cpp | 59 ++--------------------------------- logPlus/formdraw.cpp | 63 +++++++++++++++++++++----------------- logPlus/formwell.cpp | 15 +++++++++ logPlus/qmycustomplot.cpp | 9 ++++-- 4 files changed, 60 insertions(+), 86 deletions(-) diff --git a/logPlus/PropertyWidget.cpp b/logPlus/PropertyWidget.cpp index 85b52d5..365348f 100644 --- a/logPlus/PropertyWidget.cpp +++ b/logPlus/PropertyWidget.cpp @@ -4273,8 +4273,6 @@ void PropertyWidget::initTubingItemProperty(TransparentDraggableGuan* tdGuan, do } } - - void PropertyWidget::changedDepthProperty(QString strProperty, QVariant varVal) { if ("显示单位" == strProperty) @@ -4342,66 +4340,15 @@ void PropertyWidget::changedDepthProperty(QString strProperty, QVariant varVal) } else if ("斜深位置" == strProperty) { - int temp = varVal.toInt(); - int newStyle = 0; - switch(temp) - { - case 0: - // 偏左 - newStyle = Qt::NoPen; - break; - case 1: - // 居中 - newStyle = Qt::SolidLine; - break; - case 2: - // 偏右 - newStyle = Qt::DashLine; - break; - } - this->m_formInfo->m_sdMeasuredDepthPosition = newStyle; + this->m_formInfo->m_sdMeasuredDepthPosition = varVal.toInt(); } else if ("垂深位置" == strProperty) { - int temp = varVal.toInt(); - int newStyle = 0; - switch(temp) - { - case 0: - // 偏左 - newStyle = Qt::NoPen; - break; - case 1: - // 居中 - newStyle = Qt::SolidLine; - break; - case 2: - // 偏右 - newStyle = Qt::DashLine; - break; - } - this->m_formInfo->m_sdVerticalDepthPosition = newStyle; + this->m_formInfo->m_sdVerticalDepthPosition = varVal.toInt(); } else if ("海拔垂深位置" == strProperty) { - int temp = varVal.toInt(); - int newStyle = 0; - switch(temp) - { - case 0: - // 偏左 - newStyle = Qt::NoPen; - break; - case 1: - // 居中 - newStyle = Qt::SolidLine; - break; - case 2: - // 偏右 - newStyle = Qt::DashLine; - break; - } - this->m_formInfo->m_sdElevationVerticalDepthPosition = newStyle; + this->m_formInfo->m_sdElevationVerticalDepthPosition = varVal.toInt(); } else if ("垂深" == strProperty) { diff --git a/logPlus/formdraw.cpp b/logPlus/formdraw.cpp index dfbeb8d..5b2ef27 100644 --- a/logPlus/formdraw.cpp +++ b/logPlus/formdraw.cpp @@ -197,38 +197,32 @@ void FormDraw::setDrawData(QStringList listdt, QJsonObject objInfo) curv->yAxis->setTicker(fixedTicker); // 标注字体 curv->yAxis->setTickLabelFont(pInfo->m_sdLabelFont); + curv->m_yAxis2->setTickLabelFont(pInfo->m_sdLabelFont); + curv->m_yAxis3->setTickLabelFont(pInfo->m_sdLabelFont); // 旋转(°) curv->yAxis->setTickLabelRotation(pInfo->m_sdRotationAngle); + curv->m_yAxis2->setTickLabelRotation(pInfo->m_sdRotationAngle); + curv->m_yAxis3->setTickLabelRotation(pInfo->m_sdRotationAngle); // 斜深 curv->yAxis->setTickLabels(pInfo->m_sdMeasuredDepth); // 海拔垂深 { bool temp = pInfo->m_sdElevationVerticalDepth; - if(!curv->m_yAxis2) - { - curv->m_yAxis2 = new QCPAxis(curv->axisRect(), QCPAxis::atLeft); - curv->axisRect()->addAxis(QCPAxis::atLeft, curv->m_yAxis2); - curv->m_yAxis2->setRange(0, 100); - curv->m_yAxis2->setOffset(40); - curv->m_yAxis2->setTickLabelPadding(10); - } + curv->m_yAxis2->setVisible(temp); curv->m_yAxis2->setTickLabels(temp); curv->m_yAxis2->setTickLabelSide(QCPAxis::lsInside); } // 垂深 bool temp2 = pInfo->m_sdVerticalDepth; - if(!curv->m_yAxis3) - { - curv->m_yAxis3 = new QCPAxis(curv->axisRect(), QCPAxis::atLeft); - curv->axisRect()->addAxis(QCPAxis::atLeft, curv->m_yAxis3); - curv->m_yAxis3->setRange(0, 100); - curv->m_yAxis3->setOffset(40); - curv->m_yAxis3->setTickLabelPadding(10); - } curv->m_yAxis3->setVisible(temp2); // 显示第三个Y轴 curv->m_yAxis3->setTickLabels(temp2); curv->m_yAxis3->setTickLabelSide(QCPAxis::lsInside); + + QSize size = curv->size(); // 包含宽高的QSize对象 + int width2 = size.width(); + int center = width2 / 2 - pInfo->m_sdLabelFont.pointSize(); + int right = width2 - pInfo->m_sdLabelFont.pointSize() - 5; // 斜深位置 switch(pInfo->m_sdMeasuredDepthPosition) { @@ -238,10 +232,10 @@ void FormDraw::setDrawData(QStringList listdt, QJsonObject objInfo) break; case 1: // 居中 - curv->yAxis->setTickLabelPadding(30); + curv->yAxis->setTickLabelPadding(center); break; case 2: - curv->yAxis->setTickLabelPadding(50); + curv->yAxis->setTickLabelPadding(right); break; } @@ -254,10 +248,10 @@ void FormDraw::setDrawData(QStringList listdt, QJsonObject objInfo) break; case 1: // 居中 - curv->m_yAxis3->setTickLabelPadding(30); + curv->m_yAxis3->setTickLabelPadding(center); break; case 2: - curv->m_yAxis3->setTickLabelPadding(50); + curv->m_yAxis3->setTickLabelPadding(right); break; } // 海拔垂深位置 @@ -269,10 +263,10 @@ void FormDraw::setDrawData(QStringList listdt, QJsonObject objInfo) break; case 1: // 居中 - curv->m_yAxis2->setTickLabelPadding(30); + curv->m_yAxis2->setTickLabelPadding(center); break; case 2: - curv->m_yAxis2->setTickLabelPadding(50); + curv->m_yAxis2->setTickLabelPadding(right); break; } // 主刻度线长度 @@ -5955,21 +5949,34 @@ void FormDraw::initGujing(QMyCustomPlot *widget, QString strSlfName, QString str void FormDraw::initDepth(QMyCustomPlot *curv) { - // x轴隐藏 curv->setScaleX(0, 1024); curv->yAxis->setTicks(true); curv->yAxis->setVisible(true); curv->yAxis->setBasePen(Qt::NoPen); - //curv->yAxis->setTickLabels(true); - curv->yAxis->setTickLabelSide(QCPAxis::lsInside); QFont font1("微软雅黑", 8); curv->yAxis->setTickLabelFont(font1); - //curv->yAxis->setRangeReversed(true); - - //curv->axisRect()->setupFullAxesBox(); curv->yAxis->ticker()->setTickCount(60);//y个主刻度 curv->m_bX2Y = false; + + if(!curv->m_yAxis2) + { + curv->m_yAxis2 = new QCPAxis(curv->axisRect(), QCPAxis::atLeft); + curv->axisRect()->addAxis(QCPAxis::atLeft, curv->m_yAxis2); + curv->m_yAxis2->setRange(0, 100); + curv->m_yAxis2->setOffset(40); + curv->m_yAxis2->setTickLabelPadding(10); + } + + if(!curv->m_yAxis3) + { + curv->m_yAxis3 = new QCPAxis(curv->axisRect(), QCPAxis::atLeft); + curv->axisRect()->addAxis(QCPAxis::atLeft, curv->m_yAxis3); + curv->m_yAxis3->setRange(0, 100); + curv->m_yAxis3->setOffset(40); + curv->m_yAxis3->setTickLabelPadding(10); + } + } void FormDraw::initFgrq(QMyCustomPlot *widget) diff --git a/logPlus/formwell.cpp b/logPlus/formwell.cpp index e9ef42b..855b34d 100644 --- a/logPlus/formwell.cpp +++ b/logPlus/formwell.cpp @@ -224,6 +224,21 @@ QVector FormWell::new_track(QStringList listdt, QString strTrackName) vec << trackTop; trackTop->m_strUuid = m_strUuid; trackTop->m_nTrackW = dW;// / static_cast(g_dPixelPerCm); + + + if(strTrackName.contains("深度")) + { + trackTop->m_nTrackW = 1.2; + QVariantList listCond; + listCond << strUuid; + listCond << strSlfName; + listCond << strWellName; + listCond << columnCount; + listCond << "道宽(cm)"; + listCond << "1.2"; + emit CallManage::getInstance()->sig_changeTrackProperty(listCond); + } + ui->tableWidget->setCellWidget(i, columnCount, trackTop); } else if(i==1) diff --git a/logPlus/qmycustomplot.cpp b/logPlus/qmycustomplot.cpp index fd66d59..ba76004 100644 --- a/logPlus/qmycustomplot.cpp +++ b/logPlus/qmycustomplot.cpp @@ -5400,6 +5400,11 @@ void QMyCustomPlot::s_changeDepthProperty(QVariantList vlist) } else if ("斜深位置" == strProperty) { + QSize size = this->size(); // 包含宽高的QSize对象 + int width2 = size.width(); + int center = width2 / 2 - this->yAxis->tickLabelFont().pointSize(); + int right = width2 - this->yAxis->tickLabelFont().pointSize() - 5; + // 没有直接设置偏移方法 动态计算太麻烦 int temp = varVal.toInt(); switch(temp) @@ -5410,10 +5415,10 @@ void QMyCustomPlot::s_changeDepthProperty(QVariantList vlist) break; case 1: // 居中 - this->yAxis->setTickLabelPadding(30); + this->yAxis->setTickLabelPadding(center); break; case 2: - this->yAxis->setTickLabelPadding(50); + this->yAxis->setTickLabelPadding(right); break; } }