2025-10-29 17:23:30 +08:00
|
|
|
|
#include "formtrack.h"
|
|
|
|
|
|
#include "ui_formtrack.h"
|
|
|
|
|
|
#include <QDebug>
|
2025-11-05 14:03:27 +08:00
|
|
|
|
#include "CallManage.h"
|
2025-10-29 17:23:30 +08:00
|
|
|
|
|
2025-11-13 18:13:40 +08:00
|
|
|
|
extern int g_iOneWidth; //道宽
|
|
|
|
|
|
|
2025-10-29 17:23:30 +08:00
|
|
|
|
//曲线名称栏(表格)
|
|
|
|
|
|
FormTrack::FormTrack(QWidget *parent, QString strWellName, QString strTrackName) :
|
|
|
|
|
|
QWidget(parent),
|
|
|
|
|
|
ui(new Ui::FormTrack)
|
|
|
|
|
|
{
|
|
|
|
|
|
ui->setupUi(this);
|
|
|
|
|
|
|
|
|
|
|
|
m_strWellName = strWellName;
|
|
|
|
|
|
m_strTrackName = strTrackName;
|
|
|
|
|
|
|
2025-11-05 14:03:27 +08:00
|
|
|
|
//单元格委托
|
|
|
|
|
|
//m_delegate = new NoLRBorderDelegate();
|
|
|
|
|
|
//隐藏网格线
|
|
|
|
|
|
ui->tableWidget->setShowGrid(false);
|
|
|
|
|
|
//设置样式表,竖直边框宽度为0,隐藏
|
|
|
|
|
|
ui->tableWidget->setStyleSheet( "QTableView::item {border-left: 0px solid black;} \
|
|
|
|
|
|
QTableView::item:selected {border-left: 0px solid black;}\
|
|
|
|
|
|
QTableView::item {border-right: 0px solid black;} \
|
|
|
|
|
|
QTableView::item:selected {border-right: 0px solid black;}");
|
|
|
|
|
|
|
2025-10-29 17:23:30 +08:00
|
|
|
|
//表格绑定井名,道名
|
|
|
|
|
|
ui->tableWidget->m_strWellName = strWellName;
|
|
|
|
|
|
ui->tableWidget->m_strTrackName = strTrackName;
|
|
|
|
|
|
//
|
|
|
|
|
|
ui->tableWidget->verticalHeader()->hide();//隐藏左侧系统序号栏
|
|
|
|
|
|
ui->tableWidget->horizontalHeader()->hide();//隐藏上方系统序号栏
|
|
|
|
|
|
//因为tableWidget需要提前规定好行数与列数
|
|
|
|
|
|
int recordcount = 0; //总行数
|
|
|
|
|
|
ui->tableWidget->setColumnCount(1);//总列数
|
|
|
|
|
|
ui->tableWidget->setRowCount(recordcount); //动态设置行数
|
|
|
|
|
|
//设置所有列均匀分布并填充满整个空间
|
|
|
|
|
|
QHeaderView *header = ui->tableWidget->horizontalHeader();
|
|
|
|
|
|
for (int i = 0; i < ui->tableWidget->columnCount(); ++i) {
|
|
|
|
|
|
header->setSectionResizeMode(i, QHeaderView::Stretch);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-11-18 11:40:42 +08:00
|
|
|
|
//曲线
|
2025-11-06 17:34:31 +08:00
|
|
|
|
connect(this, SIGNAL(sig_AddLine(QString, QString, QString, QString, QString, QString, QColor, double, float, float, QString)),
|
|
|
|
|
|
this, SLOT(s_addLine(QString, QString, QString, QString, QString, QString, QColor, double, float, float, QString)));
|
2025-11-18 11:40:42 +08:00
|
|
|
|
//波列
|
|
|
|
|
|
connect(this, SIGNAL(sig_AddWave(QString, QString, QString, QString, QString, QString, QColor, double, float, float, QString)),
|
|
|
|
|
|
this, SLOT(s_addWave(QString, QString, QString, QString, QString, QString, QColor, double, float, float, QString)));
|
2025-10-29 17:23:30 +08:00
|
|
|
|
|
2025-11-26 16:56:00 +08:00
|
|
|
|
//波列
|
|
|
|
|
|
connect(this, SIGNAL(sig_AddTableLine(QString, QString, QString, QString, QString, QString, QColor, double, float, float, QString)),
|
|
|
|
|
|
this, SLOT(s_AddTableLine(QString, QString, QString, QString, QString, QString, QColor, double, float, float, QString)));
|
|
|
|
|
|
|
2025-11-05 14:03:27 +08:00
|
|
|
|
//曲线选中,置顶
|
|
|
|
|
|
connect(CallManage::getInstance(), SIGNAL(sig_Raise(QString, QString, QString, QString, QString)), this, SLOT(s_Raise(QString, QString, QString, QString, QString)));
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void FormTrack::s_Raise(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName)
|
|
|
|
|
|
{
|
|
|
|
|
|
if(m_strUuid == strUuid &&
|
|
|
|
|
|
m_strWellName == strWellName &&
|
|
|
|
|
|
m_strTrackName == strTrackName)
|
|
|
|
|
|
{
|
|
|
|
|
|
//
|
|
|
|
|
|
}
|
|
|
|
|
|
else {
|
|
|
|
|
|
//取消表格选中状态
|
|
|
|
|
|
ui->tableWidget->clearSelection();
|
|
|
|
|
|
}
|
2025-10-29 17:23:30 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
FormTrack::~FormTrack()
|
|
|
|
|
|
{
|
|
|
|
|
|
delete ui;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-11-18 11:40:42 +08:00
|
|
|
|
void FormTrack::Add(QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, QString strAliasName, QString strUnit, QColor lineColor, double dWidth, float vmax, float vmin, QString strScaleType, QString strType)
|
2025-10-29 17:23:30 +08:00
|
|
|
|
{
|
|
|
|
|
|
qDebug()<< "Add";
|
|
|
|
|
|
|
2025-11-18 11:40:42 +08:00
|
|
|
|
if(strType=="curveObject")
|
|
|
|
|
|
{
|
|
|
|
|
|
emit sig_AddLine(strSlfName, strWellName, m_strTrackName, strLineName, strAliasName, strUnit, lineColor, dWidth, vmax, vmin, strScaleType);
|
|
|
|
|
|
}
|
|
|
|
|
|
else if(strType=="waveObject")
|
|
|
|
|
|
{
|
|
|
|
|
|
emit sig_AddWave(strSlfName, strWellName, m_strTrackName, strLineName, strAliasName, strUnit, lineColor, dWidth, vmax, vmin, strScaleType);
|
|
|
|
|
|
}
|
2025-11-25 17:56:20 +08:00
|
|
|
|
else if(strType=="tableObject")
|
|
|
|
|
|
{
|
|
|
|
|
|
//新建表格曲线
|
|
|
|
|
|
emit sig_AddTableLine(strSlfName, strWellName, m_strTrackName, strLineName, strAliasName, strUnit, lineColor, dWidth, vmax, vmin, strScaleType);
|
|
|
|
|
|
}
|
2025-10-29 17:23:30 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2025-11-06 17:34:31 +08:00
|
|
|
|
void FormTrack::s_addLine(QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, QString strAliasName, QString strUnit, QColor lineColor, double dWidth, float vmax, float vmin, QString strScaleType)
|
2025-10-29 17:23:30 +08:00
|
|
|
|
{
|
|
|
|
|
|
qDebug() << "FormTrack s_addLine";
|
|
|
|
|
|
|
2025-11-04 14:44:14 +08:00
|
|
|
|
ui->tableWidget->m_strUuid = m_strUuid;
|
2025-10-29 17:23:30 +08:00
|
|
|
|
int row = ui->tableWidget->rowCount();
|
|
|
|
|
|
ui->tableWidget->setRowCount(row + 1);
|
|
|
|
|
|
|
2025-11-13 18:13:40 +08:00
|
|
|
|
//避免出现小滚动条
|
|
|
|
|
|
//ui->tableWidget->resize(g_iOneWidth, 100*(row + 1)+10);
|
|
|
|
|
|
//this->resize(g_iOneWidth, 100*(row + 1)+30);
|
|
|
|
|
|
|
2025-10-29 17:23:30 +08:00
|
|
|
|
//曲线信息栏
|
|
|
|
|
|
FormInfo *formInfo = new FormInfo(this, strSlfName, strWellName, strTrackName, strLineName, lineColor);
|
2025-11-04 14:44:14 +08:00
|
|
|
|
formInfo->m_strUuid = m_strUuid;
|
2025-11-06 17:34:31 +08:00
|
|
|
|
formInfo->m_strAliasName = strAliasName;
|
|
|
|
|
|
formInfo->m_strUnit = strUnit;
|
2025-11-06 14:43:37 +08:00
|
|
|
|
formInfo->m_strScaleType = strScaleType;
|
2025-11-18 11:40:42 +08:00
|
|
|
|
formInfo->m_strType = "curveObject";
|
2025-10-29 17:23:30 +08:00
|
|
|
|
formInfo->setLineWidth(dWidth);
|
|
|
|
|
|
formInfo->setVMax(vmax);
|
|
|
|
|
|
formInfo->setVMin(vmin);
|
2025-10-31 17:56:50 +08:00
|
|
|
|
formInfo->setFrontColor(QColor(0,0,0));
|
|
|
|
|
|
formInfo->setBackColor(QColor(255,255,255));
|
2025-10-29 17:23:30 +08:00
|
|
|
|
//设置高度
|
|
|
|
|
|
ui->tableWidget->setRowHeight(row, 100);
|
2025-11-05 14:03:27 +08:00
|
|
|
|
//单元格委托
|
|
|
|
|
|
//ui->tableWidget->setItemDelegateForRow(row, m_delegate);
|
2025-10-29 17:23:30 +08:00
|
|
|
|
//
|
|
|
|
|
|
ui->tableWidget->setCellWidget(row, 0, formInfo);
|
|
|
|
|
|
|
2025-11-05 14:03:27 +08:00
|
|
|
|
|
2025-10-29 17:23:30 +08:00
|
|
|
|
//------------------------------------
|
|
|
|
|
|
// QFont font("微软雅黑", 10, QFont::Bold, false);
|
|
|
|
|
|
// //
|
|
|
|
|
|
// QTableWidgetItem* item = new QTableWidgetItem(strLineName);
|
|
|
|
|
|
// item->setFlags(item->flags() & (~Qt::ItemIsEditable));
|
|
|
|
|
|
// item->setForeground(QBrush(lineColor));// 设置字体颜色
|
|
|
|
|
|
// item->setFont(font); // 应用新的字体
|
|
|
|
|
|
// item->setTextAlignment(Qt::AlignCenter);//居中
|
|
|
|
|
|
// //
|
|
|
|
|
|
// ui->tableWidget->setItem(row, 0, item);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-11-18 11:40:42 +08:00
|
|
|
|
void FormTrack::s_addWave(QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, QString strAliasName, QString strUnit, QColor lineColor, double dWidth, float vmax, float vmin, QString strScaleType)
|
|
|
|
|
|
{
|
|
|
|
|
|
qDebug() << "FormTrack s_addWave";
|
|
|
|
|
|
|
|
|
|
|
|
ui->tableWidget->m_strUuid = m_strUuid;
|
|
|
|
|
|
int row = ui->tableWidget->rowCount();
|
|
|
|
|
|
ui->tableWidget->setRowCount(row + 1);
|
|
|
|
|
|
|
|
|
|
|
|
//避免出现小滚动条
|
|
|
|
|
|
//ui->tableWidget->resize(g_iOneWidth, 100*(row + 1)+10);
|
|
|
|
|
|
//this->resize(g_iOneWidth, 100*(row + 1)+30);
|
|
|
|
|
|
|
|
|
|
|
|
//曲线信息栏
|
|
|
|
|
|
FormInfo *formInfo = new FormInfo(this, strSlfName, strWellName, strTrackName, strLineName, lineColor);
|
|
|
|
|
|
formInfo->m_strUuid = m_strUuid;
|
|
|
|
|
|
formInfo->m_strAliasName = strAliasName;
|
|
|
|
|
|
formInfo->m_strUnit = strUnit;
|
|
|
|
|
|
formInfo->m_strScaleType = strScaleType;
|
|
|
|
|
|
formInfo->m_strType = "waveObject";
|
|
|
|
|
|
formInfo->setLineWidth(dWidth);
|
|
|
|
|
|
formInfo->setVMax(vmax);
|
|
|
|
|
|
formInfo->setVMin(vmin);
|
|
|
|
|
|
formInfo->setFrontColor(QColor(0,0,0));
|
|
|
|
|
|
formInfo->setBackColor(QColor(255,255,255));
|
|
|
|
|
|
//设置高度
|
|
|
|
|
|
ui->tableWidget->setRowHeight(row, 100);
|
|
|
|
|
|
//单元格委托
|
|
|
|
|
|
//ui->tableWidget->setItemDelegateForRow(row, m_delegate);
|
|
|
|
|
|
//
|
|
|
|
|
|
ui->tableWidget->setCellWidget(row, 0, formInfo);
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-11-25 17:56:20 +08:00
|
|
|
|
//------------------------------------
|
|
|
|
|
|
// QFont font("微软雅黑", 10, QFont::Bold, false);
|
|
|
|
|
|
// //
|
|
|
|
|
|
// QTableWidgetItem* item = new QTableWidgetItem(strLineName);
|
|
|
|
|
|
// item->setFlags(item->flags() & (~Qt::ItemIsEditable));
|
|
|
|
|
|
// item->setForeground(QBrush(lineColor));// 设置字体颜色
|
|
|
|
|
|
// item->setFont(font); // 应用新的字体
|
|
|
|
|
|
// item->setTextAlignment(Qt::AlignCenter);//居中
|
|
|
|
|
|
// //
|
|
|
|
|
|
// ui->tableWidget->setItem(row, 0, item);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void FormTrack::s_AddTableLine(QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, QString strAliasName, QString strUnit, QColor lineColor, double dWidth, float vmax, float vmin, QString strScaleType)
|
|
|
|
|
|
{
|
2025-12-05 18:27:24 +08:00
|
|
|
|
if(strLineName == "FRAC_HOLE.TABLE" || strLineName == "WORDS_RELUST" || strLineName == "RESULT")
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
2025-12-01 17:13:17 +08:00
|
|
|
|
{
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-11-26 16:56:00 +08:00
|
|
|
|
qDebug() << "FormTrack s_AddTableLine";
|
2025-11-25 17:56:20 +08:00
|
|
|
|
|
|
|
|
|
|
ui->tableWidget->m_strUuid = m_strUuid;
|
|
|
|
|
|
int row = ui->tableWidget->rowCount();
|
|
|
|
|
|
ui->tableWidget->setRowCount(row + 1);
|
|
|
|
|
|
|
|
|
|
|
|
//避免出现小滚动条
|
|
|
|
|
|
//ui->tableWidget->resize(g_iOneWidth, 100*(row + 1)+10);
|
|
|
|
|
|
//this->resize(g_iOneWidth, 100*(row + 1)+30);
|
|
|
|
|
|
|
|
|
|
|
|
//曲线信息栏
|
|
|
|
|
|
FormInfo *formInfo = new FormInfo(this, strSlfName, strWellName, strTrackName, strLineName, lineColor);
|
|
|
|
|
|
formInfo->m_strUuid = m_strUuid;
|
|
|
|
|
|
formInfo->m_strAliasName = strAliasName;
|
|
|
|
|
|
formInfo->m_strUnit = strUnit;
|
|
|
|
|
|
formInfo->m_strScaleType = strScaleType;
|
|
|
|
|
|
formInfo->m_strType = "tableObject";
|
|
|
|
|
|
formInfo->setLineWidth(dWidth);
|
|
|
|
|
|
formInfo->setVMax(vmax);
|
|
|
|
|
|
formInfo->setVMin(vmin);
|
|
|
|
|
|
formInfo->setFrontColor(QColor(0,0,0));
|
|
|
|
|
|
formInfo->setBackColor(QColor(255,255,255));
|
|
|
|
|
|
//设置高度
|
|
|
|
|
|
ui->tableWidget->setRowHeight(row, 100);
|
|
|
|
|
|
//单元格委托
|
|
|
|
|
|
//ui->tableWidget->setItemDelegateForRow(row, m_delegate);
|
|
|
|
|
|
//
|
|
|
|
|
|
ui->tableWidget->setCellWidget(row, 0, formInfo);
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-11-18 11:40:42 +08:00
|
|
|
|
//------------------------------------
|
|
|
|
|
|
// QFont font("微软雅黑", 10, QFont::Bold, false);
|
|
|
|
|
|
// //
|
|
|
|
|
|
// QTableWidgetItem* item = new QTableWidgetItem(strLineName);
|
|
|
|
|
|
// item->setFlags(item->flags() & (~Qt::ItemIsEditable));
|
|
|
|
|
|
// item->setForeground(QBrush(lineColor));// 设置字体颜色
|
|
|
|
|
|
// item->setFont(font); // 应用新的字体
|
|
|
|
|
|
// item->setTextAlignment(Qt::AlignCenter);//居中
|
|
|
|
|
|
// //
|
|
|
|
|
|
// ui->tableWidget->setItem(row, 0, item);
|
|
|
|
|
|
}
|
2025-10-29 17:23:30 +08:00
|
|
|
|
|
|
|
|
|
|
QJsonObject FormTrack::makeJson()
|
|
|
|
|
|
{
|
|
|
|
|
|
// 创建根对象
|
|
|
|
|
|
QJsonObject rootObj;
|
|
|
|
|
|
//
|
|
|
|
|
|
rootObj["WellName"] = m_strWellName;
|
|
|
|
|
|
rootObj["TrackName"] = m_strTrackName;
|
|
|
|
|
|
|
|
|
|
|
|
// 创建JSON数组并填充数据
|
|
|
|
|
|
QJsonArray subcaseArray;
|
|
|
|
|
|
//
|
|
|
|
|
|
int rowCount = ui->tableWidget->rowCount();
|
|
|
|
|
|
for(int i=0; i<rowCount; i++)
|
|
|
|
|
|
{
|
|
|
|
|
|
if( ui->tableWidget->cellWidget(i, 0) != nullptr )
|
|
|
|
|
|
{
|
|
|
|
|
|
auto myWidget = ui->tableWidget->cellWidget(i, 0);
|
|
|
|
|
|
//
|
|
|
|
|
|
FormInfo *formInfo = (FormInfo*)myWidget;//获得widget
|
|
|
|
|
|
if(formInfo)
|
|
|
|
|
|
{
|
|
|
|
|
|
//options
|
|
|
|
|
|
QJsonObject formInfoObj;
|
|
|
|
|
|
formInfoObj["id"] = i;
|
|
|
|
|
|
formInfoObj["info"] = formInfo->makeJson();
|
|
|
|
|
|
subcaseArray.append(formInfoObj);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
rootObj["formInfos"]=subcaseArray;
|
|
|
|
|
|
|
|
|
|
|
|
return rootObj;
|
|
|
|
|
|
}
|