diff --git a/Plugin/PluginUnit/PluginUnit.pro b/Plugin/PluginUnit/PluginUnit.pro index cc08823..da58604 100644 --- a/Plugin/PluginUnit/PluginUnit.pro +++ b/Plugin/PluginUnit/PluginUnit.pro @@ -39,11 +39,11 @@ CONFIG(debug, debug|release){ LIBS += -L$$PWD/../../Bin/ -lCallPlugind -lHPluginManaged -lslfiod } else { TARGET = PluginUnit - DESTDIR = $$PWD/../../Bin/customPlugin + DESTDIR = $$PWD/../../BinR/customPlugin MOC_DIR = ../tmp/PluginUnit UI_DIR = ../tmp/PluginUnit OBJECTS_DIR = ../tmp/PluginUnit - LIBS += -L$$PWD/../../Bin/ -lCallPlugin -lHPluginManage -lslfio + LIBS += -L$$PWD/../../BinR/ -lCallPlugin -lHPluginManage -lslfio } RESOURCES += \ diff --git a/Slfio/src/commonutils.cpp b/Slfio/src/commonutils.cpp index e7f9993..6fb5a5c 100644 --- a/Slfio/src/commonutils.cpp +++ b/Slfio/src/commonutils.cpp @@ -144,22 +144,23 @@ bool CCommonUtils::getAllSlf(QString prjname, QVector &vecSlfList, QVec continue; } QString wellnameSLf=mssageSlf.Item; - if (wellnameSLf.isEmpty()||wellnameSLf.length()>64||wellnameSLf.indexOf('&')>-1) + //if (wellnameSLf.isEmpty()||wellnameSLf.length()>64||wellnameSLf.indexOf('&')>-1) { QFileInfo fileinfo; fileinfo = QFileInfo(slfFile1); wellnameSLf = fileinfo.completeBaseName(); } - if(wellnameSLf != wellname) - { - //井次名称不一致 - //qDebug() << "井次名称不一致"; - delete logioSLf; - continue; - } +// if(wellnameSLf != wellname) +// { +// //井次名称不一致 +// //qDebug() << "井次名称不一致"; +// delete logioSLf; +// continue; +// } vecSlfList.append(slfFile1); delete logioSLf; + break; } } } diff --git a/logPlus/logPlus.pro b/logPlus/logPlus.pro index 3c5979d..9dd7277 100644 --- a/logPlus/logPlus.pro +++ b/logPlus/logPlus.pro @@ -81,6 +81,7 @@ SOURCES += \ qmytreewidget.cpp \ qtcommonclass.cpp \ qtprojectwidgets.cpp \ + selectwelldialog.cpp \ totalTitleBar.cpp \ transparentdraggableGuan.cpp \ transparentdraggableRightList.cpp \ @@ -144,6 +145,7 @@ HEADERS += \ qmytreewidget.h \ qtcommonclass.h \ qtprojectwidgets.h \ + selectwelldialog.h \ totalTitleBar.h \ transparentdraggableGuan.h \ transparentdraggableRightList.h \ @@ -168,7 +170,8 @@ FORMS += \ mainwindowcurve.ui \ mainwindowsplitter.ui \ newheaddialog.ui \ - qtprojectwidgets.ui + qtprojectwidgets.ui \ + selectwelldialog.ui INCLUDEPATH += ../include/ \ ../CallManage \ diff --git a/logPlus/mainwindowcurve.cpp b/logPlus/mainwindowcurve.cpp index bc0469c..d116af0 100644 --- a/logPlus/mainwindowcurve.cpp +++ b/logPlus/mainwindowcurve.cpp @@ -14,6 +14,7 @@ #include "LogModuleConsole.h" #include "DepPairs.h" #include "mainwindowsplitter.h" +#include "selectwelldialog.h" extern int g_iOneWidth; //道宽 extern QString g_prjname; @@ -23,6 +24,7 @@ extern QString g_prjname; extern double g_dPixelPerCm;//每厘米像素数 extern int g_iShow; //显示刻度 +extern int g_SelectWellIndex; //图头 //extern int g_iRows; //extern int g_iCols; @@ -188,6 +190,7 @@ void MainWindowCurve::initMainToolBar() QSize toolIconSize(18, 18); ui->mainToolBar->setIconSize(toolIconSize); //设置工具栏图标大小 + QIcon selectWellIcon(::GetImagePath()+"icon/WellTops.png"); QIcon fixwellsectionHeaderIcon(::GetImagePath()+"icon/fixwellsectionHeader.png"); QIcon currtempliteIcon(::GetImagePath()+"icon/currtemplite.png"); QIcon saveastemplateIcon(::GetImagePath()+"icon/saveastemplate.png"); @@ -200,6 +203,7 @@ void MainWindowCurve::initMainToolBar() QIcon loadIcon(":/image/export.png"); //Main工具栏 + QAction* m_selectWellAc = nullptr; //选择井 QAction* m_fixwellsectionHeaderAc = nullptr; //锁头 QAction* m_currtempliteAc = nullptr; //加载图文件 QAction* m_saveastemplateAc = nullptr; //另存为图文件 @@ -211,6 +215,7 @@ void MainWindowCurve::initMainToolBar() // QAction* m_debugAc = nullptr; // // QAction* m_loadAc = nullptr; //加载 + m_selectWellAc = new QAction(selectWellIcon, "选择井", this); m_fixwellsectionHeaderAc = new QAction(fixwellsectionHeaderIcon, "锁头", this); m_currtempliteAc = new QAction(currtempliteIcon, "加载图文件", this); m_saveastemplateAc = new QAction(saveastemplateIcon, "另存为图文件", this); @@ -225,6 +230,7 @@ void MainWindowCurve::initMainToolBar() ui->mainToolBar->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); //此种方式为文字显示在图标右侧 //add QAction to Widget. + ui->mainToolBar->addAction(m_selectWellAc); ui->mainToolBar->addAction(m_fixwellsectionHeaderAc); //ui->mainToolBar->addAction(m_currtempliteAc); ui->mainToolBar->addAction(m_saveastemplateAc); @@ -237,6 +243,7 @@ void MainWindowCurve::initMainToolBar() // ui->mainToolBar->addAction(m_loadAc); //ui->mainToolBar->addAction(m_openAc); + connect(m_selectWellAc, &QAction::triggered, this, &MainWindowCurve::s_selectWell); 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); @@ -2318,6 +2325,65 @@ void MainWindowCurve::s_ModuleOpen() //} +//选择井 +void MainWindowCurve::s_selectWell() +{ + QStringList listSlf; + QStringList listWell; + + //直方图,获取当前工程下的slf + QVector vecSlfList; + QVector vecWellList; + bool bRet = getAllSlf(g_prjname, vecSlfList, vecWellList); + if(bRet) + { + for(int i=0; isetInfo(listWell, listSlf); + // + dlg->setAttribute(Qt::WA_DeleteOnClose);//关闭时,自动删除窗口对象 + int result = dlg->exec();//模态对话框 + if (result == QDialog::Accepted) { + // 处理用户点击了确定按钮的逻辑 + qDebug() << "Accepted="; + + //井没创建,创建井+道+曲线 + //新建井 + s_NewWell(listWell[g_SelectWellIndex], listSlf[g_SelectWellIndex]); + //新建道 + emit CallManage::getInstance()->sig_NewTrack(m_strUuid, listWell[g_SelectWellIndex], "", "", ""); + } + else if (result == QDialog::Rejected) { + // 处理用户点击了取消按钮的逻辑 + qDebug() << "Rejected="; + } + else { + // 处理其他情况的逻辑 + qDebug() << "other="; + } +} + //显示/隐藏图头 void MainWindowCurve::s_showHeadTable() { @@ -2854,8 +2920,8 @@ void MainWindowCurve::s_NewSantuyibiao() //选中道 if(m_SelectTableItem.m_iTableType==2) { - //新建表格曲线 - emit CallManage::getInstance()->sig_AddTableLine(m_strUuid, m_SelectTableItem.m_strSlfName, m_SelectTableItem.m_strWellName, m_SelectTableItem.m_strTrackName, "IMAGE_DATA"); + //斜井三图一表 + emit CallManage::getInstance()->sig_AddSantuyibiao(m_strUuid, m_SelectTableItem.m_strSlfName, m_SelectTableItem.m_strWellName, m_SelectTableItem.m_strTrackName, "Santuyibiao"); return; } @@ -3203,8 +3269,8 @@ void MainWindowCurve::s_NewJiegutext() //选中道 if(m_SelectTableItem.m_iTableType==2) { - //新建表格曲线 - emit CallManage::getInstance()->sig_AddTableLine(m_strUuid, m_SelectTableItem.m_strSlfName, m_SelectTableItem.m_strWellName, m_SelectTableItem.m_strTrackName, "IMAGE_DATA"); + //气测/FMT/射孔/文本 + emit CallManage::getInstance()->sig_AddJiegutext(m_strUuid, m_SelectTableItem.m_strSlfName, m_SelectTableItem.m_strWellName, m_SelectTableItem.m_strTrackName, "GASLOG"); return; } @@ -3225,8 +3291,8 @@ void MainWindowCurve::s_NewLogface() //选中道 if(m_SelectTableItem.m_iTableType==2) { - //新建表格曲线 - emit CallManage::getInstance()->sig_AddTableLine(m_strUuid, m_SelectTableItem.m_strSlfName, m_SelectTableItem.m_strWellName, m_SelectTableItem.m_strTrackName, "IMAGE_DATA"); + //沉积相 + emit CallManage::getInstance()->sig_AddLogface(m_strUuid, m_SelectTableItem.m_strSlfName, m_SelectTableItem.m_strWellName, m_SelectTableItem.m_strTrackName, "LITHA"); return; } @@ -3258,8 +3324,8 @@ void MainWindowCurve::s_NewTubingstring() //选中道 if(m_SelectTableItem.m_iTableType==2) { - //新建表格曲线 - emit CallManage::getInstance()->sig_AddTableLine(m_strUuid, m_SelectTableItem.m_strSlfName, m_SelectTableItem.m_strWellName, m_SelectTableItem.m_strTrackName, "IMAGE_DATA"); + //套管组件 + emit CallManage::getInstance()->sig_AddTubingstring(m_strUuid, m_SelectTableItem.m_strSlfName, m_SelectTableItem.m_strWellName, m_SelectTableItem.m_strTrackName, "TUBTOOLS"); return; } @@ -4386,12 +4452,12 @@ void MainWindowCurve::slotContextMenu(QPoint pos) if(iCurrentRow == 0) { QMenu menu(ui->tableWidget_2); - menu.addAction(QIcon(::GetImagePath() + "antialiasing.png"), "删除当前测井图", this, &MainWindowCurve::slotDeleteSelectTrack); + menu.addAction(QIcon(::GetImagePath() + "antialiasing.png"), "删除当前测井图", this, &MainWindowCurve::slotDeleteSelectWell); menu.exec(ui->tableWidget_2->mapToGlobal(pos)); } } -void MainWindowCurve::slotDeleteSelectTrack() +void MainWindowCurve::slotDeleteSelectWell() { int colCount = ui->tableWidget_2->columnCount(); diff --git a/logPlus/mainwindowcurve.h b/logPlus/mainwindowcurve.h index 65efbed..af843ff 100644 --- a/logPlus/mainwindowcurve.h +++ b/logPlus/mainwindowcurve.h @@ -164,7 +164,7 @@ public slots: //右键菜单响应函数 void slotContextMenu(QPoint pos); - void slotDeleteSelectTrack(); + void slotDeleteSelectWell(); public slots: void s_NewWell(QString strWellName, QString strSlfName);//新建井 @@ -236,6 +236,7 @@ public slots: void s_EShiftDepth(QString strSlfName, QString strLineName, int count, QList left_Low_List, QList right_Hight_List); // + void s_selectWell(); //选择井 void s_showHeadTable(); //显示/隐藏图头 void s_currtemplite(); //加载图文件 void s_Save(); //保存图文件 diff --git a/logPlus/qmycustomplot.cpp b/logPlus/qmycustomplot.cpp index 7a9c7e7..117bf70 100644 --- a/logPlus/qmycustomplot.cpp +++ b/logPlus/qmycustomplot.cpp @@ -1354,7 +1354,12 @@ void QMyCustomPlot::contextMenuEvent(QContextMenuEvent *event) pSubMenu->addAction(QIcon(::GetImagePath() + "icon/OneSideWallCore.png"), str, this, &QMyCustomPlot::addItem_Tubing); } } - //menu.addAction(QIcon(::GetImagePath() + "icon/OneSideWallCore.png"), "添加偏配", this, &QMyCustomPlot::addItem_Tubing); + menu.addSeparator(); + menu.addAction(QIcon(::GetImagePath() + "icon/CopyCoreTxt.png"), "从剪切板文本数据粘贴", this, &QMyCustomPlot::addItems_Tubing); + menu.addAction(QIcon(::GetImagePath() + "icon/ClearSelectCore.png"), "取消选中", this, &QMyCustomPlot::ClearSelectItems); + menu.addAction(QIcon(::GetImagePath() + "icon/Delete.png"), "全部清空", this, &QMyCustomPlot::DeleteItems_Tubing); + menu.addAction(QIcon(::GetImagePath() + "icon/CopyCoreTxt.png"), "刷新数据", this, &QMyCustomPlot::RefreshItems_Tubing); + menu.exec(event->globalPos()); } } @@ -4694,6 +4699,8 @@ void QMyCustomPlot::s_changeDepthProperty(QVariantList vlist) this->replot(); } } + +//校深线段 void QMyCustomPlot::addLineToPlot(double left_Low, double right_Hight, const QString strText, QColor crColor) { QtCommonClass *qtCommon = new QtCommonClass(this); @@ -8364,6 +8371,13 @@ void QMyCustomPlot::addItem_Tubing() //保存 SaveToSLF_Tubing(); + + if(!mRect_Tubing || !mRect2_Tubing) + { + //绘制结构 + DrawStruct(); + } + //检查套管组件名称,是否需要更新套管图形 //画管柱 if(str == "管底部" || @@ -8374,6 +8388,10 @@ void QMyCustomPlot::addItem_Tubing() //组件改变后,重绘管柱 LoadFromSLF_ReDrawTubing(m_strSlfName, m_strLineName); } + else{ + //刷新 + this->replot(); + } } } } @@ -8603,6 +8621,12 @@ bool QMyCustomPlot::LoadFromSLF_Tubing(QString strSlfName, QString csCurve) m_pResultList_Tubing.clear(); cclimgpath_Tubing=GetSymbolDir()+"\\管柱组件\\"; + //先删除 + if(mPixmap_Tubing) + { + removeItem(mPixmap_Tubing); + mPixmap_Tubing = nullptr; + } Slf_JIEGUPOS *m_pResult=NULL; CMemRdWt *logio=new CMemRdWt(); @@ -8932,3 +8956,278 @@ bool QMyCustomPlot::checkTubingName(QString m_Result) } return false; } + +//粘贴数据成取心 +void QMyCustomPlot::addItems_Tubing() +{ + int hasNO=0; + int isSK=0; + bool bReDraw = false; + { + QClipboard *clipboard = QApplication::clipboard(); //获取系统剪贴板指针 + QString originalTubingstring = clipboard->text(); //获取剪贴板上文本信息 + int isspace=originalTubingstring.indexOf(" "); + int istab=originalTubingstring.indexOf("\t"); + int isd=originalTubingstring.indexOf(","); + + if((istab>-1|isd>-1)&&isspace>-1) + { + QMessageBox::information(NULL,"提示","\",\"或制表符与空格键并存,自动分解可能有误!\n建议用单一符号风格!"); + } + originalTubingstring.replace("\t"," "); + originalTubingstring.replace(","," "); + originalTubingstring.replace("\r\n","\n"); + originalTubingstring.replace("\r","\n"); + QStringList line=originalTubingstring.split("\n"); + line.removeAll(""); + if(line.size()<1) return; + QString TableName; + QStringList temp1; + + if(line.size()>1) { + temp1=line[0].split(" "); + temp1.removeAll(""); + if(temp1.size()==1&&temp1.at(0).length()&&!temp1.at(0).at(0).isDigit()) { + TableName=temp1.at(0); + line.removeAt(0); + //CoreObj->SetName(TableName); + } + } + QString ss = m_strSlfName; + CMemRdWt *logio=new CMemRdWt(); + if(ss==""||!logio->Open(ss.toStdString().c_str(),CSlfIO::modeReadWrite)) + { + delete logio; + QMessageBox::information(NULL,"提示","SLF文件打开失败,请检查!!",QMessageBox::Yes); + return; + } + int k=0; + QStringList coredat=line[0].split(" "); + if((istab==-1||isd==-1)&&isspace>=0) coredat.removeAll(""); + int iIndex=logio->OpenTable(m_strLineName.toStdString().c_str()); + if(iIndex>=0) { + int count=logio->GetTableFieldCount(iIndex); + if(count!=coredat.size()) { + logio->DiscardObject(m_strLineName.toStdString().c_str()); + } + iIndex=-1; + } + bool isfirst=false; + if(iIndex<0) + { + QString name,Length,type,temp; + bool ret=false; + QStringList css; + if(coredat.size()&&!coredat[0].isEmpty()) { + int NUM=0; + if(!coredat.at(0).at(0).isDigit()){ + if(coredat.at(0).indexOf("NO",0,Qt::CaseInsensitive)<0 + &&coredat.at(0).indexOf("序号")<0 + &&coredat.at(0).indexOf("INDEX")<0 + &&coredat.at(0).indexOf("ORDER")<0 + ) + { + coredat.insert(0,"NO"); + hasNO=true; + } + } + else { + if(hasNO) coredat.insert(0,QString::number(1)); + } + if(m_strLineName=="SK"&&(coredat.size()==4||coredat.size()==5)) + { + isSK=1; + name="NO,SDEP,EDEP,ZONE,RESULT,THICK,TT,ZONENO,LAYER,DEST"; + Length="4,4,4,8,4,4,4,64,64,64"; + type= "1,4,4,6,1,4,4,6,6,6"; + temp= "0,0,0,0,1,0,0,0,0,0"; + NUM=10; + } + else { + for(int j=0;jj) + { + for (int k=0;k-1) temp+="8"; + else temp+"0"; + if(j!=coredat.size()) + { + name+=","; + Length+=","; + type+=","; + temp+=","; + } + } + if(!coredat.at(0).at(0).isDigit()&&coredat.at(0).at(0)!='.'&&coredat.at(0).at(0)!='-') name=coredat.join(","); + NUM=coredat.size(); + } + iIndex=logio->Open_Set_Table(m_strLineName.toStdString().c_str(),0,NUM, + (char*)name.toStdString().c_str(), + (char*)Length.toStdString().c_str(),//字段长度 + (char*)type.toStdString().c_str(),//字段类型 + (char*)temp.toStdString().c_str());//字段备注,1-枚举 + isfirst=true; + logio->SetTableRecordCount(iIndex,0); + } + } + int count=logio->GetTableFieldCount(iIndex); + Slf_TABLE_FIELD*pField=new Slf_TABLE_FIELD[logio->GetTableFieldCount(iIndex)]; + logio->GetTableFieldInfo(iIndex,pField); + float yy; + for(int i=0;i=0) coredat.removeAll(""); + if(coredat.size()<1) continue; + if(coredat[0].isEmpty()) continue; + if(coredat.size()<2)continue; + if(!coredat.at(0).at(0).isDigit()) continue; + if(hasNO) coredat.insert(0,QString::number(0)); +// for(int j=0;jSetTableFieldData(iIndex,j,(char*)&yy,k+1); +// } +// else if(j==3) logio->SetTableFieldData(iIndex,7,(char*)coredat[j].toStdString().c_str(),k+1); +// else if(j==4) logio->SetTableFieldData(iIndex,8,(char*)coredat[j].toStdString().c_str(),k+1); +// else if(j==5) logio->SetTableFieldData(iIndex,9,(char*)coredat[j].toStdString().c_str(),k+1); +// } +// else { +// if(pField[j].RepCode==6) { +// logio->SetTableFieldData(iIndex,j,(char*)coredat[j].toStdString().c_str(),k+1); +// } +// else { +// yy=coredat[j].toFloat(); +// logio->SetTableFieldData(iIndex,j,(char*)&yy,k+1); +// } +// } +// } +// k++; + //AddItem(coredat); + // + double Depth = coredat[1].toDouble(); + int Number = coredat[2].toDouble(); + Slf_JIEGUPOS result; + result.Depth = Depth; + result.Order = 0; + result.Number = Number; + // + drawOne_Tubing(result); + + //还没有画管柱 + if(Number == zoneOrder_Tubing.value("管底部").toInt()|| + Number == zoneOrder_Tubing.value("油管深").toInt()|| + Number == zoneOrder_Tubing.value("喇叭口").toInt()|| + Number == zoneOrder_Tubing.value("剌叭口").toInt()) + { + bReDraw = true;//重画管柱 + } + } + delete logio; + delete []pField; + + if(isfirst) + { + AddTableToWellRound(); + //绘制结构 + DrawStruct(); + } + + //保存 + SaveToSLF_Tubing(); + + if(bReDraw) + { + //组件改变后,重绘管柱 + LoadFromSLF_ReDrawTubing(m_strSlfName, m_strLineName); + } + else + { + //刷新 + this->replot(); + } + + //属性清空 + PropertyService()->InitCurrentViewInfo(); + } +} + +//全部清空 +void QMyCustomPlot::DeleteItems_Tubing() +{ + if(QMessageBox::information(NULL,QObject::tr("提示"),QObject::tr("该功能将清除当前组件展示的全部信息,清除后无法恢复,但会备份到对应的\"_BAK\"中,确定清除吗?"),QMessageBox::Yes|QMessageBox::No)!=QMessageBox::Yes) return; + QString obj=m_strLineName + "BAK"; + CopyToSLFFile(m_strSlfName, false, (char *)obj.toStdString().c_str()); + AddTableToWellRound(); + + //删除对象 + TransparentDraggableGuan *pDraggableRect =NULL; + QMap::Iterator it = m_mapDraggable_Guan.begin(); + while( it != m_mapDraggable_Guan.end() ) + { + pDraggableRect = (TransparentDraggableGuan*)it.value(); + it++; + pDraggableRect->deleteRect(); + } + + //刷新 + //this->replot(); + + //保存 + SaveToSLF_Tubing(); + + //重新加载 + LoadFromSLF_Tubing(m_strSlfName, m_strLineName); + + //属性清空 + PropertyService()->InitCurrentViewInfo(); +} + +//刷新数据 +void QMyCustomPlot::RefreshItems_Tubing() +{ + //删除对象 + TransparentDraggableGuan *pDraggableRect =NULL; + QMap::Iterator it = m_mapDraggable_Guan.begin(); + while( it != m_mapDraggable_Guan.end() ) + { + pDraggableRect = (TransparentDraggableGuan*)it.value(); + it++; + pDraggableRect->deleteRect(); + } + + //重新加载 + LoadFromSLF_Tubing(m_strSlfName, m_strLineName); + //属性清空 + PropertyService()->InitCurrentViewInfo(); +} + diff --git a/logPlus/qmycustomplot.h b/logPlus/qmycustomplot.h index 62c52c3..1645525 100644 --- a/logPlus/qmycustomplot.h +++ b/logPlus/qmycustomplot.h @@ -348,7 +348,8 @@ public: //套管组件 void addGuanToPlot(double left_Low, double right_Hight, const QString imagePath, float in, bool bRefresh=true); - // + + //校深线段 void addLineToPlot(double left_Low, double right_Hight, const QString strText, QColor crColor=QColor(255, 255, 255, 80)); //框选并编辑曲线 @@ -476,7 +477,9 @@ public slots: //右键--套管组件 void addItem_Tubing(); //添加套管组件 - //void RefreshItems_Tubing(); //刷新数据 + void addItems_Tubing(); //从剪切板文本数据粘贴 + void DeleteItems_Tubing();//全部清空 + void RefreshItems_Tubing(); //刷新数据 //右键--解释结论 void onOpenEditResult(); diff --git a/logPlus/selectwelldialog.cpp b/logPlus/selectwelldialog.cpp new file mode 100644 index 0000000..55d0d97 --- /dev/null +++ b/logPlus/selectwelldialog.cpp @@ -0,0 +1,74 @@ +#include "selectwelldialog.h" +#include "ui_selectwelldialog.h" +#include +#include + +int g_SelectWellIndex = 0; + +SelectWellDialog::SelectWellDialog(QWidget *parent) : + QDialog(parent), + ui(new Ui::SelectWellDialog) +{ + ui->setupUi(this); + loadStyle(":/qrc/qss/flatgray.css"); + + // + connect(ui->ok, SIGNAL(clicked()), this, SLOT(slotOkClicked())); + connect(ui->cancel, SIGNAL(clicked()), this, SLOT(slotCancelClicked())); +} + +SelectWellDialog::~SelectWellDialog() +{ + delete ui; +} + + +void SelectWellDialog::loadStyle(const QString &qssFile) +{ + //加载样式表 + QString qss; + QFile file(qssFile); + if (file.open(QFile::ReadOnly)) { + //用QTextStream读取样式文件不用区分文件编码 带bom也行 + QStringList list; + QTextStream in(&file); + //in.setCodec("utf-8"); + while (!in.atEnd()) { + QString line; + in >> line; + list << line; + } + + file.close(); + qss = list.join("\n"); + QString paletteColor = qss.mid(20, 7); + this->setPalette(QPalette(paletteColor)); + //用时主要在下面这句 + this->setStyleSheet(qss); + } +} + +void SelectWellDialog::setInfo(QStringList listWell, QStringList listSlf) +{ + for(int i=0; icomboBox->addItem(listWell[i]); + } +} + +// +void SelectWellDialog::slotOkClicked() +{ + g_SelectWellIndex = ui->comboBox->currentIndex(); + + //关闭 + accept(); // 让 QDialog::exec() 返回 QDialog::Accepted + //QDialog::close(); +} + +// +void SelectWellDialog::slotCancelClicked() +{ + reject(); // 让 QDialog::exec() 返回 QDialog::Rejected + //QDialog::close(); +} diff --git a/logPlus/selectwelldialog.h b/logPlus/selectwelldialog.h new file mode 100644 index 0000000..9ffb041 --- /dev/null +++ b/logPlus/selectwelldialog.h @@ -0,0 +1,30 @@ +#ifndef SELECTWELLDIALOG_H +#define SELECTWELLDIALOG_H + +#include + +namespace Ui { +class SelectWellDialog; +} + +class SelectWellDialog : public QDialog +{ + Q_OBJECT + +public: + explicit SelectWellDialog(QWidget *parent = nullptr); + ~SelectWellDialog(); + +private: + Ui::SelectWellDialog *ui; + +public: + void loadStyle(const QString &qssFile); + void setInfo(QStringList listWell, QStringList listSlf); + +public slots: + void slotOkClicked(); + void slotCancelClicked(); +}; + +#endif // SELECTWELLDIALOG_H diff --git a/logPlus/selectwelldialog.ui b/logPlus/selectwelldialog.ui new file mode 100644 index 0000000..b860203 --- /dev/null +++ b/logPlus/selectwelldialog.ui @@ -0,0 +1,70 @@ + + + SelectWellDialog + + + + 0 + 0 + 400 + 300 + + + + 选择井 + + + + + + + + + + 选择井: + + + + + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + 选择 + + + + + + + 取消 + + + + + + + + + + + +