支持波列数据的成像化展示,目前展示--可变密度模式
This commit is contained in:
parent
ca21b8fda8
commit
df2adc07f9
|
|
@ -40,12 +40,16 @@ signals:
|
||||||
void sig_ShowCurve(QString strSlfName, QString strName);//曲线数据查看
|
void sig_ShowCurve(QString strSlfName, QString strName);//曲线数据查看
|
||||||
void sig_ShowTable(QString strSlfName, QString strName);//表格数据查看
|
void sig_ShowTable(QString strSlfName, QString strName);//表格数据查看
|
||||||
|
|
||||||
void sig_NewTrack(QString strUuid, QString strWellName, QString strSlfName, QString strLineName);//新建道
|
void sig_NewTrack(QString strUuid, QString strWellName, QString strSlfName, QString strLineName, QString strType);//新建道
|
||||||
void sig_NewTrack_No_Line(QString strUuid, QString strWellName, QString strTrackName);//新建空白道,没有曲线
|
void sig_NewTrack_No_Line(QString strUuid, QString strWellName, QString strTrackName);//新建空白道,没有曲线
|
||||||
void sig_AddLine(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName);//新建曲线
|
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,
|
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);//新建曲线,带属性
|
double newLeftScale, double newRightScale, QString strScaleType, QColor lineColor, double width, Qt::PenStyle lineStyle);//新建曲线,带属性
|
||||||
void sig_delLine(QString strUuid, QString strWellName, QString strTrackName, QString strLineName);//删除曲线
|
void sig_delLine(QString strUuid, QString strWellName, QString strTrackName, QString strLineName);//删除曲线
|
||||||
|
|
||||||
|
//新建波列
|
||||||
|
void sig_AddWave(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strWaveName);
|
||||||
|
|
||||||
//属性
|
//属性
|
||||||
//左刻度
|
//左刻度
|
||||||
void sig_ChangeLeftScale(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, double newLeftScale);
|
void sig_ChangeLeftScale(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, double newLeftScale);
|
||||||
|
|
|
||||||
|
|
@ -49,6 +49,9 @@ FormDraw::FormDraw(QWidget *parent, QString strWellName, QString strTrackName) :
|
||||||
this, SLOT(s_AddLine_Property(QString, QString, QString, QString, QString, double, double, QString, QColor, double, Qt::PenStyle)));
|
this, SLOT(s_AddLine_Property(QString, QString, QString, QString, QString, double, double, QString, QColor, double, Qt::PenStyle)));
|
||||||
connect(CallManage::getInstance(), SIGNAL(sig_delLine(QString, QString, QString, QString)), this, SLOT(s_delLine(QString, QString, QString, QString)));
|
connect(CallManage::getInstance(), SIGNAL(sig_delLine(QString, QString, QString, QString)), this, SLOT(s_delLine(QString, QString, QString, QString)));
|
||||||
connect(CallManage::getInstance(), SIGNAL(sig_MouseMove(QString, QString, QString, float)), this, SLOT(s_MouseMove(QString, QString, QString, float)));
|
connect(CallManage::getInstance(), SIGNAL(sig_MouseMove(QString, QString, QString, float)), this, SLOT(s_MouseMove(QString, QString, QString, float)));
|
||||||
|
//波列
|
||||||
|
connect(CallManage::getInstance(), SIGNAL(sig_AddWave(QString, QString, QString, QString, QString)), this, SLOT(s_addWave(QString, QString, QString, QString, QString)));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
FormDraw::~FormDraw()
|
FormDraw::~FormDraw()
|
||||||
|
|
@ -194,6 +197,58 @@ AppendConsole(PAI_INFO, "FormDraw s_AddLine_Property");
|
||||||
AppendConsole(PAI_INFO, "FormDraw s_AddLine_Property end");
|
AppendConsole(PAI_INFO, "FormDraw s_AddLine_Property end");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void FormDraw::s_addWave(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strWaveName)
|
||||||
|
{
|
||||||
|
//井名&道名不一致
|
||||||
|
if(strUuid == m_strUuid && m_strWellName == strWellName && m_strTrackName == strTrackName)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(m_listWaveName.contains(strWaveName))
|
||||||
|
{
|
||||||
|
qDebug() << "FormDraw strLineName already exist! " << strWaveName;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
QMyCustomPlot *curv = new QMyCustomPlot(this, strSlfName, strWellName, strTrackName, strWaveName);
|
||||||
|
curv->m_strUuid = m_strUuid;
|
||||||
|
//背景设置成透明色
|
||||||
|
curv->setBackground(Qt::transparent);
|
||||||
|
curv->setStyleSheet("background: transparent;");
|
||||||
|
//
|
||||||
|
//QRect rect = this->rect();
|
||||||
|
//curv->setGeometry(rect.left(),rect.top(), rect.width(), rect.height());
|
||||||
|
|
||||||
|
double dHight = 0;
|
||||||
|
dHight = (g_iY2-g_iY1)*100.0/(double)g_iScale * g_dPixelPerCm;
|
||||||
|
|
||||||
|
qDebug() << "FormDraw dHight=" << QString::number((int)dHight-3184);
|
||||||
|
if(dHight>32767)
|
||||||
|
{
|
||||||
|
dHight = 32767;
|
||||||
|
}
|
||||||
|
|
||||||
|
//curv->setMaximumHeight((int)dHight);
|
||||||
|
//curv->setViewport(QRect(0, 0, g_iOneWidth, (int)dHight));//7500-3184
|
||||||
|
curv->setGeometry(0, 0, g_iOneWidth, (int)dHight);//7500-3184
|
||||||
|
|
||||||
|
|
||||||
|
//curv->resize(INT_MAX, INT_MAX); // 使用 INT_MAX 来避免16位整数的限制
|
||||||
|
// QSizePolicy policy(QSizePolicy::Expanding, QSizePolicy::Expanding);
|
||||||
|
// curv->setSizePolicy(policy);
|
||||||
|
|
||||||
|
curv->show();
|
||||||
|
initWave(curv, strSlfName, strWaveName);
|
||||||
|
connect(curv, SIGNAL(mouseWheel(QWheelEvent*)), this, SLOT(s_mouseWheel(QWheelEvent*)));
|
||||||
|
|
||||||
|
//
|
||||||
|
m_listWaveName.push_back(strWaveName);
|
||||||
|
}
|
||||||
|
|
||||||
void FormDraw::s_mouseWheel(QWheelEvent *event)
|
void FormDraw::s_mouseWheel(QWheelEvent *event)
|
||||||
{
|
{
|
||||||
|
|
@ -490,6 +545,7 @@ void FormDraw::initForm(QMyCustomPlot *widget, QString strSlfName, QString strLi
|
||||||
|
|
||||||
CLogIO *logio=new CLogIO();
|
CLogIO *logio=new CLogIO();
|
||||||
logio->Open(strSlfName.toStdString().c_str(),CSlfIO::modeRead);
|
logio->Open(strSlfName.toStdString().c_str(),CSlfIO::modeRead);
|
||||||
|
//
|
||||||
int index=logio->OpenCurve(strLineName.toStdString().c_str());
|
int index=logio->OpenCurve(strLineName.toStdString().c_str());
|
||||||
if(index<0) {
|
if(index<0) {
|
||||||
delete logio;
|
delete logio;
|
||||||
|
|
@ -629,6 +685,179 @@ void FormDraw::initForm(QMyCustomPlot *widget, QString strSlfName, QString strLi
|
||||||
//AppendConsole(PAI_INFO, "FormDraw initForm end");
|
//AppendConsole(PAI_INFO, "FormDraw initForm end");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
double GetData(int RepCode,char *buffer)
|
||||||
|
{
|
||||||
|
double yy;
|
||||||
|
if(!buffer) return 0;
|
||||||
|
switch(RepCode)
|
||||||
|
{
|
||||||
|
case REPR_INT: //0
|
||||||
|
yy=(double)(*((int*)buffer));
|
||||||
|
break;
|
||||||
|
case REPR_SHORT: //1
|
||||||
|
yy=(double)(*((short *)buffer));
|
||||||
|
break;
|
||||||
|
case REPR_LONG://2
|
||||||
|
yy=(double)(*((long *)buffer));
|
||||||
|
break;
|
||||||
|
case REPR_FLOAT://3
|
||||||
|
yy=(double)(*((float *)buffer));
|
||||||
|
break;
|
||||||
|
case REPR_DOUBLE://4
|
||||||
|
yy=(double)(*((double *)buffer));
|
||||||
|
break;
|
||||||
|
case REPR_CHAR://5
|
||||||
|
yy=(double)(*((char *)buffer));
|
||||||
|
break;
|
||||||
|
case REPR_UCHAR://6
|
||||||
|
yy=(double)(*((unsigned char *)buffer));
|
||||||
|
break;
|
||||||
|
case REPR_USHORT://7
|
||||||
|
yy=(double)(*((unsigned short *)buffer));
|
||||||
|
break;
|
||||||
|
case REPR_UINT://8
|
||||||
|
yy=(double)(*((unsigned int *)buffer));
|
||||||
|
break;
|
||||||
|
case REPR_ULONG://9
|
||||||
|
yy=(double)(*((unsigned long *)buffer));
|
||||||
|
break;
|
||||||
|
case REPR_STRING://10
|
||||||
|
yy=-99999;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return yy;
|
||||||
|
}
|
||||||
|
|
||||||
|
void FormDraw::initWave(QMyCustomPlot *widget, QString strSlfName, QString strWaveName)
|
||||||
|
{
|
||||||
|
CLogIO *logio=new CLogIO();
|
||||||
|
logio->Open(strSlfName.toStdString().c_str(),CSlfIO::modeRead);
|
||||||
|
//
|
||||||
|
int index=logio->OpenWave(strWaveName.toStdString().c_str());
|
||||||
|
if(index<0) {
|
||||||
|
delete logio;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Slf_WAVE _wave;
|
||||||
|
logio->GetWaveInfo(index, &_wave);
|
||||||
|
float _SDep,_EDep,_Rlev;
|
||||||
|
// _SDep = _wave.StartDepth;
|
||||||
|
// _EDep = _wave.EndDepth;
|
||||||
|
_SDep = 0.0 - g_iY2;
|
||||||
|
_EDep = 0.0 - g_iY1;
|
||||||
|
_Rlev = _wave.DepLevel;
|
||||||
|
int m_Record=(float)(fabs((_EDep-_SDep)/_Rlev+0.5));
|
||||||
|
|
||||||
|
int _nSamples = _wave.TimeSamples;
|
||||||
|
|
||||||
|
char *value=new char[(_wave.TimeSamples+1)*m_Record*_wave.CodeLen+1];
|
||||||
|
logio->ReadWave(index,_SDep,m_Record,(void *)value);
|
||||||
|
logio->CloseWave(index);
|
||||||
|
delete logio;
|
||||||
|
|
||||||
|
|
||||||
|
float vmax = (float)_wave.TimeSamples;
|
||||||
|
float vmin = 0;
|
||||||
|
//
|
||||||
|
double** wavedata;
|
||||||
|
wavedata = new double*[_wave.TimeSamples];
|
||||||
|
for(int kk = 0;kk<_wave.TimeSamples;kk++){
|
||||||
|
wavedata[kk] = new double[m_Record];
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i=0; i<m_Record; i++)
|
||||||
|
{
|
||||||
|
for(int kk = 0;kk<_wave.TimeSamples;kk++)
|
||||||
|
{
|
||||||
|
double val = GetData(_wave.RepCode,(char *)&value[(kk)*_wave.CodeLen+i*_nSamples*_wave.CodeLen]);
|
||||||
|
wavedata[kk][i] = val;
|
||||||
|
if(val==-9999)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
//
|
||||||
|
// if(vmax<val)vmax=val;
|
||||||
|
// if(vmin>val)vmin=val;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
delete[] value;
|
||||||
|
|
||||||
|
// g_iY1 = 0.0 -_EDep;
|
||||||
|
// g_iY2 = 0.0 -_SDep;
|
||||||
|
//------------------------
|
||||||
|
widget->m_iX1 = vmin;
|
||||||
|
widget->m_iX2 = vmax;
|
||||||
|
widget->m_iY1 = g_iY1;
|
||||||
|
widget->m_iY2 = g_iY2;
|
||||||
|
//
|
||||||
|
widget->xAxis->setRange(vmin, vmax);
|
||||||
|
widget->yAxis->setRange(g_iY1, g_iY2);
|
||||||
|
widget->axisRect()->setupFullAxesBox();
|
||||||
|
//
|
||||||
|
widget->xAxis->ticker()->setTickCount(10);//x个主刻度
|
||||||
|
widget->yAxis->ticker()->setTickCount(60);//y个主刻度
|
||||||
|
|
||||||
|
//对调XY轴,在最前面设置
|
||||||
|
QCPAxis *yAxis = widget->yAxis;
|
||||||
|
QCPAxis *xAxis = widget->xAxis;
|
||||||
|
widget->xAxis = yAxis;
|
||||||
|
widget->yAxis = xAxis;
|
||||||
|
|
||||||
|
//-------------------
|
||||||
|
// set up the QCPColorMap:
|
||||||
|
QCPColorMap *colorMap = new QCPColorMap(widget->xAxis, widget->yAxis);
|
||||||
|
int nx = m_Record;
|
||||||
|
int ny = _wave.TimeSamples;
|
||||||
|
colorMap->data()->setSize(nx, ny); // 我们希望彩色地图有nx*ny的数据点
|
||||||
|
colorMap->data()->setRange(QCPRange(g_iY1, g_iY2), QCPRange(vmin, vmax)); // 并在键(x)和值(y)维上跨越坐标范围-4..4
|
||||||
|
// :现在,我们通过访问颜色贴图的QCPColorMapData实例来分配一些数据:
|
||||||
|
double x, y, z;
|
||||||
|
for (int xIndex=0; xIndex<nx; ++xIndex)
|
||||||
|
{
|
||||||
|
for (int yIndex=0; yIndex<ny; ++yIndex)
|
||||||
|
{
|
||||||
|
// colorMap->data()->cellToCoord(xIndex, yIndex, &x, &y);
|
||||||
|
// double r = 3*qSqrt(x*x+y*y)+1e-2;
|
||||||
|
// z = 2*x*(qCos(r+2)/r-qSin(r+2)/r); // the B field strength of dipole radiation (modulo physical constants)
|
||||||
|
colorMap->data()->setCell(xIndex, yIndex, wavedata[yIndex][xIndex]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 添加色标:
|
||||||
|
QCPColorScale *colorScale = new QCPColorScale(widget);
|
||||||
|
widget->plotLayout()->addElement(0, 1, colorScale); // 将其添加到主轴矩形的右侧
|
||||||
|
colorScale->setType(QCPAxis::atRight); // 刻度应为垂直条,刻度线/坐标轴标签右侧(实际上,右侧已经是默认值)
|
||||||
|
colorMap->setColorScale(colorScale); // 将颜色图与色标关联
|
||||||
|
colorScale->axis()->setLabel("Magnetic Field Strength");
|
||||||
|
|
||||||
|
// 将颜色贴图的“颜色渐变”设置为其中一个预设
|
||||||
|
colorMap->setGradient(QCPColorGradient::gpPolar);//gpJet);
|
||||||
|
// 我们还可以创建一个QCPColorGradient实例并向其中添加自己的颜色
|
||||||
|
// 渐变,请参阅QCPColorGradient的文档以获取可能的效果.
|
||||||
|
|
||||||
|
// 重新缩放数据维度(颜色),以使所有数据点都位于颜色渐变显示的范围内:
|
||||||
|
colorMap->rescaleDataRange();
|
||||||
|
|
||||||
|
//确保轴rect和色标同步其底边距和顶边距(以便它们对齐):
|
||||||
|
QCPMarginGroup *marginGroup = new QCPMarginGroup(widget);
|
||||||
|
widget->axisRect()->setMarginGroup(QCP::msBottom|QCP::msTop, marginGroup);
|
||||||
|
colorScale->setMarginGroup(QCP::msBottom|QCP::msTop, marginGroup);
|
||||||
|
|
||||||
|
// 重新缩放键(x)和值(y)轴,以便可以看到整个颜色图:
|
||||||
|
//widget->rescaleAxes();
|
||||||
|
|
||||||
|
QString strAliasName = "";
|
||||||
|
QString strUnit = "";
|
||||||
|
QColor newlineColor=QColor(0,0,0);
|
||||||
|
double width=2;
|
||||||
|
QString strScaleType = "";
|
||||||
|
//道-对象
|
||||||
|
m_formTrack->Add(strSlfName, m_strWellName, m_strTrackName, strWaveName, strAliasName, strUnit, newlineColor, width, vmax, vmin, strScaleType, "waveObject");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
void FormDraw::addRandomGraph(QMyCustomPlot *widget, QVector<double> x, QVector<double> y, QString strSlfName, QString strLineName, QString strAliasName, QString strUnit,
|
void FormDraw::addRandomGraph(QMyCustomPlot *widget, QVector<double> x, QVector<double> y, QString strSlfName, QString strLineName, QString strAliasName, QString strUnit,
|
||||||
double newLeftScale, double newRightScale, QString strScaleType, QColor newlineColor, double width, Qt::PenStyle lineStyle)
|
double newLeftScale, double newRightScale, QString strScaleType, QColor newlineColor, double width, Qt::PenStyle lineStyle)
|
||||||
{
|
{
|
||||||
|
|
@ -636,7 +865,7 @@ void FormDraw::addRandomGraph(QMyCustomPlot *widget, QVector<double> x, QVector<
|
||||||
widget->addRandomGraph(x, y, strSlfName, strLineName, strAliasName, strUnit,
|
widget->addRandomGraph(x, y, strSlfName, strLineName, strAliasName, strUnit,
|
||||||
newLeftScale, newRightScale, strScaleType, newlineColor, width, lineStyle);
|
newLeftScale, newRightScale, strScaleType, newlineColor, width, lineStyle);
|
||||||
//道-对象
|
//道-对象
|
||||||
m_formTrack->Add(strSlfName, m_strWellName, m_strTrackName, strLineName, strAliasName, strUnit, newlineColor, width, m_vmax, m_vmin, strScaleType);
|
m_formTrack->Add(strSlfName, m_strWellName, m_strTrackName, strLineName, strAliasName, strUnit, newlineColor, width, m_vmax, m_vmin, strScaleType, "curveObject");
|
||||||
|
|
||||||
//AppendConsole(PAI_INFO, "FormDraw addRandomGraph");
|
//AppendConsole(PAI_INFO, "FormDraw addRandomGraph");
|
||||||
// widget->addGraph();
|
// widget->addGraph();
|
||||||
|
|
@ -749,8 +978,35 @@ void FormDraw::dropEvent(QDropEvent* event)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// 如果数据格式不正确,不接受拖拽事件
|
QStringList listWave = strExtern.split("#$$#");//QString字符串分割函数
|
||||||
event->ignore();
|
if (listWave.size() > 2)
|
||||||
|
{
|
||||||
|
QString strSlfName = listWave[0];
|
||||||
|
QString strWellName = listWave[1];
|
||||||
|
QString strWaveName = listWave[2];
|
||||||
|
|
||||||
|
qDebug() << "strSlfName:" << strSlfName<< " strWellName:" << strWellName<< " strWaveName:" << strWaveName;
|
||||||
|
|
||||||
|
if(m_strWellName == strWellName)
|
||||||
|
{
|
||||||
|
//新建曲线
|
||||||
|
//emit CallManage::getInstance()->sig_AddWave(m_strUuid, strSlfName, strWellName, m_strTrackName, strWaveName);
|
||||||
|
|
||||||
|
// 接受拖拽事件
|
||||||
|
event->setDropAction(Qt::MoveAction);
|
||||||
|
event->accept();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// 如果井名不正确,不接受拖拽事件
|
||||||
|
event->ignore();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// 如果数据格式不正确,不接受拖拽事件
|
||||||
|
event->ignore();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -46,6 +46,7 @@ public:
|
||||||
FormTrack *m_formTrack;
|
FormTrack *m_formTrack;
|
||||||
|
|
||||||
QStringList m_listLineName;
|
QStringList m_listLineName;
|
||||||
|
QStringList m_listWaveName;
|
||||||
|
|
||||||
//X坐标
|
//X坐标
|
||||||
float m_vmax;
|
float m_vmax;
|
||||||
|
|
@ -59,6 +60,9 @@ public:
|
||||||
void setupLineStyleDemo(QMyCustomPlot *customPlot);
|
void setupLineStyleDemo(QMyCustomPlot *customPlot);
|
||||||
void setupSelectionDemo(QMyCustomPlot *customPlot);
|
void setupSelectionDemo(QMyCustomPlot *customPlot);
|
||||||
|
|
||||||
|
void initWave(QMyCustomPlot *widget, QString strSlfName, QString strWaveName);
|
||||||
|
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
//void sig_AddLine(QString strSlfName, QString strWellName, QString strTrackName, QString strLineName);
|
//void sig_AddLine(QString strSlfName, QString strWellName, QString strTrackName, QString strLineName);
|
||||||
|
|
||||||
|
|
@ -72,6 +76,9 @@ public slots:
|
||||||
void s_MouseMove(QString strUuid, QString strWellName, QString strTrackName, float dep);
|
void s_MouseMove(QString strUuid, QString strWellName, QString strTrackName, float dep);
|
||||||
void s_handleRectRangeChange(QCPRange newRange);
|
void s_handleRectRangeChange(QCPRange newRange);
|
||||||
void s_selectionRectAccepted(const QRect &rect, QMouseEvent *event);
|
void s_selectionRectAccepted(const QRect &rect, QMouseEvent *event);
|
||||||
|
|
||||||
|
//
|
||||||
|
void s_addWave(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strWaveName);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // FORMDRAW_H
|
#endif // FORMDRAW_H
|
||||||
|
|
|
||||||
|
|
@ -248,8 +248,36 @@ void FormInfo::dropEvent(QDropEvent* event)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// 如果数据格式不正确,不接受拖拽事件
|
QStringList listWave = strExtern.split("#$$#");//QString字符串分割函数
|
||||||
event->ignore();
|
if (listWave.size() > 2)
|
||||||
|
{
|
||||||
|
QString strSlfName = listWave[0];
|
||||||
|
QString strWellName = listWave[1];
|
||||||
|
QString strWaveName = listWave[2];
|
||||||
|
|
||||||
|
qDebug() << "strSlfName:" << strSlfName<< " strWellName:" << strWellName<< " strLineName:" << strWaveName;
|
||||||
|
|
||||||
|
if(m_strWellName == strWellName)
|
||||||
|
{
|
||||||
|
//新建曲线
|
||||||
|
emit CallManage::getInstance()->sig_AddWave(m_strUuid, strSlfName, strWellName, m_strTrackName, strWaveName);
|
||||||
|
|
||||||
|
// 接受拖拽事件
|
||||||
|
event->setDropAction(Qt::MoveAction);
|
||||||
|
event->accept();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// 如果井名不正确,不接受拖拽事件
|
||||||
|
event->ignore();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// 如果数据格式不正确,不接受拖拽事件
|
||||||
|
event->ignore();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -62,6 +62,8 @@ public:
|
||||||
QString m_strLineName;
|
QString m_strLineName;
|
||||||
QString m_strAliasName;//显示名称
|
QString m_strAliasName;//显示名称
|
||||||
QString m_strUnit;//单位
|
QString m_strUnit;//单位
|
||||||
|
|
||||||
|
QString m_strType;//类型:curve, wave
|
||||||
//
|
//
|
||||||
double m_dWidth;//线宽
|
double m_dWidth;//线宽
|
||||||
QColor m_lineColor;//颜色
|
QColor m_lineColor;//颜色
|
||||||
|
|
|
||||||
|
|
@ -41,8 +41,12 @@ FormTrack::FormTrack(QWidget *parent, QString strWellName, QString strTrackName)
|
||||||
header->setSectionResizeMode(i, QHeaderView::Stretch);
|
header->setSectionResizeMode(i, QHeaderView::Stretch);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//曲线
|
||||||
connect(this, SIGNAL(sig_AddLine(QString, QString, QString, QString, QString, QString, QColor, double, float, float, QString)),
|
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)));
|
this, SLOT(s_addLine(QString, QString, QString, QString, QString, QString, QColor, double, float, float, QString)));
|
||||||
|
//波列
|
||||||
|
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)));
|
||||||
|
|
||||||
//曲线选中,置顶
|
//曲线选中,置顶
|
||||||
connect(CallManage::getInstance(), SIGNAL(sig_Raise(QString, QString, QString, QString, QString)), this, SLOT(s_Raise(QString, QString, QString, QString, QString)));
|
connect(CallManage::getInstance(), SIGNAL(sig_Raise(QString, QString, QString, QString, QString)), this, SLOT(s_Raise(QString, QString, QString, QString, QString)));
|
||||||
|
|
@ -68,11 +72,18 @@ FormTrack::~FormTrack()
|
||||||
delete ui;
|
delete ui;
|
||||||
}
|
}
|
||||||
|
|
||||||
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)
|
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)
|
||||||
{
|
{
|
||||||
qDebug()<< "Add";
|
qDebug()<< "Add";
|
||||||
|
|
||||||
emit sig_AddLine(strSlfName, strWellName, m_strTrackName, strLineName, strAliasName, strUnit, lineColor, dWidth, vmax, vmin, strScaleType);
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -94,6 +105,7 @@ void FormTrack::s_addLine(QString strSlfName, QString strWellName, QString strTr
|
||||||
formInfo->m_strAliasName = strAliasName;
|
formInfo->m_strAliasName = strAliasName;
|
||||||
formInfo->m_strUnit = strUnit;
|
formInfo->m_strUnit = strUnit;
|
||||||
formInfo->m_strScaleType = strScaleType;
|
formInfo->m_strScaleType = strScaleType;
|
||||||
|
formInfo->m_strType = "curveObject";
|
||||||
formInfo->setLineWidth(dWidth);
|
formInfo->setLineWidth(dWidth);
|
||||||
formInfo->setVMax(vmax);
|
formInfo->setVMax(vmax);
|
||||||
formInfo->setVMin(vmin);
|
formInfo->setVMin(vmin);
|
||||||
|
|
@ -119,6 +131,49 @@ void FormTrack::s_addLine(QString strSlfName, QString strWellName, QString strTr
|
||||||
// ui->tableWidget->setItem(row, 0, item);
|
// ui->tableWidget->setItem(row, 0, item);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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);
|
||||||
|
|
||||||
|
|
||||||
|
//------------------------------------
|
||||||
|
// 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);
|
||||||
|
}
|
||||||
|
|
||||||
QJsonObject FormTrack::makeJson()
|
QJsonObject FormTrack::makeJson()
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -60,15 +60,17 @@ public:
|
||||||
//NoLRBorderDelegate *m_delegate;
|
//NoLRBorderDelegate *m_delegate;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void Add(QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, QString strAliasName, QString strUnit, QColor lineColor, double dWidth, float vmax, float vmin, QString strScaleType);
|
void 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);
|
||||||
|
|
||||||
QJsonObject makeJson();
|
QJsonObject makeJson();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void sig_AddLine(QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, QString strAliasName, QString strUnit, QColor lineColor, double dWidth, float vmax, float vmin, QString strScaleType);
|
void sig_AddLine(QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, QString strAliasName, QString strUnit, QColor lineColor, double dWidth, float vmax, float vmin, QString strScaleType);
|
||||||
|
void sig_AddWave(QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, QString strAliasName, QString strUnit, QColor lineColor, double dWidth, float vmax, float vmin, QString strScaleType);
|
||||||
|
|
||||||
public slots:
|
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);
|
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);
|
||||||
|
void s_addWave(QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, QString strAliasName, QString strUnit, QColor lineColor, double dWidth, float vmax, float vmin, QString strScaleType);
|
||||||
void s_Raise(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName);
|
void s_Raise(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@ FormWell::FormWell(QWidget *parent, QString strWellName) :
|
||||||
ui->tableWidget->horizontalHeader()->setFixedHeight(3);
|
ui->tableWidget->horizontalHeader()->setFixedHeight(3);
|
||||||
|
|
||||||
//关联信号槽
|
//关联信号槽
|
||||||
connect(CallManage::getInstance(), SIGNAL(sig_NewTrack(QString, QString, QString, QString)), this, SLOT(s_NewTrack(QString, QString, QString, QString)));
|
connect(CallManage::getInstance(), SIGNAL(sig_NewTrack(QString, QString, QString, QString, QString)), this, SLOT(s_NewTrack(QString, QString, QString, QString, QString)));
|
||||||
//关联信号槽
|
//关联信号槽
|
||||||
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, QString, QString)), this, SLOT(s_NewTrack_No_Line(QString, QString, QString)));
|
||||||
|
|
||||||
|
|
@ -46,7 +46,7 @@ void FormWell::s_Raise(QString strUuid, QString strSlfName, QString strWellName,
|
||||||
ui->tableWidget->clearSelection();
|
ui->tableWidget->clearSelection();
|
||||||
}
|
}
|
||||||
|
|
||||||
void FormWell::s_NewTrack(QString strUuid, QString strWellName, QString strSlfName, QString strLineName)
|
void FormWell::s_NewTrack(QString strUuid, QString strWellName, QString strSlfName, QString strLineName, QString strType)
|
||||||
{
|
{
|
||||||
//判断当前井是否与自己同名
|
//判断当前井是否与自己同名
|
||||||
if(strUuid != m_strUuid || strWellName != m_strWellName)
|
if(strUuid != m_strUuid || strWellName != m_strWellName)
|
||||||
|
|
@ -115,8 +115,16 @@ void FormWell::s_NewTrack(QString strUuid, QString strWellName, QString strSlfNa
|
||||||
|
|
||||||
if(strLineName!="")
|
if(strLineName!="")
|
||||||
{
|
{
|
||||||
//新建曲线
|
if(strType=="curveObject")
|
||||||
emit CallManage::getInstance()->sig_AddLine(m_strUuid, strSlfName, strWellName, strTrackName, strLineName);
|
{
|
||||||
|
//新建曲线
|
||||||
|
emit CallManage::getInstance()->sig_AddLine(m_strUuid, strSlfName, strWellName, strTrackName, strLineName);
|
||||||
|
}
|
||||||
|
else if(strType=="waveObject")
|
||||||
|
{
|
||||||
|
//新建波列
|
||||||
|
emit CallManage::getInstance()->sig_AddWave(m_strUuid, strSlfName, strWellName, strTrackName, strLineName);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//ui->tableWidget->resizeColumnsToContents(); // 调整列宽以适应内容
|
//ui->tableWidget->resizeColumnsToContents(); // 调整列宽以适应内容
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@ public:
|
||||||
void setRowHeight(double dHight, QProgressBar *progressBar, int iSplit);
|
void setRowHeight(double dHight, QProgressBar *progressBar, int iSplit);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void s_NewTrack(QString strUuid, QString strWellName, QString strSlfName, QString strLineName);
|
void s_NewTrack(QString strUuid, QString strWellName, QString strSlfName, QString strLineName, QString strType);
|
||||||
//新建空白道,没有曲线
|
//新建空白道,没有曲线
|
||||||
void s_NewTrack_No_Line(QString strUuid, QString strWellName, QString strTrackName);
|
void s_NewTrack_No_Line(QString strUuid, QString strWellName, QString strTrackName);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -488,7 +488,7 @@ void MainWindowCurve::s_NewTrack()
|
||||||
|
|
||||||
QString strWellName = ui->tableWidget_2->item(0, column)->text();
|
QString strWellName = ui->tableWidget_2->item(0, column)->text();
|
||||||
//新建道
|
//新建道
|
||||||
emit CallManage::getInstance()->sig_NewTrack(m_strUuid, strWellName, "", "");
|
emit CallManage::getInstance()->sig_NewTrack(m_strUuid, strWellName, "", "", "");
|
||||||
|
|
||||||
int iWidth = ui->tableWidget_2->columnWidth(column);
|
int iWidth = ui->tableWidget_2->columnWidth(column);
|
||||||
//设置列宽
|
//设置列宽
|
||||||
|
|
@ -536,14 +536,14 @@ void MainWindowCurve::s_AddLine_Property(QString strSlfName, QString strWellName
|
||||||
}
|
}
|
||||||
|
|
||||||
//新建井+道+曲线(首条)
|
//新建井+道+曲线(首条)
|
||||||
void MainWindowCurve::NewWellAndTrack(QString strWellName, QString strSlfName, QString strLineName)
|
void MainWindowCurve::NewWellAndTrack(QString strWellName, QString strSlfName, QString strLineName, QString strType)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
if(m_listWell.contains(strWellName))
|
if(m_listWell.contains(strWellName))
|
||||||
{
|
{
|
||||||
//不在道里,新建道+曲线
|
//不在道里,新建道+曲线
|
||||||
//新建道+曲线
|
//新建道+曲线
|
||||||
emit CallManage::getInstance()->sig_NewTrack(m_strUuid, strWellName, strSlfName, strLineName);
|
emit CallManage::getInstance()->sig_NewTrack(m_strUuid, strWellName, strSlfName, strLineName, strType);
|
||||||
//改变井宽
|
//改变井宽
|
||||||
emit sig_NewTrackChangeWidth(strWellName);
|
emit sig_NewTrackChangeWidth(strWellName);
|
||||||
}
|
}
|
||||||
|
|
@ -555,7 +555,7 @@ void MainWindowCurve::NewWellAndTrack(QString strWellName, QString strSlfName, Q
|
||||||
m_listWell.push_back(strWellName);
|
m_listWell.push_back(strWellName);
|
||||||
|
|
||||||
//新建道+曲线
|
//新建道+曲线
|
||||||
emit CallManage::getInstance()->sig_NewTrack(m_strUuid, strWellName, strSlfName, strLineName);
|
emit CallManage::getInstance()->sig_NewTrack(m_strUuid, strWellName, strSlfName, strLineName, strType);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -607,7 +607,22 @@ void MainWindowCurve::dropEvent(QDropEvent* event)
|
||||||
qDebug() << "strSlfName:" << strSlfName<< " strWellName:" << strWellName<< " strLineName:" << strLineName;
|
qDebug() << "strSlfName:" << strSlfName<< " strWellName:" << strWellName<< " strLineName:" << strLineName;
|
||||||
|
|
||||||
//新建井+道+曲线(首条)
|
//新建井+道+曲线(首条)
|
||||||
NewWellAndTrack(strWellName, strSlfName, strLineName);
|
NewWellAndTrack(strWellName, strSlfName, strLineName, "curveObject");
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
//
|
||||||
|
QStringList listWave = strExtern.split("#$$#");//QString字符串分割函数
|
||||||
|
if (listWave.size() > 2)
|
||||||
|
{
|
||||||
|
QString strSlfName = listWave[0];
|
||||||
|
QString strWellName = listWave[1];
|
||||||
|
QString strWaveName = listWave[2];
|
||||||
|
|
||||||
|
qDebug() << "strSlfName:" << strSlfName<< " strWellName:" << strWellName<< " strWaveName:" << strWaveName;
|
||||||
|
|
||||||
|
//新建井+道+波列(首条)
|
||||||
|
NewWellAndTrack(strWellName, strSlfName, strWaveName, "waveObject");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//QMessageBox::information(this, "提示", strExtern);
|
//QMessageBox::information(this, "提示", strExtern);
|
||||||
|
|
|
||||||
|
|
@ -81,7 +81,7 @@ public:
|
||||||
void dockLayout();
|
void dockLayout();
|
||||||
|
|
||||||
//新建井+道+曲线(首条)
|
//新建井+道+曲线(首条)
|
||||||
void NewWellAndTrack(QString strWellName, QString strSlfName, QString strLineName);
|
void NewWellAndTrack(QString strWellName, QString strSlfName, QString strLineName, QString strType);
|
||||||
|
|
||||||
QJsonObject makeJson();
|
QJsonObject makeJson();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -127,18 +127,50 @@ void PreQTableWidget::dropEvent(QDropEvent *event)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
int rownum = rowCount();
|
|
||||||
setRowCount(rownum+1);
|
|
||||||
//
|
//
|
||||||
QTableWidgetItem* item = new QTableWidgetItem(strExtern);
|
QStringList listWave = strExtern.split("#$$#");//QString字符串分割函数
|
||||||
item->setFlags(item->flags() & (~Qt::ItemIsEditable));
|
if (listWave.size() > 2)
|
||||||
item->setTextAlignment(Qt::AlignCenter); //设置文本居中
|
{
|
||||||
//
|
QString strSlfName = listWave[0];
|
||||||
setItem(rownum, 0, item);
|
QString strWellName = listWave[1];
|
||||||
|
QString strWaveName = listWave[2];
|
||||||
|
|
||||||
//
|
qDebug() << "source strSlfName:" << strSlfName<< " strWellName:" << strWellName<< " strWaveName:" << strWaveName;
|
||||||
event->setDropAction(Qt::MoveAction);
|
|
||||||
event->accept();
|
if(m_strWellName == strWellName)
|
||||||
|
{
|
||||||
|
m_AddSuc = true;
|
||||||
|
//新建波列
|
||||||
|
emit CallManage::getInstance()->sig_AddWave(m_strUuid, strSlfName, strWellName, m_strTrackName, strWaveName);
|
||||||
|
|
||||||
|
//
|
||||||
|
//m_listLineName.push_back(strLineName);
|
||||||
|
|
||||||
|
// 接受拖拽事件
|
||||||
|
event->setDropAction(Qt::MoveAction);
|
||||||
|
event->accept();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// 如果井名不正确,不接受拖拽事件
|
||||||
|
event->ignore();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
int rownum = rowCount();
|
||||||
|
setRowCount(rownum+1);
|
||||||
|
//
|
||||||
|
QTableWidgetItem* item = new QTableWidgetItem(strExtern);
|
||||||
|
item->setFlags(item->flags() & (~Qt::ItemIsEditable));
|
||||||
|
item->setTextAlignment(Qt::AlignCenter); //设置文本居中
|
||||||
|
//
|
||||||
|
setItem(rownum, 0, item);
|
||||||
|
|
||||||
|
//
|
||||||
|
event->setDropAction(Qt::MoveAction);
|
||||||
|
event->accept();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -173,8 +205,40 @@ void PreQTableWidget::dropEvent(QDropEvent *event)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// 如果井名不正确,不接受拖拽事件
|
// 如果井名不正确,不接受拖拽事件
|
||||||
event->ignore();
|
event->ignore();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//
|
||||||
|
QStringList listWave = strExtern.split("#$$#");//QString字符串分割函数
|
||||||
|
if (listWave.size() > 2)
|
||||||
|
{
|
||||||
|
QString strSlfName = listWave[0];
|
||||||
|
QString strWellName = listWave[1];
|
||||||
|
QString strWaveName = listWave[2];
|
||||||
|
|
||||||
|
qDebug() << "sourceTree strSlfName:" << strSlfName<< " strWellName:" << strWellName<< " strWaveName:" << strWaveName;
|
||||||
|
|
||||||
|
if(m_strWellName == strWellName)
|
||||||
|
{
|
||||||
|
m_AddSuc = true;
|
||||||
|
//新建波列
|
||||||
|
emit CallManage::getInstance()->sig_AddWave(m_strUuid, strSlfName, strWellName, m_strTrackName, strWaveName);
|
||||||
|
|
||||||
|
//
|
||||||
|
//m_listLineName.push_back(strLineName);
|
||||||
|
|
||||||
|
// 接受拖拽事件
|
||||||
|
event->setDropAction(Qt::MoveAction);
|
||||||
|
event->accept();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// 如果井名不正确,不接受拖拽事件
|
||||||
|
event->ignore();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -29,6 +29,7 @@ void QMyTreeWidget::startDrag(Qt::DropActions supportedActions)
|
||||||
//根节点(项目名称)
|
//根节点(项目名称)
|
||||||
}
|
}
|
||||||
else if (strTreeTag == "curveObject"){
|
else if (strTreeTag == "curveObject"){
|
||||||
|
//曲线
|
||||||
QString strSlfName = item->data(0, Qt::UserRole+1).toString();
|
QString strSlfName = item->data(0, Qt::UserRole+1).toString();
|
||||||
QString strWellName = item->data(0, Qt::UserRole+2).toString();
|
QString strWellName = item->data(0, Qt::UserRole+2).toString();
|
||||||
|
|
||||||
|
|
@ -45,6 +46,33 @@ void QMyTreeWidget::startDrag(Qt::DropActions supportedActions)
|
||||||
// 调整拖拽光标的热点,使其位于截图的中心
|
// 调整拖拽光标的热点,使其位于截图的中心
|
||||||
drag->setPixmap(itemPixmap);
|
drag->setPixmap(itemPixmap);
|
||||||
|
|
||||||
|
// 执行拖拽操作
|
||||||
|
Qt::DropAction dropAction = drag->exec(supportedActions, Qt::MoveAction);
|
||||||
|
/*if (dropAction == Qt::MoveAction) {
|
||||||
|
// 处理拖拽结束的逻辑,例如从界面上移除拖拽的项
|
||||||
|
for (QTreeWidgetItem *item : items) {
|
||||||
|
this->takeTopLevelItem(this->indexOfTopLevelItem(item));
|
||||||
|
}
|
||||||
|
}*/
|
||||||
|
}
|
||||||
|
else if (strTreeTag == "waveObject"){
|
||||||
|
//波列数据
|
||||||
|
QString strSlfName = item->data(0, Qt::UserRole+1).toString();
|
||||||
|
QString strWellName = item->data(0, Qt::UserRole+2).toString();
|
||||||
|
|
||||||
|
//波列对象
|
||||||
|
QMimeData *mimeData = new QMimeData;
|
||||||
|
// 这里需要根据你的item数据来设置mimeData,例如:
|
||||||
|
mimeData->setText(strSlfName + "#$$#"+ strWellName + "#$$#" +item->text(0));
|
||||||
|
// 创建QDrag对象
|
||||||
|
QDrag *drag = new QDrag(this);
|
||||||
|
drag->setMimeData(mimeData);
|
||||||
|
// 可以设置拖拽时的光标图标
|
||||||
|
QRect itemRect = visualItemRect(item); // 获取项的矩形区域
|
||||||
|
QPixmap itemPixmap = QWidget::grab(itemRect);//QPixmap::grabWidget(this, itemRect); // 获取项的屏幕截图
|
||||||
|
// 调整拖拽光标的热点,使其位于截图的中心
|
||||||
|
drag->setPixmap(itemPixmap);
|
||||||
|
|
||||||
// 执行拖拽操作
|
// 执行拖拽操作
|
||||||
Qt::DropAction dropAction = drag->exec(supportedActions, Qt::MoveAction);
|
Qt::DropAction dropAction = drag->exec(supportedActions, Qt::MoveAction);
|
||||||
/*if (dropAction == Qt::MoveAction) {
|
/*if (dropAction == Qt::MoveAction) {
|
||||||
|
|
|
||||||
|
|
@ -371,9 +371,9 @@ void QtProjectWidgets::loadWellTree(QTreeWidgetItem *parent, QString fileFull, Q
|
||||||
iconCurve.addPixmap(QPixmap(":/image/left_index.png"), QIcon::Normal);
|
iconCurve.addPixmap(QPixmap(":/image/left_index.png"), QIcon::Normal);
|
||||||
itemCurve->setIcon(0, iconCurve);
|
itemCurve->setIcon(0, iconCurve);
|
||||||
|
|
||||||
//波列
|
//波列数据
|
||||||
QTreeWidgetItem *itemWave = new QTreeWidgetItem();
|
QTreeWidgetItem *itemWave = new QTreeWidgetItem();
|
||||||
itemWave->setText(0, "波列");
|
itemWave->setText(0, "波列数据");
|
||||||
itemWave->setData(0, Qt::UserRole, "Wave"); // 存储额外数据,如ID
|
itemWave->setData(0, Qt::UserRole, "Wave"); // 存储额外数据,如ID
|
||||||
//itemWave->setData(0, Qt::UserRole + 1, indexSysInfo.at(1).toString()); // 存储额外数据,如ID
|
//itemWave->setData(0, Qt::UserRole + 1, indexSysInfo.at(1).toString()); // 存储额外数据,如ID
|
||||||
//
|
//
|
||||||
|
|
@ -539,7 +539,7 @@ void QtProjectWidgets::loadWellTree(QTreeWidgetItem *parent, QString fileFull, Q
|
||||||
itemCurveLog->setData(0, Qt::UserRole + 1, fileFull); // 存储额外数据,井次文件路径
|
itemCurveLog->setData(0, Qt::UserRole + 1, fileFull); // 存储额外数据,井次文件路径
|
||||||
itemCurveLog->setData(0, Qt::UserRole + 2, wellname); // 存储额外数据,井名
|
itemCurveLog->setData(0, Qt::UserRole + 2, wellname); // 存储额外数据,井名
|
||||||
itemCurveLog->setIcon(0, iconSheet);
|
itemCurveLog->setIcon(0, iconSheet);
|
||||||
//在创建的每个节点下,加上下面代码
|
//在创建的每个节点下,加上下面代码(check框)
|
||||||
itemCurveLog->setFlags(Qt::ItemIsUserCheckable | Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsTristate | Qt::ItemIsDragEnabled); //设置树形控件子项的属性
|
itemCurveLog->setFlags(Qt::ItemIsUserCheckable | Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsTristate | Qt::ItemIsDragEnabled); //设置树形控件子项的属性
|
||||||
itemCurveLog->setCheckState(0, Qt::Unchecked);//也可以是其他状态
|
itemCurveLog->setCheckState(0, Qt::Unchecked);//也可以是其他状态
|
||||||
if (0 == itemCurve->childCount())
|
if (0 == itemCurve->childCount())
|
||||||
|
|
@ -565,6 +565,9 @@ void QtProjectWidgets::loadWellTree(QTreeWidgetItem *parent, QString fileFull, Q
|
||||||
//波列-》树图
|
//波列-》树图
|
||||||
QTreeWidgetItem *itemWaveChild = new QTreeWidgetItem();
|
QTreeWidgetItem *itemWaveChild = new QTreeWidgetItem();
|
||||||
itemWaveChild->setText(0, strCurveName);
|
itemWaveChild->setText(0, strCurveName);
|
||||||
|
itemWaveChild->setData(0, Qt::UserRole, "waveObject"); // 存储额外数据,如ID
|
||||||
|
itemWaveChild->setData(0, Qt::UserRole + 1, fileFull); // 存储额外数据,井次文件路径
|
||||||
|
itemWaveChild->setData(0, Qt::UserRole + 2, wellname); // 存储额外数据,井名
|
||||||
itemWaveChild->setIcon(0, iconSheet);
|
itemWaveChild->setIcon(0, iconSheet);
|
||||||
if (0 == itemWave->childCount())
|
if (0 == itemWave->childCount())
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user