From d9afdd2a058dca4f69b05b0e5c8556603b9ba5fd Mon Sep 17 00:00:00 2001 From: jiayulong Date: Mon, 3 Nov 2025 18:14:56 +0800 Subject: [PATCH] =?UTF-8?q?1.=E6=9B=B2=E7=BA=BF=E7=B1=BB=E5=9E=8B=E6=94=AF?= =?UTF-8?q?=E6=8C=81=E5=AF=B9=E6=95=B0=E6=9B=B2=E7=BA=BF=202.=E6=94=AF?= =?UTF-8?q?=E6=8C=81=E5=8F=B3=E5=A1=AB=E5=85=85=203.=E5=9B=BE=E5=A4=B4?= =?UTF-8?q?=E6=94=AF=E6=8C=81=E4=BB=8Eexcel=E5=A4=8D=E5=88=B6=E7=B2=98?= =?UTF-8?q?=E8=B4=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CallManage/CallManage.h | 4 +- logPlus/PropertyWidget.cpp | 24 +- logPlus/formdraw.cpp | 60 ++--- logPlus/forminfo.cpp | 24 +- logPlus/forminfo.h | 6 +- logPlus/logPlus.pro | 3 + logPlus/mainwindowcurve.cpp | 329 +++++++++++++++++++++++++- logPlus/mainwindowcurve.h | 20 +- logPlus/mainwindowcurve.ui | 8 +- logPlus/newheaddialog.cpp | 34 +++ logPlus/newheaddialog.h | 26 +++ logPlus/newheaddialog.ui | 110 +++++++++ logPlus/qmycustomplot.cpp | 453 +++++++++++++++++++++++++----------- logPlus/qmycustomplot.h | 14 +- 14 files changed, 919 insertions(+), 196 deletions(-) create mode 100644 logPlus/newheaddialog.cpp create mode 100644 logPlus/newheaddialog.h create mode 100644 logPlus/newheaddialog.ui diff --git a/CallManage/CallManage.h b/CallManage/CallManage.h index 36c09fc..4748154 100644 --- a/CallManage/CallManage.h +++ b/CallManage/CallManage.h @@ -49,6 +49,8 @@ signals: void sig_ChangeLeftScale(QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, double newLeftScale); //右刻度 void sig_ChangeRightScale(QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, double newRightScale); + //刻度类型 + void sig_ChangeScaleType(QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, QString strScaleType); //线颜色 void sig_ChangeLineColor(QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, QColor lineColor); @@ -61,7 +63,7 @@ signals: //岩性填充-填充 void sig_ChangeFillMode(QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, QString newFillType, QString newTargetLine, QColor newColor, QString newLithosImage, QString newHeadFill, - float vMin, float vMax, QColor frontColor, QColor backColor); + float vMin, float vMax, QColor frontColor, QColor backColor, QString newFillMode); //置顶层 void sig_Raise(QString strSlfName, QString strWellName, QString strTrackName, QString strLineName); diff --git a/logPlus/PropertyWidget.cpp b/logPlus/PropertyWidget.cpp index ebe9672..909d4fd 100644 --- a/logPlus/PropertyWidget.cpp +++ b/logPlus/PropertyWidget.cpp @@ -121,6 +121,16 @@ void PropertyWidget::SlotPropertyChanged( QtProperty *pProperty, const QVariant ChangFillProperty(); } } + else if("刻度类型" == m_propertyData[pProperty]) + { + qDebug() << "刻度类型->改变"; + //当前属性类型 + if(m_strCurrentProperty == Curve_Property) + { + QString newScaleType = pProperty->valueText(); + emit CallManage::getInstance()->sig_ChangeScaleType(m_strSlfName, m_strWellName, m_strTrackName, m_strLineName, newScaleType); + } + } else if("颜色" == m_propertyData[pProperty]) { qDebug() << "颜色->改变"; @@ -365,11 +375,11 @@ void PropertyWidget::ChangFillProperty() { emit CallManage::getInstance()->sig_ClearFillMode(m_strSlfName, m_strWellName, m_strTrackName, m_strLineName); } - else if(newFillMode=="填充") + else //if(newFillMode=="填充") { emit CallManage::getInstance()->sig_ChangeFillMode(m_strSlfName, m_strWellName, m_strTrackName, m_strLineName, newFillType, newTargetLine, newColor, newLithosImage, newHeadFill, - vMin, vMax, frontColor, backColor); + vMin, vMax, frontColor, backColor, newFillMode); } } @@ -525,8 +535,13 @@ void PropertyWidget::initCurveProperty(FormInfo *formInfo, QStringList strListOt // QStringList listFillMode; listFillMode.append("无填充"); - listFillMode.append("填充"); - + listFillMode.append("左填充"); + listFillMode.append("右填充"); + listFillMode.append("左右填充"); + // + QStringList listScaleType; + listScaleType.append("线性"); + listScaleType.append("对数"); // _CreateVariantPropertyItem("通常", "井曲线", strLineName + "@"+strSlfName, QVariant::String); @@ -535,6 +550,7 @@ void PropertyWidget::initCurveProperty(FormInfo *formInfo, QStringList strListOt // _CreateVariantPropertyItem("刻度设置", "左刻度", vmin, QVariant::Double); _CreateVariantPropertyItem("刻度设置", "右刻度", vmax, QVariant::Double); + _CreateEnumPropertyItem("刻度设置", "刻度类型", 0, listScaleType); // _CreateVariantPropertyItem("曲线线型", "线宽", dWidth, QVariant::Double, 1, 20); _CreateVariantPropertyItem("曲线线型", "颜色", lineColor, QVariant::Color); diff --git a/logPlus/formdraw.cpp b/logPlus/formdraw.cpp index c27f391..a1e5c10 100644 --- a/logPlus/formdraw.cpp +++ b/logPlus/formdraw.cpp @@ -377,40 +377,40 @@ void FormDraw::s_handleRectRangeChange(QCPRange newRange) void FormDraw::setupLineStyleDemo(QMyCustomPlot *customPlot) { - customPlot->legend->setVisible(true); - customPlot->legend->setFont(QFont("Helvetica", 9)); - QPen pen; - QStringList lineNames; - lineNames << "lsNone" << "lsLine" << "lsStepLeft" << "lsStepRight" << "lsStepCenter" << "lsImpulse"; +// customPlot->legend->setVisible(true); +// customPlot->legend->setFont(QFont("Helvetica", 9)); +// QPen pen; +// QStringList lineNames; +// lineNames << "lsNone" << "lsLine" << "lsStepLeft" << "lsStepRight" << "lsStepCenter" << "lsImpulse"; - for (int i = QCPGraph::lsNone; i <= QCPGraph::lsImpulse; ++i) - { - customPlot->addGraph(); - pen.setColor(QColor(qSin(i*1+1.2)*80+80, qSin(i*0.3+0)*80+80, qSin(i*0.3+1.5)*80+80)); - customPlot->graph()->setPen(pen); // 设置图表的画笔 - customPlot->graph()->setName(lineNames.at(i-QCPGraph::lsNone)); - customPlot->graph()->setLineStyle((QCPGraph::LineStyle)i); // 设置图表线段的风格 - customPlot->graph()->setScatterStyle(QCPScatterStyle(QCPScatterStyle::ssCircle, 5)); // 设置图表散点图的样式 +// for (int i = QCPGraph::lsNone; i <= QCPGraph::lsImpulse; ++i) +// { +// customPlot->addGraph(); +// pen.setColor(QColor(qSin(i*1+1.2)*80+80, qSin(i*0.3+0)*80+80, qSin(i*0.3+1.5)*80+80)); +// customPlot->graph()->setPen(pen); // 设置图表的画笔 +// customPlot->graph()->setName(lineNames.at(i-QCPGraph::lsNone)); +// customPlot->graph()->setLineStyle((QCPGraph::LineStyle)i); // 设置图表线段的风格 +// customPlot->graph()->setScatterStyle(QCPScatterStyle(QCPScatterStyle::ssCircle, 5)); // 设置图表散点图的样式 - QVector x(15), y(15); - for (int j=0; j<15; ++j) - { - x[j] = j/15.0 * 5*3.14 + 0.01; - y[j] = 7*qSin(x[j])/x[j] - (i-QCPGraph::lsNone)*5 + (QCPGraph::lsImpulse)*5 + 2; - } - customPlot->graph()->setData(x, y); - customPlot->graph()->rescaleAxes(true); - } - // 放大一点 - customPlot->yAxis->scaleRange(1.1, customPlot->yAxis->range().center()); - customPlot->xAxis->scaleRange(1.1, customPlot->xAxis->range().center()); +// QVector x(15), y(15); +// for (int j=0; j<15; ++j) +// { +// x[j] = j/15.0 * 5*3.14 + 0.01; +// y[j] = 7*qSin(x[j])/x[j] - (i-QCPGraph::lsNone)*5 + (QCPGraph::lsImpulse)*5 + 2; +// } +// customPlot->graph()->setData(x, y); +// customPlot->graph()->rescaleAxes(true); +// } +// // 放大一点 +// customPlot->yAxis->scaleRange(1.1, customPlot->yAxis->range().center()); +// customPlot->xAxis->scaleRange(1.1, customPlot->xAxis->range().center()); - customPlot->xAxis->setTicks(true); - customPlot->yAxis->setTicks(true); - customPlot->xAxis->setTickLabels(true); - customPlot->yAxis->setTickLabels(true); +// customPlot->xAxis->setTicks(true); +// customPlot->yAxis->setTicks(true); +// customPlot->xAxis->setTickLabels(true); +// customPlot->yAxis->setTickLabels(true); - customPlot->axisRect()->setupFullAxesBox(); +// customPlot->axisRect()->setupFullAxesBox(); } void FormDraw::setupSelectionDemo(QMyCustomPlot *customPlot) diff --git a/logPlus/forminfo.cpp b/logPlus/forminfo.cpp index 85fbf0d..e2ab9d2 100644 --- a/logPlus/forminfo.cpp +++ b/logPlus/forminfo.cpp @@ -39,6 +39,8 @@ FormInfo::FormInfo(QWidget *parent, QString strSlfName, QString strWellName, QSt connect(CallManage::getInstance(), SIGNAL(sig_ChangeLeftScale(QString, QString, QString, QString, double)), this, SLOT(s_ChangeLeftScale(QString, QString, QString, QString, double))); //右刻度 connect(CallManage::getInstance(), SIGNAL(sig_ChangeRightScale(QString, QString, QString, QString, double)), this, SLOT(s_ChangeRightScale(QString, QString, QString, QString, double))); + //刻度类型 + connect(CallManage::getInstance(), SIGNAL(sig_ChangeScaleType(QString, QString, QString, QString, QString)), this, SLOT(s_ChangeScaleType(QString, QString, QString, QString, QString))); //颜色 connect(CallManage::getInstance(), SIGNAL(sig_ChangeLineColor(QString, QString, QString, QString, QColor)), this, SLOT(s_ChangeLineColor(QString, QString, QString, QString, QColor))); @@ -49,8 +51,8 @@ FormInfo::FormInfo(QWidget *parent, QString strSlfName, QString strWellName, QSt //岩性填充-不填充 connect(CallManage::getInstance(), SIGNAL(sig_ClearFillMode(QString, QString, QString, QString)), this, SLOT(s_ClearFillMode(QString, QString, QString, QString))); //岩性填充-填充 - connect(CallManage::getInstance(), SIGNAL(sig_ChangeFillMode(QString, QString, QString, QString, QString, QString, QColor, QString, QString, float, float, QColor, QColor)), - this, SLOT(s_ChangeFillMode(QString, QString, QString, QString, QString, QString, QColor, QString, QString, float, float, QColor, QColor))); + connect(CallManage::getInstance(), SIGNAL(sig_ChangeFillMode(QString, QString, QString, QString, QString, QString, QColor, QString, QString, float, float, QColor, QColor, QString)), + this, SLOT(s_ChangeFillMode(QString, QString, QString, QString, QString, QString, QColor, QString, QString, float, float, QColor, QColor, QString))); } @@ -101,7 +103,7 @@ void FormInfo::paintEvent(QPaintEvent* event) { painter.setBrush(Qt::NoBrush); } - else if(m_newFillMode=="填充" && m_newHeadFill == "绘制") + else //if(m_newFillMode=="填充" && m_newHeadFill == "绘制") { if(m_newFillType == "岩性模式") { @@ -320,6 +322,18 @@ void FormInfo::s_ChangeRightScale(QString strSlfName, QString strWellName, QStri } } +//属性-刻度类型 +void FormInfo::s_ChangeScaleType(QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, QString strScaleType) +{ + if(m_strSlfName == strSlfName && + m_strWellName == strWellName && + m_strTrackName == strTrackName && + m_strLineName == strLineName) + { + m_strScaleType = strScaleType; + } +} + //属性-颜色 void FormInfo::s_ChangeLineColor(QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, QColor lineColor) { @@ -375,14 +389,14 @@ void FormInfo::s_ClearFillMode(QString strSlfName, QString strWellName, QString //岩性填充-填充 void FormInfo::s_ChangeFillMode(QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, QString newFillType, QString newTargetLine, QColor newColor, QString newLithosImage, QString newHeadFill, - float vMin, float vMax, QColor frontColor, QColor backColor) + float vMin, float vMax, QColor frontColor, QColor backColor, QString newFillMode) { if(m_strSlfName == strSlfName && m_strWellName == strWellName && m_strTrackName == strTrackName && m_strLineName == strLineName) { - m_newFillMode = "填充"; + m_newFillMode = newFillMode;//"填充"; m_newHeadFill = newHeadFill; m_newFillType = newFillType; m_newColor = newColor; diff --git a/logPlus/forminfo.h b/logPlus/forminfo.h index 1eb5409..c690296 100644 --- a/logPlus/forminfo.h +++ b/logPlus/forminfo.h @@ -38,6 +38,9 @@ public slots: void s_ChangeLeftScale(QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, double newLeftScale); //右刻度 void s_ChangeRightScale(QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, double newRightScale); + //刻度类型 + void s_ChangeScaleType(QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, QString strScaleType); + //线颜色 void s_ChangeLineColor(QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, QColor lineColor); //线宽 @@ -49,7 +52,7 @@ public slots: //岩性填充-填充 void s_ChangeFillMode(QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, QString newFillType, QString newTargetLine, QColor newColor, QString newLithosImage, QString newHeadFill, - float vMin, float vMax, QColor frontColor, QColor backColor); + float vMin, float vMax, QColor frontColor, QColor backColor, QString newFillMode); public: QString m_strUuid; @@ -64,6 +67,7 @@ public: //X坐标 float m_vmax; float m_vmin; + QString m_strScaleType;//刻度类型(线性,对数) //岩性填充 QString m_newFillMode; diff --git a/logPlus/logPlus.pro b/logPlus/logPlus.pro index 38e44ba..4f4c0d1 100644 --- a/logPlus/logPlus.pro +++ b/logPlus/logPlus.pro @@ -50,6 +50,7 @@ SOURCES += \ mainwindowcurve.cpp \ mainwindownew.cpp \ mycustomplot.cpp \ + newheaddialog.cpp \ preqtablewidget.cpp \ qmycustomplot.cpp \ qmytablewidget.cpp \ @@ -86,6 +87,7 @@ HEADERS += \ mainwindowcurve.h \ mainwindownew.h \ mycustomplot.h \ + newheaddialog.h \ preqtablewidget.h \ qmycustomplot.h \ qmytablewidget.h \ @@ -110,6 +112,7 @@ FORMS += \ mainwindow.ui \ mainwindowcurve.ui \ mainwindownew.ui \ + newheaddialog.ui \ qtcenterwidgets.ui \ qtprojectwidgets.ui diff --git a/logPlus/mainwindowcurve.cpp b/logPlus/mainwindowcurve.cpp index 51cc67c..1021827 100644 --- a/logPlus/mainwindowcurve.cpp +++ b/logPlus/mainwindowcurve.cpp @@ -7,6 +7,7 @@ #include "qtcommonclass.h" #include #include +#include "newheaddialog.h" extern int g_iOneWidth; //道宽 extern QString g_prjname; @@ -16,6 +17,9 @@ extern int g_iY2; extern double g_dPixelPerCm;//每厘米像素数 extern int g_iScale; +extern int g_iRows; +extern int g_iCols; + MainWindowCurve::MainWindowCurve(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindowCurve) @@ -35,14 +39,18 @@ MainWindowCurve::MainWindowCurve(QWidget *parent) : //加载样式 loadStyle(":/qrc/qss/flatgray.css"); + //------------------------------------- ui->tableWidget->hide(); - ui->tableWidget_3->hide(); - // // ui->tableWidget->verticalHeader()->hide(); ui->tableWidget->horizontalHeader()->hide(); + // 设置右键菜单策略 + ui->tableWidget->setContextMenuPolicy(Qt::CustomContextMenu); + connect(ui->tableWidget, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(slotContextMenu(QPoint))); + // 在窗口构造函数中 + //ui->tableWidget->installEventFilter(this); - // + //------------------------------------- //ui->tableWidget_2->setFrameShape(QFrame::NoFrame); //设置无边框 //隐藏网格线 ui->tableWidget_2->setShowGrid(false); @@ -66,7 +74,8 @@ MainWindowCurve::MainWindowCurve(QWidget *parent) : // list << "" << "" << "" << ""; // ui->tableWidget->setHorizontalHeaderLabels(list); - //// + //------------------------------------- + ui->tableWidget_3->hide(); ui->tableWidget_3->verticalHeader()->hide(); ui->tableWidget_3->horizontalHeader()->hide(); @@ -106,7 +115,7 @@ void MainWindowCurve::initMainToolBar() m_saveAc = new QAction(newFileIcon, "保存", this); //m_openAc = new QAction(openFileIcon, "打开", this); - m_grepAc = new QAction(grepIcon, "锁头", this); + m_grepAc = new QAction(grepIcon, "图头", this); m_compileAc = new QAction(compileIcon, "加载图文件", this); m_runAc = new QAction(runIcon, "设置井", this); m_debugAc = new QAction(debugIcon, "撤销", this); @@ -125,6 +134,7 @@ void MainWindowCurve::initMainToolBar() connect(m_saveAc, &QAction::triggered, this, &MainWindowCurve::s_Save); //connect(m_openAc, &QAction::triggered, this, &MainWindowCurve::s_Open); + connect(m_grepAc, &QAction::triggered, this, &MainWindowCurve::s_showHeadTable); // connect(m_grepAc, &QAction::triggered, this, &MainWindow::s_Risize); // connect(m_compileAc, &QAction::triggered, this, &MainWindow::s_AddOne); @@ -246,6 +256,18 @@ void MainWindowCurve::s_Open(QString fileFull) } +//显示/隐藏图头 +void MainWindowCurve::s_showHeadTable() +{ + if(ui->tableWidget->isVisible()) + { + ui->tableWidget->hide(); + } + else { + ui->tableWidget->show(); + } +} + QJsonObject MainWindowCurve::makeJson() { // 创建根对象 @@ -322,7 +344,7 @@ void MainWindowCurve::s_NewWell(QString strWellName) if(i==0) { //设置高度 - ui->tableWidget->setRowHeight(i, 100); + ui->tableWidget_2->setRowHeight(i, 100); // QTableWidgetItem* item = new QTableWidgetItem(strWellName); item->setFlags(item->flags() & (~Qt::ItemIsEditable)); @@ -466,13 +488,13 @@ void MainWindowCurve::dragEnterEvent(QDragEnterEvent* event) else { event->ignore(); - QApplication::setOverrideCursor(Qt::ForbiddenCursor); // 设置鼠标为不可添加状态 + //QApplication::setOverrideCursor(Qt::ForbiddenCursor); // 设置鼠标为不可添加状态 } } void MainWindowCurve::dragMoveEvent(QDragMoveEvent* event) { - qDebug() << "MainWindowCurve dragMoveEvent"; + //qDebug() << "MainWindowCurve dragMoveEvent"; // 可以在这里更新鼠标的位置,根据位置判断是否可以放置 // ... @@ -518,3 +540,294 @@ void MainWindowCurve::dropEvent(QDropEvent* event) // 恢复鼠标光标 //QApplication::restoreOverrideCursor(); } + + +void MainWindowCurve::slotContextMenu(QPoint pos) +{ + if(ui->tableWidget->rowCount()==0 && ui->tableWidget->rowCount()==0) + { + QMenu menu(ui->tableWidget); + QAction *newAction = menu.addAction("新建图头"); + // 弹出菜单 + QAction *selectedAction = menu.exec(ui->tableWidget->mapToGlobal(pos)); + if (selectedAction == newAction) { + NewHeadDialog *dlg = new NewHeadDialog(this); + // + dlg->setAttribute(Qt::WA_DeleteOnClose);//关闭时,自动删除窗口对象 + int result = dlg->exec();//模态对话框 + if (result == QDialog::Accepted) { + // 处理用户点击了确定按钮的逻辑 + qDebug() << "Accepted="; + // + ui->tableWidget->clear(); + // + ui->tableWidget->setColumnCount(g_iCols); + ui->tableWidget->setRowCount(g_iRows); //动态设置行数 + for(int i=0; itableWidget->setItem(i, j, item); + } + } + + } + else if (result == QDialog::Rejected) { + // 处理用户点击了取消按钮的逻辑 + qDebug() << "Rejected="; + } + else { + // 处理其他情况的逻辑 + qDebug() << "other="; + } + } + } + else + { + QMenu menu(ui->tableWidget); + QAction *mergeAction = menu.addAction("合并表格"); + QAction *refreshAction = menu.addAction("拆分表格"); + QAction *deleteAction = menu.addAction("删除行"); + QAction *addAction = menu.addAction("添加行"); + + // 弹出菜单 + QAction *selectedAction = menu.exec(ui->tableWidget->mapToGlobal(pos)); + + if (selectedAction == mergeAction) { + qDebug() << "合并表格"; + slotMerge(); + } else if (selectedAction == deleteAction) { + //删除1行 + int row = ui->tableWidget->currentRow(); + ui->tableWidget->removeRow(row); + } else if (selectedAction == refreshAction) { + qDebug() << "拆分表格"; + slotSplit(); + } + } +} + +//合并 +void MainWindowCurve::slotMerge() +{ + QModelIndexList list = ui->tableWidget->selectionModel()->selectedIndexes(); + if (list.size() < 2) + { + QMessageBox::warning(this, "单元格合并", "所选中单元格中为单个单元格,无法合并", "确定"); + return; + } + + int topRow = 0; + int leftCol = 0; + int bottomRow = 0; + int rightCol = 0; + + QList selectRanges = ui->tableWidget->selectedRanges(); + + if (selectRanges.size() > 0) + { + topRow = selectRanges[0].topRow(); + leftCol = selectRanges[0].leftColumn(); + bottomRow = selectRanges[0].bottomRow(); + rightCol = selectRanges[0].rightColumn(); + } + for(auto range:selectRanges) + { + if(range.topRow() bottomRow) + bottomRow=range.bottomRow(); + if(range.rightColumn()>rightCol) + rightCol=range.rightColumn(); + } + + int rowSpan = (bottomRow - topRow) + 1; + int colSpan = (rightCol - leftCol) + 1; + ui->tableWidget->setSpan(topRow, leftCol, rowSpan, colSpan); +} + + +//拆分 +void MainWindowCurve::slotSplit() +{ + int row,col; + QList selectRanges = ui->tableWidget->selectedRanges(); + if (selectRanges.size() < 2) + { + QMessageBox::warning(this, "拆分表格失败", "单元格已是最小单位,不能再进行拆分", "确定"); + return; + } + QList selectItems = ui->tableWidget->selectedItems(); + if(selectItems.size()==0) + { + QMessageBox::warning(this, "拆分表格失败", "请先为表格设置元素item", "确定"); + return; + } + if(selectItems.size()>1) + { + QMessageBox::warning(this, "拆分表格失败", "非法选择", "确定"); + return; + } + for(auto item:selectItems) + { + row= item->row(); + col=item->column(); + } + + ui->tableWidget->setSpan(row, col, 1, 1); // 设置跨度为1 +} + +bool MainWindowCurve::eventFilter(QObject* obj, QEvent* event) +{ + if (obj == ui->tableWidget && event->type() == QEvent::KeyPress) { + QKeyEvent* keyEvent = static_cast(event); + if (keyEvent->matches(QKeySequence::Paste)) { + onPasteExcelData(); + return true; + } + } + return QMainWindow::eventFilter(obj, event); +} + +//复制粘贴事件 +void MainWindowCurve::keyPressEvent(QKeyEvent * event) +{ + //excel 行分是 "\n" ; 列分是 "\t" + if (event->matches(QKeySequence::Copy)) + { + copy(); + } + else if (event->matches(QKeySequence::Paste)) + { + Paste(); + } + else if (event->matches(QKeySequence::SelectAll)) + { + ui->tableWidget->selectAll(); + } + else + { + QWidget::keyPressEvent(event); + } +} + +void MainWindowCurve::copy() +{ + QMap> selMap;//行,列 + QList list = ui->tableWidget->selectedItems(); + if (list.count() <= 0) + return; + for (QTableWidgetItem* item : list) + { + int rowN = ui->tableWidget->row(item); + int colN = ui->tableWidget->column(item); + selMap[rowN].append(colN); + } + QString cpStr; + QMap>::iterator it = selMap.begin(); + while (it != selMap.end()) + { + for (int i = 0; i < (*it).count(); i++) + { + QTableWidgetItem* item = ui->tableWidget->item(it.key(), (*it).at(i)); + if (item) + { + cpStr.append(item->text().trimmed()); + } + if (i != (*it).count() - 1) + cpStr.append("\t"); + } + it++; + if (it != selMap.end()) + { + cpStr.append("\n"); + } + } + QApplication::clipboard()->setText(cpStr); +} + +void MainWindowCurve::Paste() +{ + QString pastText = QApplication::clipboard()->text(); + QStringList rowList = pastText.split("\n", QString::KeepEmptyParts); + if(rowList.size()==0) + { + return; + } + if(rowList.at(rowList.size()-1)=="") + { + rowList.removeAt(rowList.size()-1); + } + QTableWidgetItem* crtItem = ui->tableWidget->currentItem(); + int rowN, colN; + if (!crtItem) + { + rowN = ui->tableWidget->currentRow(); + colN = ui->tableWidget->currentColumn(); + } + else + { + rowN = ui->tableWidget->row(crtItem); + colN = ui->tableWidget->column(crtItem); + } + for (int i = 0; i < (ui->tableWidget->rowCount() - rowN) && (i < rowList.length()); i++) + { + QStringList rowDataList = rowList.at(i).split("\t", QString::KeepEmptyParts); + for (int j = 0; j < (ui->tableWidget->columnCount() - colN) && (j < rowDataList.length()); j++) + { + int x = i + rowN; + int y = j + colN; + + QTableWidgetItem* item = ui->tableWidget->item(x, y); + if (item) + { + item->setText(rowDataList.at(j)); + } + else + { + ui->tableWidget->setItem(x, y, new QTableWidgetItem(rowDataList.at(j))); + } + } + } +} + +void MainWindowCurve::onPasteExcelData() +{ + QClipboard* clipboard = QApplication::clipboard(); + const QString clipData = clipboard->text(); + + if (clipData.isEmpty()) return; + + QList rowsData; + const QStringList rows = clipData.split('\n', QString::SkipEmptyParts); + for (const QString row:rows) { + rowsData << row.split('\t', QString::SkipEmptyParts); + } + + QTableWidget* table = ui->tableWidget; + const QModelIndex currentIndex = table->currentIndex(); + const int startRow = currentIndex.isValid() ? currentIndex.row() : 0; + const int startCol = currentIndex.isValid() ? currentIndex.column() : 0; + + table->setUpdatesEnabled(false); + table->setRowCount(std::max(table->rowCount(), startRow + rowsData.size())); + table->setColumnCount(std::max(table->columnCount(), startCol + rowsData[0].size())); + + for (int i = 0; i < rowsData.size(); ++i) { + for (int j = 0; j < rowsData[i].size(); ++j) { + if (startRow + i >= table->rowCount()) break; + if (startCol + j >= table->columnCount()) break; + + QTableWidgetItem* item = table->item(startRow + i, startCol + j); + if (!item) { + item = new QTableWidgetItem(); + table->setItem(startRow + i, startCol + j, item); + } + item->setText(rowsData[i][j]); + } + } + table->setUpdatesEnabled(true); +} diff --git a/logPlus/mainwindowcurve.h b/logPlus/mainwindowcurve.h index 701fa5a..804efd0 100644 --- a/logPlus/mainwindowcurve.h +++ b/logPlus/mainwindowcurve.h @@ -22,11 +22,22 @@ public: private: Ui::MainWindowCurve *ui; +protected: + //支持复制粘贴,暂时还未实现 + void keyPressEvent(QKeyEvent * e); + +public: + //图头 + bool eventFilter(QObject* obj, QEvent* event); + void onPasteExcelData(); + public slots: void dragEnterEvent(QDragEnterEvent* event); void dragMoveEvent(QDragMoveEvent* event); void dropEvent(QDropEvent* event); - + //图头 + void copy(); + void Paste(); public: QString m_strUuid; QStringList m_listWell; @@ -62,6 +73,13 @@ public slots: // void s_Save();//保存 void s_Open(QString fileFull);//打开 + + + void s_showHeadTable();//显示/隐藏图头 + //图头右键菜单响应函数 + void slotContextMenu(QPoint pos); + void slotMerge();//合并 + void slotSplit();//拆分 }; #endif // MAINWINDOWCURVE_H diff --git a/logPlus/mainwindowcurve.ui b/logPlus/mainwindowcurve.ui index 0e9a187..bf66ac5 100644 --- a/logPlus/mainwindowcurve.ui +++ b/logPlus/mainwindowcurve.ui @@ -15,10 +15,14 @@ - + - + + + + + diff --git a/logPlus/newheaddialog.cpp b/logPlus/newheaddialog.cpp new file mode 100644 index 0000000..16c71dd --- /dev/null +++ b/logPlus/newheaddialog.cpp @@ -0,0 +1,34 @@ +#include "newheaddialog.h" +#include "ui_newheaddialog.h" + +int g_iRows=1; +int g_iCols=1; + +NewHeadDialog::NewHeadDialog(QWidget *parent) : + QDialog(parent), + ui(new Ui::NewHeadDialog) +{ + ui->setupUi(this); + + connect(ui->buttonBox, &QDialogButtonBox::accepted, this, &NewHeadDialog::accepted_OK); + connect(ui->buttonBox, &QDialogButtonBox::rejected, this, &NewHeadDialog::rejected_Cancel); +} + +NewHeadDialog::~NewHeadDialog() +{ + delete ui; +} + + +void NewHeadDialog::accepted_OK() +{ + g_iRows = ui->spinBox->value(); + g_iCols = ui->spinBox_2->value(); + // + accepted(); +} + +void NewHeadDialog::rejected_Cancel() +{ + reject(); +} diff --git a/logPlus/newheaddialog.h b/logPlus/newheaddialog.h new file mode 100644 index 0000000..469f8b5 --- /dev/null +++ b/logPlus/newheaddialog.h @@ -0,0 +1,26 @@ +#ifndef NEWHEADDIALOG_H +#define NEWHEADDIALOG_H + +#include + +namespace Ui { +class NewHeadDialog; +} + +class NewHeadDialog : public QDialog +{ + Q_OBJECT + +public: + explicit NewHeadDialog(QWidget *parent = nullptr); + ~NewHeadDialog(); + +private: + Ui::NewHeadDialog *ui; + +public slots: + void accepted_OK(); + void rejected_Cancel(); +}; + +#endif // NEWHEADDIALOG_H diff --git a/logPlus/newheaddialog.ui b/logPlus/newheaddialog.ui new file mode 100644 index 0000000..f7738d7 --- /dev/null +++ b/logPlus/newheaddialog.ui @@ -0,0 +1,110 @@ + + + NewHeadDialog + + + + 0 + 0 + 400 + 300 + + + + Dialog + + + + + + + + + + 表格行数: + + + Qt::AlignCenter + + + + + + + 1 + + + + + + + + + + + 表格列数: + + + Qt::AlignCenter + + + + + + + 1 + + + + + + + + + + + Qt::Horizontal + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + + + + + + buttonBox + accepted() + NewHeadDialog + accept() + + + 248 + 254 + + + 157 + 274 + + + + + buttonBox + rejected() + NewHeadDialog + reject() + + + 316 + 260 + + + 286 + 274 + + + + + diff --git a/logPlus/qmycustomplot.cpp b/logPlus/qmycustomplot.cpp index 23c64d9..c214df6 100644 --- a/logPlus/qmycustomplot.cpp +++ b/logPlus/qmycustomplot.cpp @@ -30,6 +30,8 @@ QMyCustomPlot::QMyCustomPlot(QWidget *parent, QString strSlfName, QString strWel connect(CallManage::getInstance(), SIGNAL(sig_ChangeLeftScale(QString, QString, QString, QString, double)), this, SLOT(s_ChangeLeftScale(QString, QString, QString, QString, double))); //右刻度 connect(CallManage::getInstance(), SIGNAL(sig_ChangeRightScale(QString, QString, QString, QString, double)), this, SLOT(s_ChangeRightScale(QString, QString, QString, QString, double))); + //刻度类型 + connect(CallManage::getInstance(), SIGNAL(sig_ChangeScaleType(QString, QString, QString, QString, QString)), this, SLOT(s_ChangeScaleType(QString, QString, QString, QString, QString))); connect(CallManage::getInstance(), SIGNAL(sig_Raise(QString, QString, QString, QString)), this, SLOT(s_Raise(QString, QString, QString, QString))); //颜色 @@ -41,8 +43,8 @@ QMyCustomPlot::QMyCustomPlot(QWidget *parent, QString strSlfName, QString strWel //岩性填充-不填充 connect(CallManage::getInstance(), SIGNAL(sig_ClearFillMode(QString, QString, QString, QString)), this, SLOT(s_ClearFillMode(QString, QString, QString, QString))); //岩性填充-填充 - connect(CallManage::getInstance(), SIGNAL(sig_ChangeFillMode(QString, QString, QString, QString, QString, QString, QColor, QString, QString, float, float, QColor, QColor)), - this, SLOT(s_ChangeFillMode(QString, QString, QString, QString, QString, QString, QColor, QString, QString, float, float, QColor, QColor))); + connect(CallManage::getInstance(), SIGNAL(sig_ChangeFillMode(QString, QString, QString, QString, QString, QString, QColor, QString, QString, float, float, QColor, QColor, QString)), + this, SLOT(s_ChangeFillMode(QString, QString, QString, QString, QString, QString, QColor, QString, QString, float, float, QColor, QColor, QString))); } @@ -192,7 +194,7 @@ void QMyCustomPlot::s_ChangeLeftScale(QString strSlfName, QString strWellName, Q //其他曲线 s_ChangeFillMode(m_strSlfName, m_strWellName, m_strTrackName, m_strLineName, m_newFillType, m_newTargetLine, m_newColor, m_newLithosImage, m_newHeadFill, - newLeftScale, m_vMax, m_frontColor, m_backColor); + newLeftScale, m_vMax, m_frontColor, m_backColor, m_newFillMode); } } @@ -217,7 +219,40 @@ void QMyCustomPlot::s_ChangeRightScale(QString strSlfName, QString strWellName, //其他曲线 s_ChangeFillMode(m_strSlfName, m_strWellName, m_strTrackName, m_strLineName, m_newFillType, m_newTargetLine, m_newColor, m_newLithosImage, m_newHeadFill, - m_vMin, newRightScale, m_frontColor, m_backColor); + m_vMin, newRightScale, m_frontColor, m_backColor, m_newFillMode); + } +} + +//属性-刻度类型 +void QMyCustomPlot::s_ChangeScaleType(QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, QString strScaleType) +{ + if(m_strSlfName == strSlfName && + m_strWellName == strWellName && + m_strTrackName == strTrackName && + m_strLineName == strLineName) + { + m_strScaleType = strScaleType; + + if(m_strScaleType=="线性") + { + yAxis->setScaleType(QCPAxis::stLinear); + } + else if(m_strScaleType=="对数") + { + yAxis->setScaleType(QCPAxis::stLogarithmic); + } + // + replot(); + } + else if(m_strSlfName == strSlfName && + m_strWellName == strWellName && + m_strTrackName == strTrackName && + m_newTargetLine == strLineName) + { + //其他曲线 + //s_ChangeFillMode(m_strSlfName, m_strWellName, m_strTrackName, m_strLineName, + // m_newFillType, m_newTargetLine, m_newColor, m_newLithosImage, m_newHeadFill, + // m_vMin, newRightScale, m_frontColor, m_backColor, m_newFillMode); } } @@ -291,7 +326,7 @@ void QMyCustomPlot::s_ClearFillMode(QString strSlfName, QString strWellName, QSt //岩性填充-填充 void QMyCustomPlot::s_ChangeFillMode(QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, QString newFillType, QString newTargetLine, QColor newColor, QString newLithosImage, QString newHeadFill, - float vMin, float vMax, QColor frontColor, QColor backColor) + float vMin, float vMax, QColor frontColor, QColor backColor, QString newFillMode) { if(m_strSlfName == strSlfName && @@ -309,6 +344,7 @@ void QMyCustomPlot::s_ChangeFillMode(QString strSlfName, QString strWellName, QS m_vMax = vMax; m_frontColor = frontColor; m_backColor = backColor; + m_newFillMode = newFillMode; //填充 if(this->graphCount() > 1) @@ -376,23 +412,280 @@ void QMyCustomPlot::s_ChangeFillMode(QString strSlfName, QString strWellName, QS } else { - //其他曲线(左填充) - CLogIO *logio=new CLogIO(); - logio->Open(strSlfName.toStdString().c_str(),CSlfIO::modeRead); + if(newFillMode=="左填充") + { + //其他曲线(左填充) + CLogIO *logio=new CLogIO(); + logio->Open(strSlfName.toStdString().c_str(),CSlfIO::modeRead); - //读取基线信息 - int indexBaseCurv = logio->OpenCurve(strLineName.toStdString().c_str()); - if(indexBaseCurv < 0) { - this->addGraph();//空曲线 - delete logio; + //读取基线信息 + int indexBaseCurv = logio->OpenCurve(strLineName.toStdString().c_str()); + if(indexBaseCurv < 0) { + this->addGraph();//空曲线 + delete logio; + } + else + { + //其他曲线 + int index=logio->OpenCurve(newTargetLine.toStdString().c_str()); + if(index<0) + { + this->addGraph();//空曲线 + delete logio; + } + else + { + Slf_CURVE curveinfo; + float *val; + float sdep,edep,rlev; + // + logio->GetCurveInfo(index,&curveinfo); + sdep=curveinfo.StartDepth; + edep=curveinfo.EndDepth; + rlev=curveinfo.DepLevel; + // + int count=(curveinfo.EndDepth-curveinfo.StartDepth)/curveinfo.DepLevel+1.5; + val=new float[count]; + logio->ReadCurve(index,curveinfo.StartDepth,count,&val[0]); + logio->CloseCurve(index); + //读完基线再关闭 + // delete logio; + + float newVal = 0.0; + for(int i=0; iReadCurve(indexBaseCurv, 0-x0, 1, &BaseY0); + // + if(i+1ReadCurve(indexBaseCurv, 0-x1, 1, &BaseY1); + + if(BaseY0<=y0 && BaseY1<=y1) + { + //基线在左,采用基线值 + //y0=BaseY0; + y0_old = (BaseY0-m_iX1)/(m_iX2-m_iX1)*(vMax-vMin) + vMin; + // + x.append(x0); + y.append(y0_old); + } + else if(BaseY0>=y0 && BaseY1>=y1) + { + //基线在右,直接赋值 + x.append(x0); + y.append(y0_old); + } + else if(BaseY0<=y0 && BaseY1>=y1) + { + //基线起点在左,采用基线值 + //y0=BaseY0; + y0_old = (BaseY0-m_iX1)/(m_iX2-m_iX1)*(vMax-vMin) + vMin; + // + x.append(x0); + y.append(y0_old); + + //插值 + float xNew=x0-rlev*(y0-BaseY0)/(BaseY1-y1); + float yNew=(y0-y1)/(x0-x1)*(xNew-x1) + y1; + float yNew_Old=(yNew-m_iX1)/(m_iX2-m_iX1)*(vMax-vMin) + vMin; + // + x.append(xNew); + y.append(yNew_Old); + } + else if(BaseY0>=y0 && BaseY1<=y1) + { + //基线在右,直接赋值 + x.append(x0); + y.append(y0_old); + + //插值 + float xNew=x0-rlev*(y0-BaseY0)/(BaseY1-y1); + float yNew=(BaseY0-BaseY1)/(x0-x1)*(xNew-x1) + BaseY1; + float yNew_Old=(yNew-m_iX1)/(m_iX2-m_iX1)*(vMax-vMin) + vMin; + // + x.append(xNew); + y.append(yNew_Old); + } + } + else + { + //最后一个点 + if(BaseY0CloseCurve(indexBaseCurv); + delete logio; + // + this->yAxis2->setRange(m_iY1, m_iY2); + this->xAxis2->setRange(vMin, vMax); + this->addGraph(yAxis2, xAxis2); + } + } } - else + else if(newFillMode=="右填充") + { + //其他曲线(右填充) + CLogIO *logio=new CLogIO(); + logio->Open(strSlfName.toStdString().c_str(),CSlfIO::modeRead); + + //读取基线信息 + int indexBaseCurv = logio->OpenCurve(strLineName.toStdString().c_str()); + if(indexBaseCurv < 0) { + this->addGraph();//空曲线 + delete logio; + } + else + { + //其他曲线 + int index=logio->OpenCurve(newTargetLine.toStdString().c_str()); + if(index<0) + { + this->addGraph();//空曲线 + delete logio; + } + else + { + Slf_CURVE curveinfo; + float *val; + float sdep,edep,rlev; + // + logio->GetCurveInfo(index,&curveinfo); + sdep=curveinfo.StartDepth; + edep=curveinfo.EndDepth; + rlev=curveinfo.DepLevel; + // + int count=(curveinfo.EndDepth-curveinfo.StartDepth)/curveinfo.DepLevel+1.5; + val=new float[count]; + logio->ReadCurve(index,curveinfo.StartDepth,count,&val[0]); + logio->CloseCurve(index); + //读完基线再关闭 + // delete logio; + + float newVal = 0.0; + for(int i=0; iReadCurve(indexBaseCurv, 0-x0, 1, &BaseY0); + // + if(i+1ReadCurve(indexBaseCurv, 0-x1, 1, &BaseY1); + + if(BaseY0<=y0 && BaseY1<=y1) + { + //基线在左,直接赋值 + x.append(x0); + y.append(y0_old); + } + else if(BaseY0>=y0 && BaseY1>=y1) + { + //基线在右,采用基线值 + //y0=BaseY0; + y0_old = (BaseY0-m_iX1)/(m_iX2-m_iX1)*(vMax-vMin) + vMin; + // + x.append(x0); + y.append(y0_old); + } + else if(BaseY0<=y0 && BaseY1>=y1) + { + //基线起点在左,直接赋值 + x.append(x0); + y.append(y0_old); + + //插值 + float xNew=x0-rlev*(y0-BaseY0)/(BaseY1-y1); + float yNew=(y0-y1)/(x0-x1)*(xNew-x1) + y1; + float yNew_Old=(yNew-m_iX1)/(m_iX2-m_iX1)*(vMax-vMin) + vMin; + // + x.append(xNew); + y.append(yNew_Old); + } + else if(BaseY0>=y0 && BaseY1<=y1) + { + //基线在右,采用基线值 + //y0=BaseY0; + y0_old = (BaseY0-m_iX1)/(m_iX2-m_iX1)*(vMax-vMin) + vMin; + // + x.append(x0); + y.append(y0_old); + + //插值 + float xNew=x0-rlev*(y0-BaseY0)/(BaseY1-y1); + float yNew=(BaseY0-BaseY1)/(x0-x1)*(xNew-x1) + BaseY1; + float yNew_Old=(yNew-m_iX1)/(m_iX2-m_iX1)*(vMax-vMin) + vMin; + // + x.append(xNew); + y.append(yNew_Old); + } + } + else + { + //最后一个点 + if(BaseY0>y0) + { + //基线在右,采用基线值 + //y0=BaseY0; + y0_old = (BaseY0-m_iX1)/(m_iX2-m_iX1)*(vMax-vMin) + vMin; + } + x.append(x0); + y.append(y0_old); + } + + //newVal = (m_iX2-m_iX1)*(val[i]-vMin)/(vMax-vMin) + m_iX1; + //newVal = val[i]; + //y.append(newVal); + } + logio->CloseCurve(indexBaseCurv); + delete logio; + // + this->yAxis2->setRange(m_iY1, m_iY2); + this->xAxis2->setRange(vMin, vMax); + this->addGraph(yAxis2, xAxis2); + } + } + } + else //填充 { //其他曲线 + CLogIO *logio=new CLogIO(); + logio->Open(strSlfName.toStdString().c_str(),CSlfIO::modeRead); int index=logio->OpenCurve(newTargetLine.toStdString().c_str()); if(index<0) { - this->addGraph();//空曲线 + this->addGraph(); + delete logio; } else @@ -410,148 +703,28 @@ void QMyCustomPlot::s_ChangeFillMode(QString strSlfName, QString strWellName, QS val=new float[count]; logio->ReadCurve(index,curveinfo.StartDepth,count,&val[0]); logio->CloseCurve(index); - //读完基线再关闭 -// delete logio; + delete logio; float newVal = 0.0; for(int i=0; iReadCurve(indexBaseCurv, 0-x0, 1, &BaseY0); - // - if(i+1ReadCurve(indexBaseCurv, 0-x1, 1, &BaseY1); - - if(BaseY0<=y0 && BaseY1<=y1) - { - //基线在左,采用基线值 - //y0=BaseY0; - y0_old = (BaseY0-m_iX1)/(m_iX2-m_iX1)*(vMax-vMin) + vMin; - // - x.append(x0); - y.append(y0_old); - } - else if(BaseY0>=y0 && BaseY1>=y1) - { - //基线在右,直接赋值 - x.append(x0); - y.append(y0_old); - } - else if(BaseY0<=y0 && BaseY1>=y1) - { - //基线起点在左,采用基线值 - //y0=BaseY0; - y0_old = (BaseY0-m_iX1)/(m_iX2-m_iX1)*(vMax-vMin) + vMin; - // - x.append(x0); - y.append(y0_old); - - //插值 - float xNew=x0-rlev*(y0-BaseY0)/(BaseY1-y1); - float yNew=(y0-y1)/(x0-x1)*(xNew-x1) + y1; - float yNew_Old=(yNew-m_iX1)/(m_iX2-m_iX1)*(vMax-vMin) + vMin; - // - x.append(xNew); - y.append(yNew_Old); - } - else if(BaseY0>=y0 && BaseY1<=y1) - { - //基线在右,直接赋值 - x.append(x0); - y.append(y0_old); - - //插值 - float xNew=x0-rlev*(y0-BaseY0)/(BaseY1-y1); - float yNew=(BaseY0-BaseY1)/(x0-x1)*(xNew-x1) + BaseY1; - float yNew_Old=(yNew-m_iX1)/(m_iX2-m_iX1)*(vMax-vMin) + vMin; - // - x.append(xNew); - y.append(yNew_Old); - } - } - else - { - //最后一个点 - if(BaseY0CloseCurve(indexBaseCurv); - delete logio; - // this->yAxis2->setRange(m_iY1, m_iY2); this->xAxis2->setRange(vMin, vMax); this->addGraph(yAxis2, xAxis2); } } } -// else -// { -// //其他曲线 -// CLogIO *logio=new CLogIO(); -// logio->Open(strSlfName.toStdString().c_str(),CSlfIO::modeRead); -// int index=logio->OpenCurve(newTargetLine.toStdString().c_str()); -// if(index<0) -// { -// this->addGraph(); -// delete logio; -// } -// else -// { -// Slf_CURVE curveinfo; -// float *val; -// float sdep,edep,rlev; -// // -// logio->GetCurveInfo(index,&curveinfo); -// sdep=curveinfo.StartDepth; -// edep=curveinfo.EndDepth; -// rlev=curveinfo.DepLevel; -// // -// int count=(curveinfo.EndDepth-curveinfo.StartDepth)/curveinfo.DepLevel+1.5; -// val=new float[count]; -// logio->ReadCurve(index,curveinfo.StartDepth,count,&val[0]); -// logio->CloseCurve(index); -// delete logio; - -// float newVal = 0.0; -// for(int i=0; iyAxis2->setRange(m_iY1, m_iY2); -// this->xAxis2->setRange(vMin, vMax); -// this->addGraph(yAxis2, xAxis2); -// } -// } this->graph(1)->setData(x, y); graph(1)->setLineStyle(graph(0)->lineStyle());//曲线 graph(1)->setScatterStyle(graph(0)->scatterStyle()); + //graph(1)->setPen(QColor(255, 255, 255)); graph(1)->setPen(QColor(0, 0, 0));//(graph(0)->pen()); // diff --git a/logPlus/qmycustomplot.h b/logPlus/qmycustomplot.h index bf999c2..c8eff84 100644 --- a/logPlus/qmycustomplot.h +++ b/logPlus/qmycustomplot.h @@ -27,8 +27,8 @@ public: QString m_strLineName; // - int m_iX1, m_iX2; - int m_iY1, m_iY2; + float m_iX1, m_iX2; + float m_iY1, m_iY2; //其他曲线 QString m_newFillType; @@ -37,9 +37,12 @@ public: QString m_newLithosImage; QString m_newHeadFill; float m_vMin; - float m_vMax; + float m_vMax; + QString m_strScaleType;//刻度类型(线性,对数) + QColor m_frontColor;//岩性前景色 QColor m_backColor;//岩性背景色 + QString m_newFillMode; QContextMenuEvent *m_event; @@ -61,6 +64,9 @@ public slots: void s_ChangeLeftScale(QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, double newLeftScale); //右刻度 void s_ChangeRightScale(QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, double newRightScale); + //刻度类型 + void s_ChangeScaleType(QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, QString strScaleType); + //线颜色 void s_ChangeLineColor(QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, QColor lineColor); //线宽 @@ -72,7 +78,7 @@ public slots: //岩性填充-填充 void s_ChangeFillMode(QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, QString newFillType, QString newTargetLine, QColor newColor, QString newLithosImage, QString newHeadFill, - float vMin, float vMax, QColor frontColor, QColor backColor); + float vMin, float vMax, QColor frontColor, QColor backColor, QString newFillMode); void onAddRect();