井下面道标题属性保存, 字体属性,字体颜色等保存到json文件
修改道标题 QTableWidgetItem,改为FormTrackTop渲染字体效果
This commit is contained in:
parent
427293bc76
commit
2d2aabf36a
|
|
@ -6,6 +6,7 @@
|
|||
#include <QList>
|
||||
#include <QPoint>
|
||||
#include <QColor>
|
||||
#include <QJsonObject>
|
||||
#include <QWheelEvent>
|
||||
//#include "qmycustomplot.h"
|
||||
|
||||
|
|
@ -46,6 +47,7 @@ signals:
|
|||
void sig_NewCol(QStringList listdt);
|
||||
void sig_NewTrack(QString strUuid, QString strWellName, QString strSlfName, QString strLineName, QString strType, int nW = 0);//新建道
|
||||
void sig_NewTrack_No_Line(QString strUuid, QString strWellName, QString strTrackName);//新建空白道,没有曲线
|
||||
void sig_NewTrack_No_Line(QString strUuid, QJsonObject obj);//新建空白道,没有曲线
|
||||
void sig_AddLine(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName);//新建曲线
|
||||
void sig_AddLine_Property(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName,
|
||||
double newLeftScale, double newRightScale, QString strScaleType, QColor lineColor, double width, Qt::PenStyle lineStyle);//新建曲线,带属性
|
||||
|
|
@ -141,7 +143,8 @@ signals:
|
|||
|
||||
//改变道宽
|
||||
void sig_changeWidth(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, int iCurrentCol, int iNewWidth);
|
||||
|
||||
//改变道属性
|
||||
void sig_changeTrackProperty(QVariantList vlist);
|
||||
|
||||
//右键--添加分段线
|
||||
void sig_AddShiftLine(QString strUuid, double left_Low, double right_Hight);
|
||||
|
|
|
|||
|
|
@ -66,6 +66,8 @@ void PropertyWidget::InitCurrentViewInfo()
|
|||
m_propertyData.clear();
|
||||
m_mapGroupItem.clear();
|
||||
|
||||
m_fromTop = NULL;
|
||||
m_item = NULL;
|
||||
m_strUuid = "";
|
||||
m_strSlfName = "";
|
||||
m_strWellName = "";
|
||||
|
|
@ -77,6 +79,44 @@ void PropertyWidget::InitCurrentViewInfo()
|
|||
|
||||
void PropertyWidget::SlotPropertyChanged( QtProperty *pProperty, const QVariant &variant )
|
||||
{
|
||||
if(m_strCurrentProperty == "")
|
||||
return;
|
||||
|
||||
if(m_strCurrentProperty == Track_Property)
|
||||
{
|
||||
if(m_fromTop == NULL)
|
||||
return;
|
||||
|
||||
if("道名称" == m_propertyData[pProperty])
|
||||
{
|
||||
m_fromTop->m_strTrackName = variant.toString();
|
||||
}
|
||||
else if("道头字体" == m_propertyData[pProperty])
|
||||
{
|
||||
QFont newFont = variant.value<QFont>();
|
||||
// 设置字体
|
||||
m_fromTop->m_font = newFont;
|
||||
|
||||
}
|
||||
else if("道头字颜色" == m_propertyData[pProperty])
|
||||
{
|
||||
QColor newColor = variant.value<QColor>();
|
||||
m_fromTop->m_fontColor = newColor;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
QVariantList listCond;
|
||||
listCond << m_strUuid;
|
||||
listCond << m_strSlfName;
|
||||
listCond << m_strWellName;
|
||||
listCond << m_iCurrentCol;
|
||||
listCond << m_propertyData[pProperty];
|
||||
listCond << variant;
|
||||
emit CallManage::getInstance()->sig_changeTrackProperty(listCond);
|
||||
}
|
||||
return;
|
||||
}
|
||||
if("深度比例尺" == m_propertyData[pProperty])
|
||||
{
|
||||
//qDebug() << "深度比例尺->改变";
|
||||
|
|
@ -197,18 +237,6 @@ void PropertyWidget::SlotPropertyChanged( QtProperty *pProperty, const QVariant
|
|||
emit CallManage::getInstance()->sig_changeDepth(m_strUuid, m_strSlfName, m_strWellName, m_iY1, m_iY2);
|
||||
}
|
||||
}
|
||||
else if("道宽(cm)" == m_propertyData[pProperty])
|
||||
{
|
||||
//qDebug() << "终止深度(m)->改变";
|
||||
//当前属性类型
|
||||
if(m_strCurrentProperty == Track_Property)
|
||||
{
|
||||
double newWidth = variant.value<double>();
|
||||
newWidth = newWidth * g_dPixelPerCm;
|
||||
//通知界面缩放
|
||||
emit CallManage::getInstance()->sig_changeWidth(m_strUuid, m_strSlfName, m_strWellName, m_strTrackName, m_iCurrentCol, newWidth);
|
||||
}
|
||||
}
|
||||
else if("左刻度" == m_propertyData[pProperty])
|
||||
{
|
||||
//qDebug() << "左刻度->改变";
|
||||
|
|
@ -804,25 +832,30 @@ void PropertyWidget::initWellProperty(QString strUuid, QString strSlfName, QStri
|
|||
_CreateVariantPropertyItem("通常", "终止深度(m)", 0-m_iY1, QVariant::Double);
|
||||
}
|
||||
|
||||
void PropertyWidget::initTrackProperty(QTableWidgetItem *item, int iWidth, QMyTableWidget *myTableWidget, int iCurrentCol)
|
||||
void PropertyWidget::initTrackProperty(FormTrackTop *fromTop, int iWidth, QMyTableWidget *myTableWidget, int iCurrentCol)
|
||||
{
|
||||
//初始化,清空
|
||||
InitCurrentViewInfo();
|
||||
//
|
||||
m_myTableWidget = myTableWidget;
|
||||
m_iCurrentCol = iCurrentCol;
|
||||
//
|
||||
m_strTrackName = item->text();
|
||||
m_strUuid = item->data(Qt::UserRole+1).toString();
|
||||
m_strWellName = item->data(Qt::UserRole+2).toString();
|
||||
m_strSlfName = item->data(Qt::UserRole+3).toString();
|
||||
|
||||
//当前属性类型
|
||||
m_strCurrentProperty = Track_Property;
|
||||
m_fromTop = fromTop;
|
||||
//
|
||||
m_strTrackName = fromTop->m_strTrackName;
|
||||
m_strUuid = fromTop->m_strUuid;
|
||||
m_strWellName = fromTop->m_strWellName;
|
||||
m_strSlfName = fromTop->m_strSlfName;
|
||||
|
||||
//
|
||||
double cmWidth = (double)iWidth/(double)g_dPixelPerCm;
|
||||
_CreateVariantPropertyItem("通常", "道宽(cm)", cmWidth, QVariant::Double);
|
||||
_CreateVariantPropertyItem("通常", "道名称", m_strTrackName, QVariant::String);
|
||||
_CreateVariantPropertyItem("通常", "道头字体", fromTop->m_font, QVariant::Font);
|
||||
_CreateVariantPropertyItem("通常", "道头字颜色", fromTop->m_fontColor, QVariant::Color);
|
||||
|
||||
//当前属性类型
|
||||
m_strCurrentProperty = Track_Property;
|
||||
}
|
||||
|
||||
void PropertyWidget::initCurveProperty(FormInfo *formInfo, QStringList strListOtherLine, QList<float> listMin, QList<float> listMax, QStringList strListOtherScaleType)
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@
|
|||
#include "forminfo.h"
|
||||
#include "formhead.h"
|
||||
#include "qmytablewidget.h"
|
||||
#include "formtracktop.h"
|
||||
|
||||
//当前曲线类型
|
||||
#define Widget_Property "Widget_Property"
|
||||
|
|
@ -66,6 +67,8 @@ public:
|
|||
QList<float> m_listMax;
|
||||
QStringList m_strListOtherScaleType;
|
||||
|
||||
FormTrackTop* m_fromTop = NULL;
|
||||
|
||||
FormHead *m_formHead;
|
||||
QTableWidget *m_tableWidget;
|
||||
QTableWidgetItem* m_item;
|
||||
|
|
@ -91,7 +94,7 @@ public:
|
|||
//井
|
||||
void initWellProperty(QString strUuid, QString strSlfName, QString strWellName, double iY1, double iY2);
|
||||
//道
|
||||
void initTrackProperty(QTableWidgetItem *item, int iWidth, QMyTableWidget *myTableWidget, int iCurrentCol);
|
||||
void initTrackProperty(FormTrackTop *fromTop, int iWidth, QMyTableWidget *myTableWidget, int iCurrentCol);
|
||||
//曲线
|
||||
void initCurveProperty(FormInfo *formInfo, QStringList strListOtherLine, QList<float> listMin, QList<float> listMax, QStringList strListOtherScaleType);
|
||||
//图头
|
||||
|
|
|
|||
|
|
@ -100,9 +100,6 @@ FormDraw::FormDraw(QWidget *parent, QString strWellName, QString strTrackName) :
|
|||
//套管组件
|
||||
connect(CallManage::getInstance(), SIGNAL(sig_AddTubingstring(QString, QString, QString, QString, QString, int)), this, SLOT(s_addTubingstring(QString, QString, QString, QString, QString,int)));
|
||||
|
||||
//TDT
|
||||
// connect(CallManage::getInstance(), SIGNAL(sig_AddTDT(QString, QString, QString, QString, QString, int)), this, SLOT(s_addTDT(QString, QString, QString, QString, QString,int)));
|
||||
|
||||
}
|
||||
|
||||
FormDraw::~FormDraw()
|
||||
|
|
@ -1932,11 +1929,6 @@ void FormDraw::s_addTubingstring(QString strUuid, QString strSlfName, QString st
|
|||
m_formTrack->Add(strSlfName, m_strWellName, m_strTrackName, strWaveName, strAliasName, strUnit, newlineColor, width, m_RightVal, m_LeftVal, strScaleType, "TubingstringObject");
|
||||
}
|
||||
|
||||
//TDT
|
||||
// void FormDraw::s_addTDT(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, int nW)
|
||||
// {
|
||||
// }
|
||||
|
||||
void FormDraw::initForm(QMyCustomPlot *widget, QString strSlfName, QString strLineName,
|
||||
double newLeftScale, double newRightScale, QString strScaleType, QColor lineColor, double width, Qt::PenStyle lineStyle)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -106,10 +106,6 @@ FormTrack::FormTrack(QWidget *parent, QString strWellName, QString strTrackName)
|
|||
connect(this, SIGNAL(sig_AddTubingstring(QString, QString, QString, QString, QString, QString, QColor, double, float, float, QString)),
|
||||
this, SLOT(s_addTubingstring(QString, QString, QString, QString, QString, QString, QColor, double, float, float, QString)));
|
||||
|
||||
//TDT
|
||||
connect(this, SIGNAL(sig_AddTDT(QString, QString, QString, QString, QString, QString, QColor, double, float, float, QString)),
|
||||
this, SLOT(s_addTDT(QString, QString, QString, QString, QString, QString, QColor, double, float, float, QString)));
|
||||
|
||||
//曲线选中,置顶
|
||||
connect(CallManage::getInstance(), SIGNAL(sig_Raise(QString, QString, QString, QString, QString, int, QString)), this, SLOT(s_Raise(QString, QString, QString, QString, QString, int, QString)));
|
||||
|
||||
|
|
@ -204,10 +200,6 @@ void FormTrack::Add(QString strSlfName, QString strWellName, QString strTrackNam
|
|||
{
|
||||
emit sig_AddTubingstring(strSlfName, strWellName, m_strTrackName, strLineName, strAliasName, strUnit, lineColor, dWidth, vmax, vmin, strScaleType);
|
||||
}
|
||||
else if(strType=="TDTObject")
|
||||
{
|
||||
emit sig_AddTDT(strSlfName, strWellName, m_strTrackName, strLineName, strAliasName, strUnit, lineColor, dWidth, vmax, vmin, strScaleType);
|
||||
}
|
||||
}
|
||||
|
||||
void FormTrack::setDrawDt(QStringList listdt, float vmax, float vmin)
|
||||
|
|
|
|||
|
|
@ -85,8 +85,6 @@ signals:
|
|||
void sig_AddLogface(QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, QString strAliasName, QString strUnit, QColor lineColor, double dWidth, float vmax, float vmin, QString strScaleType);
|
||||
void sig_AddMCals(QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, QString strAliasName, QString strUnit, QColor lineColor, double dWidth, float vmax, float vmin, QString strScaleType);
|
||||
void sig_AddTubingstring(QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, QString strAliasName, QString strUnit, QColor lineColor, double dWidth, float vmax, float vmin, QString strScaleType);
|
||||
void sig_AddTDT(QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, QString strAliasName, QString strUnit, QColor lineColor, double dWidth, float vmax, float vmin, QString strScaleType);
|
||||
|
||||
|
||||
public slots:
|
||||
void s_addLine(QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, QString strAliasName, QString strUnit, QColor lineColor, double dWidth, float vmax, float vmin, QString strScaleType);
|
||||
|
|
|
|||
227
logPlus/formtracktop.cpp
Normal file
227
logPlus/formtracktop.cpp
Normal file
|
|
@ -0,0 +1,227 @@
|
|||
#include "FormTrackTop.h"
|
||||
#include "ui_FormTrackTop.h"
|
||||
|
||||
#include "CallManage.h"
|
||||
#include <QDebug>
|
||||
#include <QMimeData>
|
||||
#include <QPushButton>
|
||||
#include <QVBoxLayout>
|
||||
#include "geometryutils.h"
|
||||
|
||||
//曲线名称(单个)
|
||||
FormTrackTop::FormTrackTop(QWidget *parent, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, QColor lineColor) :
|
||||
QWidget(parent),
|
||||
ui(new Ui::FormTrackTop)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
//
|
||||
setAcceptDrops(true);
|
||||
|
||||
m_strSlfName = strSlfName;
|
||||
m_strWellName = strWellName;
|
||||
m_strTrackName = strTrackName;
|
||||
m_strLineName = strLineName;
|
||||
m_lineColor = lineColor;
|
||||
//
|
||||
m_dWidth = 3;
|
||||
m_lineStyle = Qt::SolidLine;
|
||||
m_newFillMode = "无填充";
|
||||
m_newHeadFill = "不绘制";
|
||||
// //
|
||||
// QPushButton *button = new QPushButton("Drag Me", this);
|
||||
// QVBoxLayout *layout = new QVBoxLayout(this);
|
||||
// layout->addWidget(button);
|
||||
// setLayout(layout);
|
||||
// // 设置拖拽功能
|
||||
// setWindowFlags(Qt::FramelessWindowHint | Qt::Window);
|
||||
// setAttribute(Qt::WA_TranslucentBackground);
|
||||
|
||||
|
||||
m_font = QFont("微软雅黑", 10);
|
||||
m_fontColor = QColor(0,0,0);
|
||||
}
|
||||
|
||||
FormTrackTop::~FormTrackTop()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
QJsonObject FormTrackTop::makeJson()
|
||||
{
|
||||
// 创建根对象
|
||||
QJsonObject rootObj;
|
||||
//
|
||||
rootObj["WellName"] = m_strWellName;
|
||||
rootObj["TrackName"] = m_strTrackName;
|
||||
rootObj["Font"] = m_font.toString();
|
||||
rootObj["FontColor"] = m_fontColor.name();
|
||||
|
||||
return rootObj;
|
||||
}
|
||||
|
||||
void FormTrackTop::paintEvent(QPaintEvent* event)
|
||||
{
|
||||
QPainter painter(this);
|
||||
QRect rect = this->rect();
|
||||
//背景透明
|
||||
painter.fillRect(rect.left(), rect.top(), rect.width(), rect.height(), QColor(0, 0, 0, 0)); //QColor(67, 67, 67, 100)
|
||||
|
||||
painter.setBrush(Qt::NoBrush); // 确保文字不被填充色遮挡
|
||||
painter.setFont(m_font);
|
||||
painter.setPen(m_fontColor); // fontColor QColor(220, 220, 220)
|
||||
painter.drawText(rect.left(), rect.top(), rect.width(), rect.height(), Qt::AlignCenter, m_strTrackName);
|
||||
|
||||
QWidget::paintEvent(event);
|
||||
}
|
||||
|
||||
void FormTrackTop::dragEnterEvent(QDragEnterEvent* event)
|
||||
{
|
||||
qDebug() << "FormTrackTop dragEnterEvent";
|
||||
|
||||
const QMimeData* mimeData = event->mimeData();
|
||||
// 检查拖拽的数据类型,确定是否接受拖拽
|
||||
if (event->mimeData()->hasFormat("text/plain")) {
|
||||
event->acceptProposedAction();
|
||||
//QApplication::setOverrideCursor(Qt::PointingHandCursor); // 设置鼠标为可添加状态
|
||||
}
|
||||
else
|
||||
{
|
||||
event->ignore();
|
||||
//QApplication::setOverrideCursor(Qt::ForbiddenCursor); // 设置鼠标为不可添加状态
|
||||
}
|
||||
}
|
||||
|
||||
void FormTrackTop::dragMoveEvent(QDragMoveEvent* event)
|
||||
{
|
||||
qDebug() << "FormTrackTop dragMoveEvent";
|
||||
|
||||
// 可以在这里更新鼠标的位置,根据位置判断是否可以放置
|
||||
// ...
|
||||
//dragEnterEvent(event); // 可以使用相同的逻辑
|
||||
//event->accept();
|
||||
}
|
||||
|
||||
void FormTrackTop::dropEvent(QDropEvent* event)
|
||||
{
|
||||
qDebug() << "FormTrackTop dropEvent";
|
||||
|
||||
// 处理放置动作,更新UI或数据
|
||||
if (event->mimeData()->hasFormat("text/plain")) {
|
||||
// 获取拖拽的数据
|
||||
QString strExtern = event->mimeData()->text();
|
||||
qDebug() << strExtern;
|
||||
//
|
||||
QStringList list = strExtern.split("#@@#");//QString字符串分割函数
|
||||
if (list.size() > 3)
|
||||
{
|
||||
QString strSlfName = list[0];
|
||||
QString strWellName = list[1];
|
||||
QString strLineName = list[2];
|
||||
QString strType = list[3];
|
||||
|
||||
qDebug() << "strSlfName:" << strSlfName<< " strWellName:" << strWellName<< " strLineName:" << strLineName << " strType:" << strType;
|
||||
|
||||
if(m_strWellName == strWellName)
|
||||
{
|
||||
if(strType=="curveObject")
|
||||
{
|
||||
//新建曲线
|
||||
emit CallManage::getInstance()->sig_AddLine(m_strUuid, strSlfName, strWellName, m_strTrackName, strLineName);
|
||||
}
|
||||
else if(strType=="waveObject")
|
||||
{
|
||||
//新建波列
|
||||
emit CallManage::getInstance()->sig_AddWave(m_strUuid, strSlfName, strWellName, m_strTrackName, strLineName);
|
||||
}
|
||||
else if(strType=="tableObject")
|
||||
{
|
||||
//新建表格曲线
|
||||
emit CallManage::getInstance()->sig_AddTableLine(m_strUuid, strSlfName, strWellName, m_strTrackName, strLineName);
|
||||
}
|
||||
// 接受拖拽事件
|
||||
event->setDropAction(Qt::MoveAction);
|
||||
event->accept();
|
||||
}
|
||||
else
|
||||
{
|
||||
// 如果井名不正确,不接受拖拽事件
|
||||
event->ignore();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// 如果数据格式不正确,不接受拖拽事件
|
||||
event->ignore();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// 如果数据格式不正确,不接受拖拽事件
|
||||
event->ignore();
|
||||
}
|
||||
// 恢复鼠标光标
|
||||
//QApplication::restoreOverrideCursor();
|
||||
}
|
||||
|
||||
//线宽
|
||||
void FormTrackTop::setLineWidth(double dWidth)
|
||||
{
|
||||
m_dWidth = dWidth;
|
||||
}
|
||||
|
||||
double FormTrackTop::getLineWidth()
|
||||
{
|
||||
return m_dWidth;
|
||||
}
|
||||
|
||||
//线型
|
||||
void FormTrackTop::setLineStyle(Qt::PenStyle lineStyle)
|
||||
{
|
||||
m_lineStyle = lineStyle;
|
||||
}
|
||||
|
||||
Qt::PenStyle FormTrackTop::getLineStyle()
|
||||
{
|
||||
return m_lineStyle;
|
||||
}
|
||||
|
||||
void FormTrackTop::setVMax(float vmax)
|
||||
{
|
||||
m_vmax = vmax;
|
||||
}
|
||||
|
||||
float FormTrackTop::getVMax()
|
||||
{
|
||||
return m_vmax;
|
||||
}
|
||||
|
||||
void FormTrackTop::setVMin(float vmin)
|
||||
{
|
||||
m_vmin = vmin;
|
||||
}
|
||||
|
||||
float FormTrackTop::getVMin()
|
||||
{
|
||||
return m_vmin;
|
||||
}
|
||||
|
||||
void FormTrackTop::setFrontColor(QColor frontColor)
|
||||
{
|
||||
m_frontColor = frontColor;
|
||||
}
|
||||
|
||||
QColor FormTrackTop::getFrontColor()
|
||||
{
|
||||
return m_frontColor;
|
||||
}
|
||||
|
||||
void FormTrackTop::setBackColor(QColor backColor)
|
||||
{
|
||||
m_backColor = backColor;
|
||||
}
|
||||
|
||||
QColor FormTrackTop::getBackColor()
|
||||
{
|
||||
return m_backColor;
|
||||
}
|
||||
|
||||
117
logPlus/formtracktop.h
Normal file
117
logPlus/formtracktop.h
Normal file
|
|
@ -0,0 +1,117 @@
|
|||
#ifndef FormTrackTop_H
|
||||
#define FormTrackTop_H
|
||||
|
||||
#include <QWidget>
|
||||
#include <QPainter>
|
||||
#include <QPaintEvent>
|
||||
//
|
||||
#include <QJsonDocument>
|
||||
#include <QJsonObject>
|
||||
#include <QJsonArray>
|
||||
|
||||
#pragma execution_character_set("utf-8")
|
||||
|
||||
namespace Ui {
|
||||
class FormTrackTop;
|
||||
}
|
||||
|
||||
class FormTrackTop : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit FormTrackTop(QWidget *parent = nullptr, QString strSlfName="", QString strWellName="", QString strTrackName="", QString strLineName="", QColor lineColor=QColor(255,0,0));
|
||||
~FormTrackTop();
|
||||
|
||||
private:
|
||||
Ui::FormTrackTop *ui;
|
||||
|
||||
protected:
|
||||
void paintEvent(QPaintEvent *event);
|
||||
|
||||
public slots:
|
||||
void dragEnterEvent(QDragEnterEvent* event);
|
||||
void dragMoveEvent(QDragMoveEvent* event);
|
||||
void dropEvent(QDropEvent* event);
|
||||
//属性
|
||||
|
||||
|
||||
public:
|
||||
QString m_strUuid;
|
||||
QString m_strSlfName;
|
||||
QString m_strWellName;
|
||||
QString m_strTrackName;
|
||||
QString m_strLineName;
|
||||
QString m_strAliasName;//显示名称
|
||||
QString m_strUnit;//单位
|
||||
|
||||
QFont m_font;
|
||||
QColor m_fontColor;//颜色
|
||||
|
||||
int m_iSelect=0; //iSelect=0未知,1标准曲线,2主曲线,3从曲线
|
||||
QString m_strType;//类型:curve, wave
|
||||
//
|
||||
double m_dWidth;//线宽
|
||||
QColor m_lineColor;//颜色
|
||||
Qt::PenStyle m_lineStyle;//线形
|
||||
//X坐标
|
||||
float m_vmin;//左刻度
|
||||
float m_vmax;//右刻度
|
||||
QString m_strScaleType;//刻度类型(线性,对数)
|
||||
|
||||
//岩性填充
|
||||
QString m_newHeadFill;//头部图例
|
||||
QString m_newTargetLine;//目标曲线
|
||||
QString m_newFillType;//填充类型
|
||||
QString m_newFillMode;//填充模式
|
||||
QColor m_newColor;//填充颜色
|
||||
QString m_newLithosImage = "";//岩性图片
|
||||
float m_new_vMin;//其他目标曲线
|
||||
float m_new_vMax;//其他目标曲线
|
||||
QString m_strOtherScaleType;//其他目标曲线,刻度类型(线性,对数)
|
||||
QColor m_frontColor;//岩性前景色
|
||||
QColor m_backColor;//岩性背景色
|
||||
|
||||
int m_nJg;
|
||||
|
||||
public:
|
||||
void setLineWidth(double dWidth);
|
||||
double getLineWidth();
|
||||
|
||||
void setLineStyle(Qt::PenStyle lineStyle);
|
||||
Qt::PenStyle getLineStyle();
|
||||
|
||||
void setVMax(float vmax);
|
||||
float getVMax();
|
||||
|
||||
void setVMin(float vmin);
|
||||
float getVMin();
|
||||
|
||||
void setFrontColor(QColor frontColor);
|
||||
QColor getFrontColor();
|
||||
|
||||
void setBackColor(QColor backColor);
|
||||
QColor getBackColor();
|
||||
|
||||
QJsonObject makeJson();
|
||||
|
||||
//public:
|
||||
// void mousePressEvent(QMouseEvent *event) override {
|
||||
// if (event->button() == Qt::LeftButton) {
|
||||
// startPosition = event->globalPos() - frameGeometry().topLeft();
|
||||
// event->accept();
|
||||
// }
|
||||
// }
|
||||
|
||||
// void mouseMoveEvent(QMouseEvent *event) override {
|
||||
// if (event->buttons() & Qt::LeftButton) {
|
||||
// move(event->globalPos() - startPosition);
|
||||
// event->accept();
|
||||
// }
|
||||
// }
|
||||
|
||||
private:
|
||||
QPoint startPosition;
|
||||
};
|
||||
|
||||
#endif // FormTrackTop_H
|
||||
19
logPlus/formtracktop.ui
Normal file
19
logPlus/formtracktop.ui
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>FormTrackTop</class>
|
||||
<widget class="QWidget" name="FormTrackTop">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>400</width>
|
||||
<height>300</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
|
|
@ -30,6 +30,8 @@ FormWell::FormWell(QWidget *parent, QString strWellName) :
|
|||
//关联信号槽
|
||||
connect(CallManage::getInstance(), SIGNAL(sig_NewTrack_No_Line(QString, QString, QString)), this, SLOT(s_NewTrack_No_Line(QString, QString, QString)));
|
||||
|
||||
connect(CallManage::getInstance(), SIGNAL(sig_NewTrack_No_Line(QString, QJsonObject)), this, SLOT(slot_NewTrack_No_Line(QString, QJsonObject)));
|
||||
|
||||
//曲线选中,置顶
|
||||
connect(CallManage::getInstance(), SIGNAL(sig_Raise(QString, QString, QString, QString, QString, int, QString)), this, SLOT(s_Raise(QString, QString, QString, QString, QString, int, QString)));
|
||||
|
||||
|
|
@ -53,82 +55,66 @@ int FormWell::insertColumn(int nw)
|
|||
return ncolCount;
|
||||
}
|
||||
|
||||
void FormWell::s_Raise(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, int iTableType, QString strFormInfoType)
|
||||
QVector<QWidget *> FormWell::new_track(QStringList listdt)
|
||||
{
|
||||
if(m_strUuid == strUuid &&
|
||||
m_strWellName == strWellName &&
|
||||
iTableType==2)
|
||||
{
|
||||
//
|
||||
}
|
||||
else {
|
||||
//选中了曲线置顶
|
||||
//取消表格选中状态
|
||||
ui->tableWidget->clearSelection();
|
||||
}
|
||||
}
|
||||
QVector<QWidget *> vec;
|
||||
QString strUuid = listdt.at(0);
|
||||
QString strWellName = listdt.at(1);
|
||||
QString strSlfName = listdt.at(2);
|
||||
QString strTrackName = listdt.at(3);
|
||||
QString strType = listdt.at(4);
|
||||
int nW = listdt.at(5).toInt();
|
||||
|
||||
void FormWell::s_NewTrack(QString strUuid, QString strWellName, QString strSlfName, QString strLineName, QString strType,int nW)
|
||||
{
|
||||
//判断当前井是否与自己同名
|
||||
if(strUuid != m_strUuid || strWellName != m_strWellName)
|
||||
{
|
||||
return;
|
||||
return vec;
|
||||
}
|
||||
|
||||
if(nW <= 0)
|
||||
{
|
||||
nW = g_iOneWidth;
|
||||
}
|
||||
|
||||
//因为tableWidget需要提前规定好行数与列数
|
||||
int rowcount = 3; //总行数
|
||||
int columnCount = ui->tableWidget->columnCount();//总列数
|
||||
//增加1列
|
||||
ui->tableWidget->setColumnCount(columnCount+1);
|
||||
//设置列宽
|
||||
ui->tableWidget->setColumnWidth(columnCount, nW);
|
||||
int columnCount = this->insertColumn(nW);
|
||||
|
||||
if(strTrackName.length() <= 0)
|
||||
{
|
||||
//道名
|
||||
QString strTrackName = "道" + QString::number(columnCount+1);
|
||||
strTrackName = "道" + QString::number(columnCount+1);
|
||||
if(strType == "depthObject")
|
||||
strTrackName = "深度";
|
||||
else if(strType == "roseObject")
|
||||
strTrackName = "玫瑰图";
|
||||
else if(strType == "dcaObject")
|
||||
strTrackName = "DCA检测";
|
||||
else if(strType == "tdtObject")
|
||||
strTrackName = "TDT";
|
||||
}
|
||||
|
||||
//标题
|
||||
QTableWidgetItem *headerItem = new QTableWidgetItem("");
|
||||
ui->tableWidget->setHorizontalHeaderItem(columnCount, headerItem);
|
||||
|
||||
//曲线名称栏
|
||||
FormTrack *formTrack = new FormTrack(this, m_strWellName, strTrackName);
|
||||
formTrack->m_strUuid = m_strUuid;
|
||||
formTrack->show();
|
||||
//曲线绘制栏
|
||||
FormDraw *formDraw = new FormDraw(this, m_strWellName, strTrackName);
|
||||
formDraw->m_iY1 = m_iY1;
|
||||
formDraw->m_iY2 = m_iY2;
|
||||
formDraw->m_strUuid = m_strUuid;
|
||||
formDraw->m_formTrack = formTrack;
|
||||
//
|
||||
for(int i=0; i<rowcount; i++)
|
||||
FormTrack *formTrack = NULL;
|
||||
//总行数
|
||||
for(int i = 0; i< 3; i++)
|
||||
{
|
||||
if(i==0)
|
||||
{
|
||||
//设置高度
|
||||
ui->tableWidget->setRowHeight(i, 100);
|
||||
//
|
||||
QTableWidgetItem* item = new QTableWidgetItem(strTrackName);
|
||||
item->setData(Qt::UserRole+1, m_strUuid);
|
||||
item->setData(Qt::UserRole+2, m_strWellName);
|
||||
item->setData(Qt::UserRole+3, m_strSlfName);
|
||||
item->setFlags(item->flags() & (~Qt::ItemIsEditable));
|
||||
item->setTextAlignment(Qt::AlignCenter); //设置文本居中
|
||||
ui->tableWidget->setItem(i, columnCount, item);
|
||||
FormTrackTop* trackTop= new FormTrackTop(this, strSlfName, strWellName, strTrackName);
|
||||
vec << trackTop;
|
||||
trackTop->m_strUuid = m_strUuid;
|
||||
ui->tableWidget->setCellWidget(i, columnCount, trackTop);
|
||||
}
|
||||
else if(i==1)
|
||||
{
|
||||
//设置高度
|
||||
ui->tableWidget->setRowHeight(i, 300);
|
||||
//
|
||||
|
||||
//曲线名称栏
|
||||
formTrack = new FormTrack(this, strWellName, strTrackName);
|
||||
vec << formTrack;
|
||||
formTrack->m_strUuid = m_strUuid;
|
||||
formTrack->show();
|
||||
ui->tableWidget->setCellWidget(i, columnCount, formTrack);
|
||||
}
|
||||
else if(i==2)
|
||||
|
|
@ -147,11 +133,55 @@ void FormWell::s_NewTrack(QString strUuid, QString strWellName, QString strSlfNa
|
|||
|
||||
//设置高度
|
||||
ui->tableWidget->setRowHeight(i, (int)dHight);//7582
|
||||
//
|
||||
//曲线绘制栏
|
||||
FormDraw *formDraw = new FormDraw(this, strWellName, strTrackName);
|
||||
vec << formDraw;
|
||||
formDraw->m_iY1 = m_iY1;
|
||||
formDraw->m_iY2 = m_iY2;
|
||||
formDraw->m_strUuid = m_strUuid;
|
||||
formDraw->m_formTrack = formTrack;
|
||||
|
||||
ui->tableWidget->setCellWidget(i, columnCount, formDraw);
|
||||
}
|
||||
}
|
||||
return vec;
|
||||
}
|
||||
|
||||
void FormWell::s_Raise(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, int iTableType, QString strFormInfoType)
|
||||
{
|
||||
if(m_strUuid == strUuid &&
|
||||
m_strWellName == strWellName &&
|
||||
iTableType==2)
|
||||
{
|
||||
//
|
||||
}
|
||||
else {
|
||||
//选中了曲线置顶
|
||||
//取消表格选中状态
|
||||
ui->tableWidget->clearSelection();
|
||||
}
|
||||
}
|
||||
|
||||
void FormWell::s_NewTrack(QString strUuid, QString strWellName, QString strSlfName, QString strLineName, QString strType,int nW)
|
||||
{
|
||||
QStringList listdt;
|
||||
listdt << strUuid;
|
||||
listdt << strWellName;
|
||||
listdt << m_strSlfName;
|
||||
listdt << strLineName;
|
||||
listdt << strType;
|
||||
listdt << QString::number(nW);
|
||||
|
||||
QVector<QWidget*> vecWgt = new_track(listdt);
|
||||
if(vecWgt.size() <= 0)
|
||||
return;
|
||||
|
||||
QString strTrackName = "道";
|
||||
FormTrackTop *formTop = qobject_cast<FormTrackTop*>(vecWgt.at(0));
|
||||
if(formTop)
|
||||
{
|
||||
strTrackName = formTop->m_strTrackName;
|
||||
}
|
||||
|
||||
if(strLineName!="")
|
||||
{
|
||||
|
|
@ -230,93 +260,76 @@ void FormWell::s_NewTrack(QString strUuid, QString strWellName, QString strSlfNa
|
|||
{
|
||||
//套管组件
|
||||
emit CallManage::getInstance()->sig_AddTubingstring(m_strUuid, strSlfName, strWellName, strTrackName, strLineName);
|
||||
}
|
||||
else if(strType=="TDTObject")
|
||||
{
|
||||
//TDT
|
||||
emit CallManage::getInstance()->sig_AddTDT(m_strUuid, strSlfName, strWellName, strTrackName, strLineName);
|
||||
}
|
||||
}
|
||||
|
||||
//ui->tableWidget->resizeColumnsToContents(); // 调整列宽以适应内容
|
||||
//ui->tableWidget->update();
|
||||
|
||||
// 设置右键菜单策略
|
||||
// ui->tableWidget_2->setContextMenuPolicy(Qt::CustomContextMenu);
|
||||
// connect(ui->tableWidget_2, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(slotContextMenu(QPoint)));
|
||||
}
|
||||
|
||||
void FormWell::s_NewTrack_No_Line(QString strUuid, QString strWellName, QString strTrackName)
|
||||
{
|
||||
//判断当前井是否与自己同名
|
||||
if(strUuid != m_strUuid || strWellName != m_strWellName)
|
||||
{
|
||||
QStringList listdt;
|
||||
listdt << strUuid;
|
||||
listdt << strWellName;
|
||||
listdt << m_strSlfName;
|
||||
listdt << strTrackName;
|
||||
listdt << "";
|
||||
listdt << "0";
|
||||
|
||||
QVector<QWidget*> vecWgt = new_track(listdt);
|
||||
if(vecWgt.size() <= 0)
|
||||
return;
|
||||
|
||||
FormTrackTop *formTop = qobject_cast<FormTrackTop*>(vecWgt.at(0));
|
||||
if(formTop)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
void FormWell::slot_NewTrack_No_Line(QString strUuid, QJsonObject obj)
|
||||
{
|
||||
QString strWellName="";
|
||||
QString strTrackName="";
|
||||
if (obj.contains("WellName"))
|
||||
{
|
||||
QJsonValue value = obj.value("WellName");
|
||||
if (value.isString()) {
|
||||
strWellName = value.toString();
|
||||
qDebug() << "WellName:" << strWellName;
|
||||
}
|
||||
}
|
||||
if (obj.contains("TrackName"))
|
||||
{
|
||||
QJsonValue value = obj.value("TrackName");
|
||||
if (value.isString()) {
|
||||
strTrackName = value.toString();
|
||||
}
|
||||
}
|
||||
|
||||
//因为tableWidget需要提前规定好行数与列数
|
||||
int rowcount = 3; //总行数
|
||||
int columnCount = ui->tableWidget->columnCount();//总列数
|
||||
//增加1列
|
||||
ui->tableWidget->setColumnCount(columnCount+1);
|
||||
//设置列宽
|
||||
ui->tableWidget->setColumnWidth(columnCount, g_iOneWidth);
|
||||
QStringList listdt;
|
||||
listdt << strUuid;
|
||||
listdt << strWellName;
|
||||
listdt << m_strSlfName;
|
||||
listdt << strTrackName;
|
||||
listdt << "";
|
||||
listdt << "0";
|
||||
|
||||
//标题
|
||||
QTableWidgetItem *headerItem = new QTableWidgetItem("");
|
||||
ui->tableWidget->setHorizontalHeaderItem(columnCount, headerItem);
|
||||
QVector<QWidget*> vecWgt = new_track(listdt);
|
||||
if(vecWgt.size() <= 0)
|
||||
return;
|
||||
|
||||
//曲线名称栏
|
||||
FormTrack *formTrack = new FormTrack(this, m_strWellName, strTrackName);
|
||||
formTrack->m_strUuid = m_strUuid;
|
||||
formTrack->show();
|
||||
//曲线绘制栏
|
||||
FormDraw *formDraw = new FormDraw(this, m_strWellName, strTrackName);
|
||||
formDraw->m_iY1 = m_iY1;
|
||||
formDraw->m_iY2 = m_iY2;
|
||||
formDraw->m_strUuid = m_strUuid;
|
||||
formDraw->m_formTrack = formTrack;
|
||||
//
|
||||
for(int i=0; i<rowcount; i++)
|
||||
FormTrackTop *formTop = qobject_cast<FormTrackTop*>(vecWgt.at(0));
|
||||
if(formTop)
|
||||
{
|
||||
if(i==0)
|
||||
if (obj.contains("Font"))
|
||||
{
|
||||
//设置高度
|
||||
ui->tableWidget->setRowHeight(i, 100);
|
||||
//
|
||||
QTableWidgetItem* item = new QTableWidgetItem(strTrackName);
|
||||
item->setData(Qt::UserRole+1, m_strUuid);
|
||||
item->setData(Qt::UserRole+2, m_strWellName);
|
||||
item->setData(Qt::UserRole+3, m_strSlfName);
|
||||
item->setFlags(item->flags() & (~Qt::ItemIsEditable));
|
||||
item->setTextAlignment(Qt::AlignCenter); //设置文本居中
|
||||
ui->tableWidget->setItem(i, columnCount, item);
|
||||
QJsonValue value = obj.value("Font");
|
||||
formTop->m_font.fromString(value.toString());
|
||||
}
|
||||
else if(i==1)
|
||||
if (obj.contains("FontColor"))
|
||||
{
|
||||
//设置高度
|
||||
ui->tableWidget->setRowHeight(i, 300);
|
||||
//
|
||||
ui->tableWidget->setCellWidget(i, columnCount, formTrack);
|
||||
}
|
||||
else if(i==2)
|
||||
{
|
||||
double dHight = 0;
|
||||
dHight = (m_iY2-m_iY1)*100.0/(double)m_iScale * g_dPixelPerCm;
|
||||
if(g_iShow==1)
|
||||
{
|
||||
//显示刻度
|
||||
dHight = dHight+30;
|
||||
}
|
||||
if(dHight>32767)
|
||||
{
|
||||
dHight = 32767;
|
||||
}
|
||||
|
||||
//设置高度
|
||||
ui->tableWidget->setRowHeight(i, (int)dHight);//7582
|
||||
//
|
||||
ui->tableWidget->setCellWidget(i, columnCount, formDraw);
|
||||
QJsonValue value = obj.value("FontColor");
|
||||
formTop->m_fontColor.setNamedColor(value.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -384,93 +397,15 @@ void FormWell::setRowHeight(double dHight, QProgressBar *progressBar, int iSplit
|
|||
|
||||
void FormWell::s_NewCol(QStringList listdt)
|
||||
{
|
||||
QString strUuid = listdt.at(0);
|
||||
QString strWellName = listdt.at(1);
|
||||
QString strSlfName = listdt.at(2);
|
||||
QString strLineName = listdt.at(3);
|
||||
QString strType = listdt.at(4);
|
||||
int nW = listdt.at(5).toInt();
|
||||
|
||||
//判断当前井是否与自己同名
|
||||
if(strUuid != m_strUuid || strWellName != m_strWellName)
|
||||
{
|
||||
QVector<QWidget*> vecWgt = new_track(listdt);
|
||||
if(vecWgt.size() <= 0)
|
||||
return;
|
||||
}
|
||||
|
||||
if(nW <= 0)
|
||||
nW = g_iOneWidth;
|
||||
|
||||
//增加1列
|
||||
int columnCount = this->insertColumn(nW);
|
||||
|
||||
//道名
|
||||
QString strTrackName = "道" + QString::number(columnCount+1);
|
||||
if(strType == "depthObject")
|
||||
strTrackName = "深度";
|
||||
else if(strType == "roseObject")
|
||||
strTrackName = "玫瑰图";
|
||||
else if(strType == "dcaObject")
|
||||
strTrackName = "DCA检测";
|
||||
else if(strType == "tdtObject")
|
||||
strTrackName = "TDT";
|
||||
|
||||
FormTrack *formTrack = NULL;
|
||||
//总行数
|
||||
for(int i = 0; i< 3; i++)
|
||||
{
|
||||
if(i==0)
|
||||
{
|
||||
//设置高度
|
||||
ui->tableWidget->setRowHeight(i, 100);
|
||||
//
|
||||
QTableWidgetItem* item = new QTableWidgetItem(strTrackName);
|
||||
item->setData(Qt::UserRole+1, m_strUuid);
|
||||
item->setData(Qt::UserRole+2, m_strWellName);
|
||||
item->setData(Qt::UserRole+3, m_strSlfName);
|
||||
item->setFlags(item->flags() & (~Qt::ItemIsEditable));
|
||||
item->setTextAlignment(Qt::AlignCenter); //设置文本居中
|
||||
ui->tableWidget->setItem(i, columnCount, item);
|
||||
}
|
||||
else if(i==1)
|
||||
{
|
||||
//设置高度
|
||||
ui->tableWidget->setRowHeight(i, 300);
|
||||
|
||||
//曲线名称栏
|
||||
formTrack = new FormTrack(this, m_strWellName, strTrackName);
|
||||
formTrack->m_strUuid = m_strUuid;
|
||||
formTrack->show();
|
||||
ui->tableWidget->setCellWidget(i, columnCount, formTrack);
|
||||
}
|
||||
else if(i==2)
|
||||
{
|
||||
double dHight = 0;
|
||||
dHight = (m_iY2-m_iY1)*100.0/(double)m_iScale * g_dPixelPerCm;
|
||||
if(g_iShow==1)
|
||||
{
|
||||
//显示刻度
|
||||
dHight = dHight+30;
|
||||
}
|
||||
if(dHight>32767)
|
||||
{
|
||||
dHight = 32767;
|
||||
}
|
||||
|
||||
//设置高度
|
||||
ui->tableWidget->setRowHeight(i, (int)dHight);//7582
|
||||
//曲线绘制栏
|
||||
FormDraw *formDraw = new FormDraw(this, m_strWellName, strTrackName);
|
||||
formDraw->m_iY1 = m_iY1;
|
||||
formDraw->m_iY2 = m_iY2;
|
||||
formDraw->m_strUuid = m_strUuid;
|
||||
formDraw->m_formTrack = formTrack;
|
||||
FormDraw *formDraw = qobject_cast<FormDraw*>(vecWgt.at(2));
|
||||
if(formDraw == nullptr)
|
||||
return;
|
||||
formDraw->setDrawData(listdt);
|
||||
|
||||
ui->tableWidget->setCellWidget(i, columnCount, formDraw);
|
||||
}
|
||||
}
|
||||
// emit CallManage::getInstance()->sig_AddDepth(m_strUuid, strSlfName, strWellName, strTrackName, strLineName, nW);
|
||||
|
||||
}
|
||||
|
||||
QJsonObject FormWell::makeJson()
|
||||
|
|
@ -496,21 +431,31 @@ QJsonObject FormWell::makeJson()
|
|||
int columnCount = ui->tableWidget->columnCount();//总列数
|
||||
for(int i=0; i<columnCount; i++)
|
||||
{
|
||||
QJsonObject formTrackObj;
|
||||
formTrackObj["id"] = i;
|
||||
if( ui->tableWidget->cellWidget(0, i) != nullptr )
|
||||
{
|
||||
auto myWidget = ui->tableWidget->cellWidget(0, i);
|
||||
FormTrackTop* fromTop = qobject_cast<FormTrackTop*>(myWidget);
|
||||
if(fromTop)
|
||||
{
|
||||
QJsonObject jobj = fromTop->makeJson();
|
||||
formTrackObj["topinfo"] = jobj;
|
||||
}
|
||||
}
|
||||
|
||||
if( ui->tableWidget->cellWidget(1, i) != nullptr )
|
||||
{
|
||||
auto myWidget = ui->tableWidget->cellWidget(1, i);
|
||||
//
|
||||
FormTrack *formTrack = (FormTrack*)myWidget;//获得widget
|
||||
if(formTrack)
|
||||
{
|
||||
//options
|
||||
QJsonObject formTrackObj;
|
||||
formTrackObj["id"] = i;
|
||||
formTrackObj["info"] = formTrack->makeJson();
|
||||
}
|
||||
}
|
||||
subcaseArray.append(formTrackObj);
|
||||
}
|
||||
}
|
||||
}
|
||||
rootObj["formTracks"]=subcaseArray;
|
||||
|
||||
return rootObj;
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@
|
|||
#include <QWidget>
|
||||
#include "formtrack.h"
|
||||
#include "formdraw.h"
|
||||
#include "formtracktop.h"
|
||||
|
||||
#pragma execution_character_set("utf-8")
|
||||
|
||||
|
|
@ -22,6 +23,8 @@ public:
|
|||
// 插入列,返回列索引
|
||||
int insertColumn(int nw);
|
||||
|
||||
QVector<QWidget*> new_track(QStringList listdt);
|
||||
|
||||
private:
|
||||
Ui::FormWell *ui;
|
||||
|
||||
|
|
@ -48,6 +51,8 @@ public slots:
|
|||
//新建空白道,没有曲线
|
||||
void s_NewTrack_No_Line(QString strUuid, QString strWellName, QString strTrackName);
|
||||
|
||||
void slot_NewTrack_No_Line(QString strUuid, QJsonObject obj);
|
||||
|
||||
void s_Raise(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, int iTableType, QString strFormInfoType);
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -68,6 +68,7 @@ SOURCES += \
|
|||
formline.cpp \
|
||||
formmultiheads.cpp \
|
||||
formtrack.cpp \
|
||||
formtracktop.cpp \
|
||||
formwell.cpp \
|
||||
mainwindow.cpp \
|
||||
main.cpp \
|
||||
|
|
@ -128,6 +129,7 @@ HEADERS += \
|
|||
formline.h \
|
||||
formmultiheads.h \
|
||||
formtrack.h \
|
||||
formtracktop.h \
|
||||
formwell.h \
|
||||
mainwindow.h \
|
||||
mainwindowcurve.h \
|
||||
|
|
@ -152,6 +154,7 @@ FORMS += \
|
|||
formline.ui \
|
||||
formmultiheads.ui \
|
||||
formtrack.ui \
|
||||
formtracktop.ui \
|
||||
formwell.ui \
|
||||
interfaceWidget.ui \
|
||||
mainwindow.ui \
|
||||
|
|
|
|||
|
|
@ -114,6 +114,9 @@ MainWindowCurve::MainWindowCurve(QWidget *parent) :
|
|||
connect(CallManage::getInstance(), SIGNAL(sig_changeScale(QString, int)), this, SLOT(s_changeScale(QString, int)));
|
||||
connect(CallManage::getInstance(), SIGNAL(sig_changeDepth(QString, QString, QString, int, int)), this, SLOT(s_changeDepth(QString, QString, QString, int, int)));
|
||||
connect(CallManage::getInstance(), SIGNAL(sig_changeWidth(QString, QString, QString, QString, int, int)), this, SLOT(s_changeWidth(QString, QString, QString, QString, int, int)));
|
||||
|
||||
connect(CallManage::getInstance(), SIGNAL(sig_changeTrackProperty(QVariantList)), this, SLOT(s_changeTrackProperty(QVariantList)));
|
||||
|
||||
//曲线选中,置顶
|
||||
connect(CallManage::getInstance(), SIGNAL(sig_Raise(QString, QString, QString, QString, QString, int, QString)), this, SLOT(s_Raise(QString, QString, QString, QString, QString, int, QString)));
|
||||
//右键--添加分段线
|
||||
|
|
@ -2392,6 +2395,11 @@ void MainWindowCurve::s_NewTrack_No_Line(QString strWellName, QString strTrackNa
|
|||
emit CallManage::getInstance()->sig_NewTrack_No_Line(m_strUuid, strWellName, strTrackName);
|
||||
}
|
||||
|
||||
void MainWindowCurve::s_NewTrack_No_Line(QJsonObject obj)
|
||||
{
|
||||
emit CallManage::getInstance()->sig_NewTrack_No_Line(m_strUuid, obj);
|
||||
}
|
||||
|
||||
//新建曲线,带属性
|
||||
void MainWindowCurve::s_AddLine_Property(QString strSlfName, QString strWellName, QString strTrackName, QString strLineName,
|
||||
double newLeftScale, double newRightScale, QString strScaleType, QColor lineColor, double width, Qt::PenStyle lineStyle)
|
||||
|
|
@ -2978,6 +2986,55 @@ void MainWindowCurve::s_changeWidth(QString strUuid, QString strSlfName, QString
|
|||
}
|
||||
}
|
||||
|
||||
void MainWindowCurve::s_changeTrackProperty(QVariantList vlist)
|
||||
{
|
||||
QString strUuid = vlist.at(0).toString();
|
||||
QString strSlfName = vlist.at(1).toString();
|
||||
QString strWellName = vlist.at(2).toString();
|
||||
|
||||
int columnCount = ui->tableWidget_2->columnCount();//总列数
|
||||
for(int i=0; i<columnCount; i++)
|
||||
{
|
||||
if(i%2!=0)
|
||||
continue;
|
||||
|
||||
if( ui->tableWidget_2->cellWidget(1, i) == nullptr )
|
||||
continue;
|
||||
|
||||
auto myWidget = ui->tableWidget_2->cellWidget(1, i);
|
||||
if(myWidget == nullptr)
|
||||
continue;
|
||||
//
|
||||
FormWell *widgetWell = (FormWell*)myWidget;//获得widget
|
||||
if(widgetWell == nullptr)
|
||||
continue;
|
||||
|
||||
if(widgetWell->m_strUuid==strUuid
|
||||
&& widgetWell->m_strSlfName==strSlfName
|
||||
&& widgetWell->m_strWellName==strWellName)
|
||||
{
|
||||
|
||||
int iCurrentCol = vlist.at(3).toInt();
|
||||
QString strProperty = vlist.at(4).toString();
|
||||
if("道宽(cm)" == strProperty)
|
||||
{
|
||||
QString strTrackName = vlist.at(5).toString();
|
||||
int iNewWidth = vlist.at(5).toInt();
|
||||
iNewWidth = iNewWidth * g_dPixelPerCm;
|
||||
int iWellWidth = widgetWell->setColWidth(iCurrentCol, iNewWidth);
|
||||
|
||||
//调整井宽
|
||||
ui->tableWidget_2->setColumnWidth(i, iWellWidth);
|
||||
}
|
||||
else if("道名称" == strProperty)
|
||||
{
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindowCurve::slot_time()
|
||||
{
|
||||
}
|
||||
|
|
@ -3181,7 +3238,6 @@ void MainWindowCurve::DisplayWells(QJsonArray wellsArray)
|
|||
//按照id顺序,展示井
|
||||
QJsonValue wellValue = wellsArray[iNum];
|
||||
QJsonObject wellObj = wellValue.toObject();
|
||||
//
|
||||
if (wellObj.contains("info"))
|
||||
{
|
||||
QJsonValue value = wellObj.value("info");
|
||||
|
|
@ -3281,6 +3337,16 @@ void MainWindowCurve::DisplayTracks(QJsonArray tracksArray)
|
|||
QJsonValue trackValue = tracksArray[iNum];
|
||||
QJsonObject trackObj = trackValue.toObject();
|
||||
//
|
||||
//
|
||||
if (trackObj.contains("topinfo"))
|
||||
{
|
||||
QJsonValue value = trackObj.value("topinfo");
|
||||
if (value.isObject()) {
|
||||
QJsonObject trackObjInfo = value.toObject();
|
||||
//展示其中一道
|
||||
DisplayTrack_Top(trackObjInfo, id);
|
||||
}
|
||||
}
|
||||
if (trackObj.contains("info"))
|
||||
{
|
||||
QJsonValue value = trackObj.value("info");
|
||||
|
|
@ -3294,24 +3360,22 @@ void MainWindowCurve::DisplayTracks(QJsonArray tracksArray)
|
|||
}
|
||||
}
|
||||
|
||||
//展示其中一道
|
||||
void MainWindowCurve::DisplayTrack_One(QJsonObject trackObjInfo, int id)
|
||||
void MainWindowCurve::DisplayTrack_Top(QJsonObject trackTop, int id)
|
||||
{
|
||||
QString strWellName = "";
|
||||
QString strTrackName = "";
|
||||
QJsonArray linesArray;
|
||||
|
||||
if (trackObjInfo.contains("WellName"))
|
||||
if (trackTop.contains("WellName"))
|
||||
{
|
||||
QJsonValue value = trackObjInfo.value("WellName");
|
||||
QJsonValue value = trackTop.value("WellName");
|
||||
if (value.isString()) {
|
||||
strWellName = value.toString();
|
||||
qDebug() << "WellName:" << strWellName;
|
||||
}
|
||||
}
|
||||
if (trackObjInfo.contains("TrackName"))
|
||||
if (trackTop.contains("TrackName"))
|
||||
{
|
||||
QJsonValue value = trackObjInfo.value("TrackName");
|
||||
QJsonValue value = trackTop.value("TrackName");
|
||||
if (value.isString()) {
|
||||
strTrackName = value.toString();
|
||||
qDebug() << "TrackName:" << strTrackName;
|
||||
|
|
@ -3319,20 +3383,24 @@ void MainWindowCurve::DisplayTrack_One(QJsonObject trackObjInfo, int id)
|
|||
}
|
||||
|
||||
//新建道+曲线
|
||||
s_NewTrack_No_Line(strWellName, strTrackName);//新建空白道,没有曲线
|
||||
s_NewTrack_No_Line(trackTop);//新建空白道,没有曲线
|
||||
if(id>0)
|
||||
{
|
||||
//改变井宽
|
||||
s_NewTrackChangeWidth(strWellName);
|
||||
//mainWindowCurve->s_NewTrackChangeWidth(strWellName);
|
||||
}
|
||||
}
|
||||
|
||||
//展示其中一道
|
||||
void MainWindowCurve::DisplayTrack_One(QJsonObject trackObjInfo, int id)
|
||||
{
|
||||
//
|
||||
if (trackObjInfo.contains("formInfos"))
|
||||
{
|
||||
QJsonValue value = trackObjInfo.value("formInfos");
|
||||
if (value.isArray()) {
|
||||
linesArray = value.toArray();
|
||||
QJsonArray linesArray = value.toArray();
|
||||
qDebug() << "linesArray number:" << QString::number(linesArray.size());
|
||||
//展示所有曲线
|
||||
DisplayLines(linesArray);
|
||||
|
|
|
|||
|
|
@ -54,6 +54,8 @@ public slots:
|
|||
void s_changeDepth(QString strUuid, QString strSlfName, QString strWellName, int iY1, int iY2);
|
||||
//改变道宽
|
||||
void s_changeWidth(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, int iCurrentCol, int iNewWidth);
|
||||
//改变属性
|
||||
void s_changeTrackProperty(QVariantList vlist);
|
||||
|
||||
void onItemClicked(QTableWidgetItem* item);
|
||||
void mousePressEvent(QMouseEvent *event);
|
||||
|
|
@ -109,6 +111,8 @@ public:
|
|||
void DisplayWell_One(QJsonObject wellObjInfo);
|
||||
//展示所有道
|
||||
void DisplayTracks(QJsonArray tracksArray);
|
||||
|
||||
void DisplayTrack_Top(QJsonObject trackTop, int id);
|
||||
//展示其中一道
|
||||
void DisplayTrack_One(QJsonObject trackObjInfo, int id);
|
||||
//展示所有曲线
|
||||
|
|
@ -149,6 +153,7 @@ public slots:
|
|||
void s_NewWell(QString strWellName, QString strSlfName);//新建井
|
||||
void s_NewTrackChangeWidth(QString strWellName, int nW=0);//新建道后,改变井宽
|
||||
void s_NewTrack_No_Line(QString strWellName, QString strTrackName);//新建空白道,没有曲线
|
||||
void s_NewTrack_No_Line(QJsonObject obj);//新建空白道,没有曲线
|
||||
void s_AddLine_Property(QString strSlfName, QString strWellName, QString strTrackName, QString strLineName,
|
||||
double newLeftScale, double newRightScale, QString strScaleType, QColor lineColor, double width, Qt::PenStyle lineStyle);//新建曲线,带属性
|
||||
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@
|
|||
|
||||
#include "CallManage.h"
|
||||
#include "PropertyWidget.h"
|
||||
#include "formtracktop.h"
|
||||
|
||||
//针对道
|
||||
QMyTableWidget::QMyTableWidget(QWidget *parent) :
|
||||
|
|
@ -126,6 +127,7 @@ void QMyTableWidget::mouseReleaseEvent(QMouseEvent *event)
|
|||
m_press = false;//按下标志置fasle,形成互斥
|
||||
|
||||
int iCurrentRow = currentRow();
|
||||
int iCurrentCol = currentColumn();
|
||||
qDebug()<<"QMyTableWidget mouseReleaseEvent, iCurrentRow=" << QString::number(iCurrentRow);
|
||||
|
||||
if(iCurrentRow<0)
|
||||
|
|
@ -134,21 +136,25 @@ void QMyTableWidget::mouseReleaseEvent(QMouseEvent *event)
|
|||
PropertyService()->initWidgetProperty(m_strUuid, m_iScale);
|
||||
}
|
||||
else {
|
||||
QTableWidgetItem *item = currentItem();
|
||||
if(item)
|
||||
if( cellWidget(iCurrentRow, iCurrentCol) != nullptr )
|
||||
{
|
||||
QString strTrackName = item->text();
|
||||
QString strUuid = item->data(Qt::UserRole+1).toString();
|
||||
QString strWellName = item->data(Qt::UserRole+2).toString();
|
||||
QString strSlfName = item->data(Qt::UserRole+3).toString();
|
||||
auto myWidget = cellWidget(currentRow(), iCurrentCol);
|
||||
FormTrackTop *formTop = qobject_cast<FormTrackTop*>(myWidget);//获得widget
|
||||
if(formTop)
|
||||
{
|
||||
QString strTrackName = formTop->m_strTrackName;
|
||||
QString strUuid = formTop->m_strUuid;
|
||||
QString strWellName = formTop->m_strWellName;
|
||||
QString strSlfName = formTop->m_strSlfName;
|
||||
//
|
||||
int iCurrentCol = currentColumn();
|
||||
int iWidth = columnWidth(iCurrentCol);
|
||||
|
||||
PropertyService()->initTrackProperty(item, iWidth, this, iCurrentCol);
|
||||
PropertyService()->initTrackProperty(formTop, iWidth, this, iCurrentCol);
|
||||
//
|
||||
emit CallManage::getInstance()->sig_Raise(strUuid, strSlfName, strWellName, strTrackName, "", 2, "");
|
||||
}
|
||||
}
|
||||
else {
|
||||
qDebug()<<"QMyTableWidget mouseReleaseEvent, item=null";
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user