Compare commits

...

3 Commits

Author SHA1 Message Date
jiayulong
6c13604d68 插件优化 2026-01-23 14:56:37 +08:00
jiayulong
232d750a71 Merge branch 'main' of http://git.hivekion.com:3000/jiayulong/logplus 2026-01-23 14:53:49 +08:00
jiayulong
05a491db45 支持修改道宽属性 2026-01-23 14:53:34 +08:00
15 changed files with 231 additions and 58 deletions

View File

@ -133,6 +133,9 @@ signals:
//改变缩放比例 //改变缩放比例
void sig_changeScale(int iNewScale); void sig_changeScale(int iNewScale);
//改变道宽
void sig_changeWidth(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, int iCurrentCol, int iNewWidth);
// //
//void sig_addImageToPlot(QMyCustomPlot* customPlot, double left_Low, double right_Hight, QString imagePath); //void sig_addImageToPlot(QMyCustomPlot* customPlot, double left_Low, double right_Hight, QString imagePath);

View File

@ -3,6 +3,7 @@
//插件名定义 //插件名定义
#define MYUNITPLUGIN "MyUnitPlugin" //插件 #define MYUNITPLUGIN "MyUnitPlugin" //插件
#define PLUGINUNIT "PluginUnit" //插件
#endif // PLUGINNAME_H #endif // PLUGINNAME_H

View File

@ -570,30 +570,30 @@ void CDrawTvd::DrawClient(QPainter* pdc,QRectF mrt)
double GetPixelPerCm() double GetPixelPerCm()
{ {
double g_logicalDpi; double logicalDpi;
double g_dPixelPerCm = 1;//每厘米像素数 double dPixelPerCm = 1;//每厘米像素数
// 获取当前屏幕 // 获取当前屏幕
QScreen *screen = QGuiApplication::primaryScreen(); QScreen *screen = QGuiApplication::primaryScreen();
if (screen) { if (screen) {
// 获取逻辑DPI // 获取逻辑DPI
g_logicalDpi = screen->logicalDotsPerInch(); logicalDpi = screen->logicalDotsPerInch();
qDebug() << "Logical DPI:" << QString::number(g_logicalDpi); qDebug() << "Logical DPI:" << QString::number(logicalDpi);
if(g_logicalDpi==0) if(logicalDpi==0)
{ {
// 获取物理DPI // 获取物理DPI
double physicalDpi = screen->physicalDotsPerInch(); double physicalDpi = screen->physicalDotsPerInch();
qDebug() << "Physical DPI:" << QString::number(physicalDpi); qDebug() << "Physical DPI:" << QString::number(physicalDpi);
g_logicalDpi = physicalDpi; logicalDpi = physicalDpi;
} }
//每厘米像素数 //每厘米像素数
g_dPixelPerCm = g_logicalDpi/2.54; dPixelPerCm = logicalDpi/2.54;
} else { } else {
qDebug() << "No screen available"; qDebug() << "No screen available";
} }
return g_dPixelPerCm; return dPixelPerCm;
} }
void CDrawTvd::DrawTvd(QPainter* pDC,QRectF mrt) void CDrawTvd::DrawTvd(QPainter* pDC,QRectF mrt)

View File

@ -198,6 +198,18 @@ void PropertyWidget::SlotPropertyChanged( QtProperty *pProperty, const QVariant
emit CallManage::getInstance()->sig_changeScale(g_iScale); emit CallManage::getInstance()->sig_changeScale(g_iScale);
} }
} }
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]) else if("左刻度" == m_propertyData[pProperty])
{ {
//qDebug() << "左刻度->改变"; //qDebug() << "左刻度->改变";
@ -783,6 +795,27 @@ void PropertyWidget::initWellProperty()
_CreateVariantPropertyItem("通常", "终止深度(m)", 0-g_iY1, QVariant::Double); _CreateVariantPropertyItem("通常", "终止深度(m)", 0-g_iY1, QVariant::Double);
} }
void PropertyWidget::initTrackProperty(QTableWidgetItem *item, 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;
//
double cmWidth = (double)iWidth/(double)g_dPixelPerCm;
_CreateVariantPropertyItem("通常", "道宽(cm)", cmWidth, QVariant::Double);
}
void PropertyWidget::initCurveProperty(FormInfo *formInfo, QStringList strListOtherLine, QList<float> listMin, QList<float> listMax, QStringList strListOtherScaleType) void PropertyWidget::initCurveProperty(FormInfo *formInfo, QStringList strListOtherLine, QList<float> listMin, QList<float> listMax, QStringList strListOtherScaleType)
{ {
//初始化,清空 //初始化,清空

View File

@ -17,10 +17,12 @@
// //
#include "forminfo.h" #include "forminfo.h"
#include "formhead.h" #include "formhead.h"
#include "qmytablewidget.h"
//当前曲线类型 //当前曲线类型
#define Widget_Property "Widget_Property" #define Widget_Property "Widget_Property"
#define Well_Property "Well_Property" //井 #define Well_Property "Well_Property" //井
#define Track_Property "Track_Property" //道
#define Curve_Property "Curve_Property" //曲线 #define Curve_Property "Curve_Property" //曲线
#define Head_Property "Head_Property" //图头,单元格 #define Head_Property "Head_Property" //图头,单元格
@ -69,6 +71,10 @@ public:
double m_colWidth = 1; double m_colWidth = 1;
double m_rowHeight = 1; double m_rowHeight = 1;
//道
QMyTableWidget *m_myTableWidget;
int m_iCurrentCol;
bool m_bSelfChange=false; bool m_bSelfChange=false;
public: public:
QWidget* GetPropertyWidget(); QWidget* GetPropertyWidget();
@ -81,6 +87,8 @@ public:
void initWidgetProperty(); //可视解释整体属性 void initWidgetProperty(); //可视解释整体属性
//井 //井
void initWellProperty(); void initWellProperty();
//道
void initTrackProperty(QTableWidgetItem *item, int iWidth, QMyTableWidget *myTableWidget, int iCurrentCol);
//曲线 //曲线
void initCurveProperty(FormInfo *formInfo, QStringList strListOtherLine, QList<float> listMin, QList<float> listMax, QStringList strListOtherScaleType); void initCurveProperty(FormInfo *formInfo, QStringList strListOtherLine, QList<float> listMin, QList<float> listMax, QStringList strListOtherScaleType);
//图头 //图头

View File

@ -518,6 +518,40 @@ void FormDraw::s_mouseWheel(QWheelEvent *event)
emit CallManage::getInstance()->sig_mouseWheel(event); emit CallManage::getInstance()->sig_mouseWheel(event);
} }
void FormDraw::setColWidth(int iNewWidth)
{
// 获取当前widget的所有子控件
const QObjectList &children = this->children();
//判断为空
int columnCount = children.size();
if(columnCount==0)
{
return;
}
int i=0;
// 遍历子控件列表
for (QObject *child : children) {
// 判断子控件是否为QWidget类型
if (QWidget *childWidget = qobject_cast<QWidget *>(child)) {
// 打印子控件的信息,使用缩进表示层级关系
//qDebug() << QString("%1").arg(childWidget->objectName());
QString strObjName = childWidget->objectName();
if(strObjName=="QMyCustomPlot")
{
//
QMyCustomPlot *form = (QMyCustomPlot*)childWidget;
if(form)
{
int dHight = form->geometry().height();
form->setGeometry(0, 0, iNewWidth, (int)dHight);//7500-3184
form->replot();//屏蔽,缩减时间
}
}
}
i++;
}
}
void FormDraw::setRowHeight(double dHight, QProgressBar *progressBar, int iSplit) void FormDraw::setRowHeight(double dHight, QProgressBar *progressBar, int iSplit)
{ {
int iBeginValue = progressBar->value(); int iBeginValue = progressBar->value();

View File

@ -64,6 +64,7 @@ public slots:
void s_mouseWheel(QWheelEvent *event); void s_mouseWheel(QWheelEvent *event);
void setRowHeight(double dHight, QProgressBar *progressBar, int iSplit); void setRowHeight(double dHight, QProgressBar *progressBar, int iSplit);
void setColWidth(int iNewWidth);
public: public:
QString m_strUuid; QString m_strUuid;

View File

@ -41,6 +41,9 @@ FormTrack::FormTrack(QWidget *parent, QString strWellName, QString strTrackName)
header->setSectionResizeMode(i, QHeaderView::Stretch); header->setSectionResizeMode(i, QHeaderView::Stretch);
} }
// 设置选择模式为单选模式
ui->tableWidget->setSelectionMode(QAbstractItemView::SingleSelection);
//曲线 //曲线
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)));

View File

@ -317,6 +317,32 @@ void FormWell::s_NewTrack_No_Line(QString strUuid, QString strWellName, QString
} }
} }
int FormWell::setColWidth(int iCurrentCol, int iNewWidth)
{
//设置列宽
ui->tableWidget->setColumnWidth(iCurrentCol, iNewWidth);
auto myWidget = ui->tableWidget->cellWidget(2, iCurrentCol);
if(myWidget)
{
//
FormDraw *formDraw = (FormDraw*)myWidget;//获得widget
if(formDraw)
{
formDraw->setColWidth(iNewWidth);
}
}
//计算井宽
int iWellWidth = 0;
int columnCount = ui->tableWidget->columnCount();//总列数
for(int i=0; i<columnCount; i++)
{
iWellWidth += ui->tableWidget->columnWidth(i);
}
return iWellWidth;
}
void FormWell::setRowHeight(double dHight, QProgressBar *progressBar, int iSplit) void FormWell::setRowHeight(double dHight, QProgressBar *progressBar, int iSplit)
{ {
//设置高度 //设置高度

View File

@ -35,6 +35,8 @@ public:
QStringList getLineList(QString strWellName, QString strTrackName); QStringList getLineList(QString strWellName, QString strTrackName);
void setRowHeight(double dHight, QProgressBar *progressBar, int iSplit); void setRowHeight(double dHight, QProgressBar *progressBar, int iSplit);
//设置道宽
int setColWidth(int iCurrentCol, int iNewWidth);
public slots: public slots:
void s_NewCol(QStringList listdt); void s_NewCol(QStringList listdt);

View File

@ -225,6 +225,7 @@ void MainWindow::initToolBar()
connect(m_newprojectAc, &QAction::triggered, this, &MainWindow::s_New); connect(m_newprojectAc, &QAction::triggered, this, &MainWindow::s_New);
connect(m_openprojectAc, &QAction::triggered, this, &MainWindow::s_Open); connect(m_openprojectAc, &QAction::triggered, this, &MainWindow::s_Open);
connect(m_saveprojectAc, &QAction::triggered, this, &MainWindow::s_SaveProject);
connect(m_wellsectionwindowAc, &QAction::triggered, this, &MainWindow::s_showView); connect(m_wellsectionwindowAc, &QAction::triggered, this, &MainWindow::s_showView);
connect(m_developmentAc, &QAction::triggered, this, &MainWindow::s_development); connect(m_developmentAc, &QAction::triggered, this, &MainWindow::s_development);
@ -276,35 +277,6 @@ void MainWindow::initWorkSpaceView()
//MainWindowNew *mainWindowNew = new MainWindowNew();//中间工作区 //MainWindowNew *mainWindowNew = new MainWindowNew();//中间工作区
//m_centerWidgets->addTab(mainWindowNew, "解释视图"); //m_centerWidgets->addTab(mainWindowNew, "解释视图");
//
//加载插件显示
// QWidget * pMyWidget = CallPlugin::getInstance()->getPluginWidget(MYUNITPLUGIN, NULL);
// if (pMyWidget != nullptr)
// {
// //
// //直方图获取当前工程下的slf
// QVector<QString> vecSlfList;
// QVector<QString> vecWellList;
// bool bRet = getAllSlf(g_prjname, vecSlfList, vecWellList);
// if(bRet)
// {
// for(int i=0; i<vecWellList.size(); i++)
// {
// qDebug() << "vecWellList:" << QString::number(i+1) << "=" << vecWellList[i];
// }
// for(int i=0; i<vecSlfList.size(); i++)
// {
// qDebug() << "vecSlfList:" << QString::number(i+1) << "=" << vecSlfList[i];
// }
// }
// //关联信号槽数据传递vecSlfList, vecWellList
// //...
// //关联信号槽,数据查看
// connect(CallManage::getInstance(), SIGNAL(sig_testPlugin(QString)), pMyWidget, SLOT(s_testPlugin(QString)));
// //
// m_centerWidgets->addTab(pMyWidget, "插件视图");
// }
} }
qDebug() << "工作区 id:" << m_stackedWidget_Center->winId() << ", name:" << m_stackedWidget_Center->windowTitle(); qDebug() << "工作区 id:" << m_stackedWidget_Center->winId() << ", name:" << m_stackedWidget_Center->windowTitle();
} }
@ -358,6 +330,41 @@ void MainWindow::s_Open()
} }
} }
void MainWindow::s_SaveProject()
{
//加载插件显示
QWidget * pMyWidget = CallPlugin::getInstance()->getPluginWidget(PLUGINUNIT, (QWidget *)this);
if (pMyWidget != nullptr)
{
//
m_centerWidgets->addTab(pMyWidget, "插件视图");
}
//设置参数
QString strParams = "hello";
CallPlugin::getInstance()->setPluginParams(PLUGINUNIT, strParams);
//获取参数
QString strParams2 = CallPlugin::getInstance()->getPluginParams(PLUGINUNIT);
qDebug() << "getPluginParams: " << strParams2;
// //加载插件显示
// QWidget * pMyWidget = CallPlugin::getInstance()->getPluginWidget(MYUNITPLUGIN, NULL);
// if (pMyWidget != nullptr)
// {
// //
// m_centerWidgets->addTab(pMyWidget, "插件视图");
// }
// //插件测试(信号槽)
// emit CallManage::getInstance()->sig_testPlugin("hello");
}
//收到插件消息
void MainWindow::s_PluginMsg(QString msg)
{
qDebug() << "s_PluginMsg:" << msg;
}
//可视解释 //可视解释
void MainWindow::s_showView() void MainWindow::s_showView()
{ {

View File

@ -76,6 +76,7 @@ public:
public slots: public slots:
void s_New(); void s_New();
void s_Open(); void s_Open();
void s_SaveProject();
void s_CloseProject(); void s_CloseProject();
void s_Risize(); void s_Risize();
@ -93,6 +94,9 @@ public slots:
void s_ShowTable(QString strSlfName, QString strName);//表格数据查看 void s_ShowTable(QString strSlfName, QString strName);//表格数据查看
void s_WelllogInformation(QString strSlfName);//编辑测井信息 void s_WelllogInformation(QString strSlfName);//编辑测井信息
//插件消息
void s_PluginMsg(QString msg);
}; };
#endif // MAINWINDOW_H #endif // MAINWINDOW_H

View File

@ -107,16 +107,15 @@ MainWindowCurve::MainWindowCurve(QWidget *parent) :
ui->tableWidget_3->verticalHeader()->hide(); ui->tableWidget_3->verticalHeader()->hide();
ui->tableWidget_3->horizontalHeader()->hide(); ui->tableWidget_3->horizontalHeader()->hide();
connect(this, SIGNAL(sig_NewTrackChangeWidth(QString, int)), this, SLOT(s_NewTrackChangeWidth(QString, int))); connect(this, SIGNAL(sig_NewTrackChangeWidth(QString, int)), this, SLOT(s_NewTrackChangeWidth(QString, int)));
//connect(this, SIGNAL(sig_NewWell(QString, QString)), this, SLOT(s_NewWell(QString, QString))); //connect(this, SIGNAL(sig_NewWell(QString, QString)), this, SLOT(s_NewWell(QString, QString)));
connect(CallManage::getInstance(), SIGNAL(sig_mouseWheel(QWheelEvent*)), this, SLOT(s_mouseWheel(QWheelEvent*))); connect(CallManage::getInstance(), SIGNAL(sig_mouseWheel(QWheelEvent*)), this, SLOT(s_mouseWheel(QWheelEvent*)));
connect(CallManage::getInstance(), SIGNAL(sig_changeScale(int)), this, SLOT(s_changeScale(int))); connect(CallManage::getInstance(), SIGNAL(sig_changeScale(int)), this, SLOT(s_changeScale(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_Raise(QString, QString, QString, QString, QString, int)), this, SLOT(s_Raise(QString, QString, QString, QString, QString, int))); connect(CallManage::getInstance(), SIGNAL(sig_Raise(QString, QString, QString, QString, QString, int)), this, SLOT(s_Raise(QString, QString, QString, QString, QString, int)));
//图头 //图头
m_dock1=new QDockWidget(tr(""),this); m_dock1=new QDockWidget(tr(""),this);
m_dock1->setFeatures(QDockWidget::NoDockWidgetFeatures);//QDockWidget::DockWidgetMovable m_dock1->setFeatures(QDockWidget::NoDockWidgetFeatures);//QDockWidget::DockWidgetMovable
@ -209,6 +208,7 @@ void MainWindowCurve::initMainToolBar()
//ui->mainToolBar->addAction(m_openAc); //ui->mainToolBar->addAction(m_openAc);
connect(m_fixwellsectionHeaderAc, &QAction::triggered, this, &MainWindowCurve::s_showHeadTable); connect(m_fixwellsectionHeaderAc, &QAction::triggered, this, &MainWindowCurve::s_showHeadTable);
connect(m_currtempliteAc, &QAction::triggered, this, &MainWindowCurve::s_currtemplite);
connect(m_saveastemplateAc, &QAction::triggered, this, &MainWindowCurve::s_Save); connect(m_saveastemplateAc, &QAction::triggered, this, &MainWindowCurve::s_Save);
connect(m_executeDepthShiftAc, &QAction::triggered, this, &MainWindowCurve::s_ExecuteDepthShift); connect(m_executeDepthShiftAc, &QAction::triggered, this, &MainWindowCurve::s_ExecuteDepthShift);
@ -910,6 +910,11 @@ void MainWindowCurve::loadStyle(const QString &qssFile)
} }
} }
void MainWindowCurve::s_currtemplite()
{
}
void MainWindowCurve::s_Save() void MainWindowCurve::s_Save()
{ {
//Logdata //Logdata
@ -976,15 +981,6 @@ void MainWindowCurve::s_ModuleOpen()
pModuleConsole->m_pWorkflowDataModel = new CWellLogWorkflowDataModel(); pModuleConsole->m_pWorkflowDataModel = new CWellLogWorkflowDataModel();
pDialog->m_CurrentSLFFileName = strSlfName; pDialog->m_CurrentSLFFileName = strSlfName;
pDialog->CreatParamControlWidget(); pDialog->CreatParamControlWidget();
QString subStr = strSlfName;
int startPos = strSlfName.indexOf("Logdata");
if (startPos>=0)
{
subStr = subStr.right(strSlfName.length() - startPos - 7);
}
pDialog->setWindowTitle(subStr);
pDialog->show(); pDialog->show();
return; return;
} }
@ -2416,6 +2412,45 @@ void MainWindowCurve::Open(QString fileFull)
} }
} }
//改变道宽
void MainWindowCurve::s_changeWidth(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, int iCurrentCol, int iNewWidth)
{
int columnCount = ui->tableWidget_2->columnCount();//总列数
for(int i=0; i<columnCount; i++)
{
if(i%2==0)
{
}
else
{
//空白列
continue;
}
if( ui->tableWidget_2->cellWidget(1, i) != nullptr )
{
auto myWidget = ui->tableWidget_2->cellWidget(1, i);
if(myWidget)
{
//
FormWell *widgetWell = (FormWell*)myWidget;//获得widget
if(widgetWell)
{
if(widgetWell->m_strUuid==strUuid
&& widgetWell->m_strSlfName==strSlfName
&& widgetWell->m_strWellName==strWellName)
{
int iWellWidth = widgetWell->setColWidth(iCurrentCol, iNewWidth);
//调整井宽
ui->tableWidget_2->setColumnWidth(i, iWellWidth);
}
}
}
}
}
}
//改变缩放比例 //改变缩放比例
void MainWindowCurve::s_changeScale(int iNewScale) void MainWindowCurve::s_changeScale(int iNewScale)
{ {

View File

@ -49,6 +49,9 @@ public slots:
void slot_time(); void slot_time();
//改变缩放比例 //改变缩放比例
void s_changeScale(int iNewScale); void s_changeScale(int iNewScale);
//改变道宽
void s_changeWidth(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, int iCurrentCol, int iNewWidth);
void onItemClicked(QTableWidgetItem* item); void onItemClicked(QTableWidgetItem* item);
void mousePressEvent(QMouseEvent *event); void mousePressEvent(QMouseEvent *event);
void s_Raise(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, int iTableType); void s_Raise(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, int iTableType);
@ -167,6 +170,7 @@ public slots:
// //
void s_showHeadTable(); //显示/隐藏图头 void s_showHeadTable(); //显示/隐藏图头
void s_currtemplite(); //加载图文件
void s_Save(); //保存图文件 void s_Save(); //保存图文件
void s_ExecuteDepthShift(); //校深 void s_ExecuteDepthShift(); //校深
void s_ModuleOpen(); //处理算法 void s_ModuleOpen(); //处理算法

View File

@ -135,13 +135,25 @@ void QMyTableWidget::mouseReleaseEvent(QMouseEvent *event)
} }
else { else {
QTableWidgetItem *item = currentItem(); QTableWidgetItem *item = currentItem();
if(item)
{
QString strTrackName = item->text(); QString strTrackName = item->text();
QString strUuid = item->data(Qt::UserRole+1).toString(); QString strUuid = item->data(Qt::UserRole+1).toString();
QString strWellName = item->data(Qt::UserRole+2).toString(); QString strWellName = item->data(Qt::UserRole+2).toString();
QString strSlfName = item->data(Qt::UserRole+3).toString(); QString strSlfName = item->data(Qt::UserRole+3).toString();
// //
int iCurrentCol = currentColumn();
int iWidth = columnWidth(iCurrentCol);
PropertyService()->initTrackProperty(item, iWidth, this, iCurrentCol);
//
emit CallManage::getInstance()->sig_Raise(strUuid, strSlfName, strWellName, strTrackName, "", 2); emit CallManage::getInstance()->sig_Raise(strUuid, strSlfName, strWellName, strTrackName, "", 2);
} }
else {
qDebug()<<"QMyTableWidget mouseReleaseEvent, item=null";
}
}
} }
} }