1.支持将图头和成果表导出为模板 2.支持从模板加载图头和成果表
This commit is contained in:
parent
3d0dc7fc4f
commit
9610ec0ecf
|
|
@ -24,10 +24,12 @@ extern QString g_prjname;
|
||||||
int g_iFixedWidth=0;//40;
|
int g_iFixedWidth=0;//40;
|
||||||
int g_iFixedHeight=0;//30;
|
int g_iFixedHeight=0;//30;
|
||||||
|
|
||||||
int g_iColsWidth=100;
|
|
||||||
int g_iRowsHight=40;
|
|
||||||
extern double g_dPixelPerCm;//每厘米像素数
|
extern double g_dPixelPerCm;//每厘米像素数
|
||||||
|
|
||||||
|
//下方赋值
|
||||||
|
int g_iColsWidth=0; //100
|
||||||
|
int g_iRowsHight=0; //40
|
||||||
|
|
||||||
extern QtProjectWidgets *g_projectWidgets; //左侧工程区
|
extern QtProjectWidgets *g_projectWidgets; //左侧工程区
|
||||||
|
|
||||||
//画图头
|
//画图头
|
||||||
|
|
@ -37,11 +39,15 @@ FormHead::FormHead(QWidget *parent, QString indexID) :
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
|
||||||
|
g_iColsWidth = g_dPixelPerCm * HEAD_COL_Width;
|
||||||
|
g_iRowsHight = g_dPixelPerCm * HEAD_ROW_Height;
|
||||||
|
|
||||||
//加载样式
|
//加载样式
|
||||||
loadStyle(":/qrc/qss/flatgray.css");
|
loadStyle(":/qrc/qss/flatgray.css");
|
||||||
|
|
||||||
m_indexID =indexID;
|
m_indexID =indexID;
|
||||||
m_parent = (FormMultiHeads *)parent;
|
m_parent = (FormMultiHeads *)parent;
|
||||||
|
m_strHeadOrTail = m_parent->m_strHeadOrTail;
|
||||||
|
|
||||||
// 强制使用Qt渲染引擎
|
// 强制使用Qt渲染引擎
|
||||||
//QApplication::setAttribute(Qt::AA_UseStyleSheetPropagationInWidgetStyles, true);
|
//QApplication::setAttribute(Qt::AA_UseStyleSheetPropagationInWidgetStyles, true);
|
||||||
|
|
@ -755,8 +761,8 @@ QJsonObject FormHead::makeJson()
|
||||||
iFormulaType = formTableItemTmp->m_iFormulaType;
|
iFormulaType = formTableItemTmp->m_iFormulaType;
|
||||||
|
|
||||||
//行高、列宽
|
//行高、列宽
|
||||||
my_colWidth = ui->tableWidget->columnWidth(col)/g_dPixelPerCm;
|
my_colWidth = formTableItemTmp->m_colWidth; //ui->tableWidget->columnWidth(col)/g_dPixelPerCm;
|
||||||
my_rowHeight = ui->tableWidget->rowHeight(row)/g_dPixelPerCm;
|
my_rowHeight = formTableItemTmp->m_rowHeight; //ui->tableWidget->rowHeight(row)/g_dPixelPerCm;
|
||||||
|
|
||||||
int rowSpan = 0;
|
int rowSpan = 0;
|
||||||
int columnSpan = 0;
|
int columnSpan = 0;
|
||||||
|
|
@ -874,6 +880,18 @@ void FormHead::slotContextMenu(QPoint pos)
|
||||||
menu.addAction(QIcon(::GetImagePath() + "icon/Grid.png"), "复制", this, &FormHead::copy);
|
menu.addAction(QIcon(::GetImagePath() + "icon/Grid.png"), "复制", this, &FormHead::copy);
|
||||||
menu.addAction(QIcon(::GetImagePath() + "icon/Grid.png"), "粘贴", this, &FormHead::Paste);
|
menu.addAction(QIcon(::GetImagePath() + "icon/Grid.png"), "粘贴", this, &FormHead::Paste);
|
||||||
menu.addSeparator();
|
menu.addSeparator();
|
||||||
|
|
||||||
|
QString strMenu= "";
|
||||||
|
if(m_strHeadOrTail == "Head")
|
||||||
|
{
|
||||||
|
strMenu= "保存为图头模板";
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
strMenu= "保存为成果表模板";
|
||||||
|
}
|
||||||
|
menu.addAction(QIcon(::GetImagePath() + "icon/Save.png"), strMenu, this, &FormHead::slotSaveJsonModel);
|
||||||
|
menu.addSeparator();
|
||||||
|
|
||||||
menu.addAction(QIcon(::GetImagePath() + "icon/MergeCell.png"), "合并单元格", this, &FormHead::slotMerge);
|
menu.addAction(QIcon(::GetImagePath() + "icon/MergeCell.png"), "合并单元格", this, &FormHead::slotMerge);
|
||||||
menu.addAction(QIcon(::GetImagePath() + "icon/Grid.png"), "拆分单元格", this, &FormHead::slotSplit);
|
menu.addAction(QIcon(::GetImagePath() + "icon/Grid.png"), "拆分单元格", this, &FormHead::slotSplit);
|
||||||
menu.addAction(QIcon(::GetImagePath() + "icon/Grid.png"), "边框", this, &FormHead::slotCellBorder);
|
menu.addAction(QIcon(::GetImagePath() + "icon/Grid.png"), "边框", this, &FormHead::slotCellBorder);
|
||||||
|
|
@ -890,6 +908,12 @@ void FormHead::slotContextMenu(QPoint pos)
|
||||||
menu.exec(ui->tableWidget->mapToGlobal(pos));
|
menu.exec(ui->tableWidget->mapToGlobal(pos));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//保存图头模板
|
||||||
|
void FormHead::slotSaveJsonModel()
|
||||||
|
{
|
||||||
|
m_parent->slotSaveJsonModel();
|
||||||
|
}
|
||||||
|
|
||||||
//合并
|
//合并
|
||||||
void FormHead::slotMerge()
|
void FormHead::slotMerge()
|
||||||
{
|
{
|
||||||
|
|
@ -1424,8 +1448,18 @@ void FormHead::getTableSize_Biggest(int &iWidth, int &iHight)
|
||||||
iWidth += columnCount;
|
iWidth += columnCount;
|
||||||
iHight += rowCount;
|
iHight += rowCount;
|
||||||
|
|
||||||
iWidth = iWidth + ui->tableWidget->verticalScrollBar()->width();
|
//
|
||||||
iHight = iHight + ui->tableWidget->horizontalScrollBar()->height();
|
int left, top, right, bottom;
|
||||||
|
this->getContentsMargins(&left, &top, &right, &bottom);
|
||||||
|
iWidth = iWidth + left + right;
|
||||||
|
iHight = iHight + top + bottom;//Margin上方
|
||||||
|
|
||||||
|
//
|
||||||
|
// if(ui->tableWidget->horizontalScrollBar()->isVisible())
|
||||||
|
{
|
||||||
|
iWidth = iWidth + ui->tableWidget->verticalScrollBar()->width();
|
||||||
|
iHight = iHight + ui->tableWidget->horizontalScrollBar()->height();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//设置列宽
|
//设置列宽
|
||||||
|
|
|
||||||
|
|
@ -39,6 +39,7 @@ public:
|
||||||
|
|
||||||
bool m_bRefresh=true;
|
bool m_bRefresh=true;
|
||||||
FormMultiHeads *m_parent;
|
FormMultiHeads *m_parent;
|
||||||
|
QString m_strHeadOrTail = ""; //Head代表图头, Tail代表成果表
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void loadStyle(const QString &qssFile);
|
void loadStyle(const QString &qssFile);
|
||||||
|
|
@ -75,6 +76,8 @@ public slots:
|
||||||
|
|
||||||
//图头右键菜单响应函数
|
//图头右键菜单响应函数
|
||||||
void slotContextMenu(QPoint pos);
|
void slotContextMenu(QPoint pos);
|
||||||
|
|
||||||
|
void slotSaveJsonModel();//保存图头模板
|
||||||
//
|
//
|
||||||
void slotMerge();//合并
|
void slotMerge();//合并
|
||||||
void slotSplit();//拆分
|
void slotSplit();//拆分
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,18 @@
|
||||||
<string>Form</string>
|
<string>Form</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout">
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
|
<property name="leftMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="topMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="bottomMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
<item row="0" column="0">
|
<item row="0" column="0">
|
||||||
<widget class="QTableWidget" name="tableWidget">
|
<widget class="QTableWidget" name="tableWidget">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,8 @@
|
||||||
#include "formhead.h"
|
#include "formhead.h"
|
||||||
#include "qtcommonclass.h"
|
#include "qtcommonclass.h"
|
||||||
#include "CallManage.h"
|
#include "CallManage.h"
|
||||||
|
#include "geometryutils.h"
|
||||||
|
extern QString g_prjname;
|
||||||
|
|
||||||
extern int g_iRows;
|
extern int g_iRows;
|
||||||
extern int g_iCols;
|
extern int g_iCols;
|
||||||
|
|
@ -87,6 +89,63 @@ void FormMultiHeads::s_UnSelectTableItem(QString strUuid)
|
||||||
ui->tableWidget->clearSelection();
|
ui->tableWidget->clearSelection();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QJsonObject FormMultiHeads::makeJsonModel()
|
||||||
|
{
|
||||||
|
// 创建根对象
|
||||||
|
QJsonObject rootObj;
|
||||||
|
if(m_strHeadOrTail == "Head")
|
||||||
|
{
|
||||||
|
//图头
|
||||||
|
rootObj["heads"] = makeJsonArray();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
//成果表
|
||||||
|
rootObj["tails"] = makeJsonArray();
|
||||||
|
}
|
||||||
|
return rootObj;
|
||||||
|
}
|
||||||
|
|
||||||
|
//保存图头模板
|
||||||
|
void FormMultiHeads::slotSaveJsonModel()
|
||||||
|
{
|
||||||
|
QString folderPath;
|
||||||
|
folderPath = GetLogdataPath();
|
||||||
|
folderPath = folderPath + g_prjname;
|
||||||
|
|
||||||
|
QString strJsonFile;
|
||||||
|
if(m_strHeadOrTail == "Head")
|
||||||
|
{
|
||||||
|
//图头
|
||||||
|
strJsonFile = "图头文件(*.jsonHead)";
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
//成果表
|
||||||
|
strJsonFile = "成果表文件(*.jsonFoot)";
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
QString exPortPath = QFileDialog::getSaveFileName(this, "另存为", folderPath, strJsonFile);
|
||||||
|
if (exPortPath.isEmpty() == false)
|
||||||
|
{
|
||||||
|
QJsonObject rootObj = makeJsonModel();
|
||||||
|
// 生成JSON文档
|
||||||
|
QJsonDocument doc(rootObj);
|
||||||
|
// 写入文件
|
||||||
|
QFile file(exPortPath);
|
||||||
|
if(file.open(QIODevice::WriteOnly)){
|
||||||
|
file.write(doc.toJson(QJsonDocument::Indented));
|
||||||
|
file.close();
|
||||||
|
qDebug() << "JSON文件写入成功!";
|
||||||
|
//
|
||||||
|
//m_fileJson = exPortPath;
|
||||||
|
} else {
|
||||||
|
qWarning() << "文件打开失败:" << file.errorString();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void FormMultiHeads::loadStyle(const QString &qssFile)
|
void FormMultiHeads::loadStyle(const QString &qssFile)
|
||||||
{
|
{
|
||||||
//加载样式表
|
//加载样式表
|
||||||
|
|
@ -116,35 +175,128 @@ void FormMultiHeads::slotContextMenu(QPoint pos)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
QString strMenu= "";
|
QString strMenu= "";
|
||||||
|
QString strMenu2= "";
|
||||||
if(m_strHeadOrTail == "Head")
|
if(m_strHeadOrTail == "Head")
|
||||||
{
|
{
|
||||||
strMenu= "新建图头";
|
strMenu = "新建图头";
|
||||||
|
strMenu2 = "加载图头模板";
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
strMenu= "新建成果表";
|
strMenu = "新建成果表";
|
||||||
|
strMenu2 = "加载成果表模板";
|
||||||
}
|
}
|
||||||
QMenu menu(ui->tableWidget);
|
QMenu menu(ui->tableWidget);
|
||||||
QAction *newAction = menu.addAction(strMenu);
|
|
||||||
// 弹出菜单
|
menu.addAction(QIcon(::GetImagePath() + "icon/Edit.png"), strMenu, this, &FormMultiHeads::slotCreateHeadOrFoot);
|
||||||
QAction *selectedAction = menu.exec(ui->tableWidget->mapToGlobal(pos));
|
menu.addAction(QIcon(::GetImagePath() + "icon/Sheet.png"), strMenu2, this, &FormMultiHeads::slotLoadHeadOrFoot);
|
||||||
if (selectedAction == newAction) {
|
menu.exec(ui->tableWidget->mapToGlobal(pos));
|
||||||
NewHeadDialog *dlg = new NewHeadDialog(this);
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//创建图头或成果表
|
||||||
|
void FormMultiHeads::slotCreateHeadOrFoot()
|
||||||
|
{
|
||||||
|
NewHeadDialog *dlg = new NewHeadDialog(this);
|
||||||
|
//
|
||||||
|
dlg->setAttribute(Qt::WA_DeleteOnClose);//关闭时,自动删除窗口对象
|
||||||
|
int result = dlg->exec();//模态对话框
|
||||||
|
if (result == QDialog::Accepted) {
|
||||||
|
// 处理用户点击了确定按钮的逻辑
|
||||||
|
qDebug() << "Accepted=";
|
||||||
|
AddHead();
|
||||||
|
}
|
||||||
|
else if (result == QDialog::Rejected) {
|
||||||
|
// 处理用户点击了取消按钮的逻辑
|
||||||
|
qDebug() << "Rejected=";
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// 处理其他情况的逻辑
|
||||||
|
qDebug() << "other=";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//加载图头或成果表
|
||||||
|
void FormMultiHeads::slotLoadHeadOrFoot()
|
||||||
|
{
|
||||||
|
QString folderPath;
|
||||||
|
folderPath = GetLogdataPath();
|
||||||
|
folderPath = folderPath + g_prjname;
|
||||||
|
|
||||||
|
QString strJsonFile;
|
||||||
|
if(m_strHeadOrTail == "Head")
|
||||||
|
{
|
||||||
|
//图头
|
||||||
|
strJsonFile = "图头文件(*.jsonHead)";
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
//成果表
|
||||||
|
strJsonFile = "成果表文件(*.jsonFoot)";
|
||||||
|
}
|
||||||
|
|
||||||
|
//打开
|
||||||
|
QString fileFull = "";
|
||||||
|
fileFull = QFileDialog::getOpenFileName(this,
|
||||||
|
tr("选择模板"),
|
||||||
|
folderPath,
|
||||||
|
strJsonFile);
|
||||||
|
if (fileFull.isEmpty())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
QJsonParseError jsonError;
|
||||||
|
// 文件
|
||||||
|
QFile file(fileFull);
|
||||||
|
if(file.open(QIODevice::ReadOnly))
|
||||||
|
{
|
||||||
|
// 解析JSON
|
||||||
|
QJsonDocument document = QJsonDocument::fromJson(file.readAll(), &jsonError);
|
||||||
|
if (!document.isNull() && (jsonError.error == QJsonParseError::NoError))
|
||||||
|
{
|
||||||
|
if (document.isObject())
|
||||||
|
{
|
||||||
|
QJsonObject object = document.object();
|
||||||
|
//
|
||||||
|
if(m_strHeadOrTail == "Head")
|
||||||
|
{
|
||||||
|
if (object.contains("heads"))
|
||||||
|
{
|
||||||
|
//从json加载图头
|
||||||
|
QJsonValue value = object.value("heads");
|
||||||
|
if (value.isArray()) {
|
||||||
|
QJsonArray headsArray = value.toArray();
|
||||||
|
|
||||||
|
bool bMultiProject = false;
|
||||||
|
DisplayHeads(headsArray, m_strHeadOrTail, bMultiProject);
|
||||||
|
//qDebug() << "headsArray number:" << QString::number(m_headsArray.size());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (object.contains("tails"))
|
||||||
|
{
|
||||||
|
//从json加载结果表
|
||||||
|
QJsonValue value = object.value("tails");
|
||||||
|
if (value.isArray()) {
|
||||||
|
QJsonArray tailsArray = value.toArray();
|
||||||
|
//
|
||||||
|
bool bMultiProject = false;
|
||||||
|
DisplayHeads(tailsArray, m_strHeadOrTail, bMultiProject);
|
||||||
|
//qDebug() << "tailsArray number:" << QString::number(m_tailsArray.size());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
dlg->setAttribute(Qt::WA_DeleteOnClose);//关闭时,自动删除窗口对象
|
file.close();
|
||||||
int result = dlg->exec();//模态对话框
|
qDebug() << "JSON 模板文件读取成功!";
|
||||||
if (result == QDialog::Accepted) {
|
}
|
||||||
// 处理用户点击了确定按钮的逻辑
|
else {
|
||||||
qDebug() << "Accepted=";
|
qWarning() << "JSON 模板文件打开失败:" << file.errorString();
|
||||||
AddHead();
|
QMessageBox::information(NULL,"提示","模板加载失败!",QMessageBox::Ok);
|
||||||
}
|
|
||||||
else if (result == QDialog::Rejected) {
|
|
||||||
// 处理用户点击了取消按钮的逻辑
|
|
||||||
qDebug() << "Rejected=";
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
// 处理其他情况的逻辑
|
|
||||||
qDebug() << "other=";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -405,6 +557,7 @@ void FormMultiHeads::getTableSize_Biggest(int &iWidth_Big, int &iHight_Big)
|
||||||
// int iWidth_Big = 0;
|
// int iWidth_Big = 0;
|
||||||
// int iHight_Big = 0;
|
// int iHight_Big = 0;
|
||||||
|
|
||||||
|
int columnCount = ui->tableWidget->columnCount();//总列数
|
||||||
int rowCount = ui->tableWidget->rowCount();//总行数
|
int rowCount = ui->tableWidget->rowCount();//总行数
|
||||||
for(int i=0; i<rowCount; i++)
|
for(int i=0; i<rowCount; i++)
|
||||||
{
|
{
|
||||||
|
|
@ -420,19 +573,23 @@ void FormMultiHeads::getTableSize_Biggest(int &iWidth_Big, int &iHight_Big)
|
||||||
int iWidth_Tmp = 0;
|
int iWidth_Tmp = 0;
|
||||||
int iHight_Tmp = 0;
|
int iHight_Tmp = 0;
|
||||||
widgetHead->getTableSize_Biggest(iWidth_Tmp, iHight_Tmp);
|
widgetHead->getTableSize_Biggest(iWidth_Tmp, iHight_Tmp);
|
||||||
|
|
||||||
|
//宽度取最大
|
||||||
if(iWidth_Tmp>iWidth_Big)
|
if(iWidth_Tmp>iWidth_Big)
|
||||||
{
|
{
|
||||||
iWidth_Big = iWidth_Tmp;
|
iWidth_Big = iWidth_Tmp;
|
||||||
}
|
}
|
||||||
if(iHight_Tmp>iHight_Big)
|
//高度相加
|
||||||
{
|
iHight_Big += iHight_Tmp;
|
||||||
iHight_Big = iHight_Tmp;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
iWidth_Big += columnCount;
|
||||||
|
iHight_Big += rowCount;
|
||||||
|
|
||||||
//
|
//
|
||||||
int left, top, right, bottom;
|
int left, top, right, bottom;
|
||||||
this->getContentsMargins(&left, &top, &right, &bottom);
|
this->getContentsMargins(&left, &top, &right, &bottom);
|
||||||
|
|
@ -440,6 +597,13 @@ void FormMultiHeads::getTableSize_Biggest(int &iWidth_Big, int &iHight_Big)
|
||||||
iWidth_Big = iWidth_Big + left + right;
|
iWidth_Big = iWidth_Big + left + right;
|
||||||
iHight_Big = iHight_Big + top + bottom;//Margin上方
|
iHight_Big = iHight_Big + top + bottom;//Margin上方
|
||||||
|
|
||||||
iWidth_Big = iWidth_Big + ui->tableWidget->verticalScrollBar()->width();
|
// if(ui->tableWidget->horizontalScrollBar()->isVisible())
|
||||||
iHight_Big = iHight_Big + ui->tableWidget->horizontalScrollBar()->height();
|
{
|
||||||
|
iWidth_Big = iWidth_Big + ui->tableWidget->verticalScrollBar()->width();
|
||||||
|
iHight_Big = iHight_Big + ui->tableWidget->horizontalScrollBar()->height();
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
iWidth_Big += 30;
|
||||||
|
iHight_Big += 30;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -33,6 +33,15 @@ public slots:
|
||||||
//取消其他表格的选中状态
|
//取消其他表格的选中状态
|
||||||
void s_UnSelectTableItem(QString strUuid);
|
void s_UnSelectTableItem(QString strUuid);
|
||||||
|
|
||||||
|
//创建图头或成果表
|
||||||
|
void slotCreateHeadOrFoot();
|
||||||
|
//加载图头或成果表
|
||||||
|
void slotLoadHeadOrFoot();
|
||||||
|
|
||||||
|
//保存图头模板
|
||||||
|
void slotSaveJsonModel();
|
||||||
|
QJsonObject makeJsonModel();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void loadStyle(const QString &qssFile);
|
void loadStyle(const QString &qssFile);
|
||||||
void AddHead();
|
void AddHead();
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,9 @@
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
//#include "PropertyWidget.h"
|
//#include "PropertyWidget.h"
|
||||||
|
|
||||||
|
#define HEAD_COL_Width 1
|
||||||
|
#define HEAD_ROW_Height 0.5
|
||||||
|
|
||||||
#pragma execution_character_set("utf-8")
|
#pragma execution_character_set("utf-8")
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
|
|
@ -44,8 +47,8 @@ public:
|
||||||
int m_iFormulaType = 0;
|
int m_iFormulaType = 0;
|
||||||
|
|
||||||
//图头, 行高、列宽
|
//图头, 行高、列宽
|
||||||
double m_colWidth = 1;
|
double m_colWidth = HEAD_COL_Width;
|
||||||
double m_rowHeight = 1;
|
double m_rowHeight = HEAD_ROW_Height;
|
||||||
|
|
||||||
QString m_strSlfName = "";
|
QString m_strSlfName = "";
|
||||||
QString m_strWellName = "";
|
QString m_strWellName = "";
|
||||||
|
|
|
||||||
|
|
@ -4528,6 +4528,8 @@ void MainWindowCurve::_slotExport(QPrinter &printer, int IsBmp, QString pngName,
|
||||||
//
|
//
|
||||||
geoRect_Head = m_dock1->geometry();
|
geoRect_Head = m_dock1->geometry();
|
||||||
m_dock1->setGeometry(geoRect_Head.x(), geoRect_Head.y(), iMaxWidth, iHight_Head);
|
m_dock1->setGeometry(geoRect_Head.x(), geoRect_Head.y(), iMaxWidth, iHight_Head);
|
||||||
|
//重新获取
|
||||||
|
m_formMultiHeads->getTableSize(iWidth_Head, iHight_Head);
|
||||||
QPixmap pPixmap_Head = this->grab(QRect(geoRect_Head.x(), geoRect_Head.y(), iMaxWidth, iHight_Head));
|
QPixmap pPixmap_Head = this->grab(QRect(geoRect_Head.x(), geoRect_Head.y(), iMaxWidth, iHight_Head));
|
||||||
//保存,方便查看
|
//保存,方便查看
|
||||||
if(g_iDebug)
|
if(g_iDebug)
|
||||||
|
|
@ -4541,6 +4543,8 @@ void MainWindowCurve::_slotExport(QPrinter &printer, int IsBmp, QString pngName,
|
||||||
m_dock2->show();
|
m_dock2->show();
|
||||||
geoRect_Tail = m_dock2->geometry();
|
geoRect_Tail = m_dock2->geometry();
|
||||||
m_dock2->setGeometry(geoRect_Tail.x(), geoRect_Tail.y(), iMaxWidth, iHight_Tail);
|
m_dock2->setGeometry(geoRect_Tail.x(), geoRect_Tail.y(), iMaxWidth, iHight_Tail);
|
||||||
|
//重新获取
|
||||||
|
m_formMultiTails->getTableSize(iWidth_Tail, iHight_Tail);
|
||||||
QPixmap pPixmap_Tail = this->grab(QRect(geoRect_Tail.x(), geoRect_Tail.y(), iMaxWidth, iHight_Tail));
|
QPixmap pPixmap_Tail = this->grab(QRect(geoRect_Tail.x(), geoRect_Tail.y(), iMaxWidth, iHight_Tail));
|
||||||
//保存,方便查看
|
//保存,方便查看
|
||||||
if(g_iDebug)
|
if(g_iDebug)
|
||||||
|
|
@ -6397,7 +6401,7 @@ void MainWindowCurve::dropEvent(QDropEvent* event)
|
||||||
if (event->mimeData()->hasFormat("text/plain")) {
|
if (event->mimeData()->hasFormat("text/plain")) {
|
||||||
// 获取拖拽的数据
|
// 获取拖拽的数据
|
||||||
QString strExtern = event->mimeData()->text();
|
QString strExtern = event->mimeData()->text();
|
||||||
qDebug() << strExtern;
|
//qDebug() << strExtern;
|
||||||
//
|
//
|
||||||
QStringList list = strExtern.split("#@@#");//QString字符串分割函数
|
QStringList list = strExtern.split("#@@#");//QString字符串分割函数
|
||||||
if (list.size() > 3)
|
if (list.size() > 3)
|
||||||
|
|
@ -6407,7 +6411,7 @@ void MainWindowCurve::dropEvent(QDropEvent* event)
|
||||||
QString strLineName = list[2];
|
QString strLineName = list[2];
|
||||||
QString strType = list[3];
|
QString strType = list[3];
|
||||||
|
|
||||||
qDebug() << "strSlfName:" << strSlfName<< " strWellName:" << strWellName << " strLineName:" << strLineName << " strType:" << strType;
|
//qDebug() << "strSlfName:" << strSlfName<< " strWellName:" << strWellName << " strLineName:" << strLineName << " strType:" << strType;
|
||||||
|
|
||||||
if(strType=="curveObject" || strType=="waveObject" || strType=="tableObject")
|
if(strType=="curveObject" || strType=="waveObject" || strType=="tableObject")
|
||||||
{
|
{
|
||||||
|
|
@ -6481,7 +6485,7 @@ void MainWindowCurve::Open(QString fileFull)
|
||||||
QJsonValue value = object.value("iScale");
|
QJsonValue value = object.value("iScale");
|
||||||
if (value.isDouble()) {
|
if (value.isDouble()) {
|
||||||
int iScale = value.toInt();
|
int iScale = value.toInt();
|
||||||
qDebug() << "iScale:" << QString::number(iScale);
|
//qDebug() << "iScale:" << QString::number(iScale);
|
||||||
//
|
//
|
||||||
m_iScale = iScale;
|
m_iScale = iScale;
|
||||||
}
|
}
|
||||||
|
|
@ -6492,7 +6496,7 @@ void MainWindowCurve::Open(QString fileFull)
|
||||||
QJsonValue value = object.value("iY1");
|
QJsonValue value = object.value("iY1");
|
||||||
if (value.isDouble()) {
|
if (value.isDouble()) {
|
||||||
int iY1 = value.toInt();
|
int iY1 = value.toInt();
|
||||||
qDebug() << "iY1:" << QString::number(iY1);
|
//qDebug() << "iY1:" << QString::number(iY1);
|
||||||
//
|
//
|
||||||
m_iY1 = iY1;
|
m_iY1 = iY1;
|
||||||
}
|
}
|
||||||
|
|
@ -6503,7 +6507,7 @@ void MainWindowCurve::Open(QString fileFull)
|
||||||
QJsonValue value = object.value("iY2");
|
QJsonValue value = object.value("iY2");
|
||||||
if (value.isDouble()) {
|
if (value.isDouble()) {
|
||||||
int iY2 = value.toInt();
|
int iY2 = value.toInt();
|
||||||
qDebug() << "iY2:" << QString::number(iY2);
|
//qDebug() << "iY2:" << QString::number(iY2);
|
||||||
//
|
//
|
||||||
m_iY2 = iY2;
|
m_iY2 = iY2;
|
||||||
}
|
}
|
||||||
|
|
@ -6514,7 +6518,7 @@ void MainWindowCurve::Open(QString fileFull)
|
||||||
QJsonValue value = object.value("wells");
|
QJsonValue value = object.value("wells");
|
||||||
if (value.isArray()) {
|
if (value.isArray()) {
|
||||||
wellsArray = value.toArray();
|
wellsArray = value.toArray();
|
||||||
qDebug() << "wellsArray number:" << QString::number(wellsArray.size());
|
//qDebug() << "wellsArray number:" << QString::number(wellsArray.size());
|
||||||
|
|
||||||
//是否正在加载json
|
//是否正在加载json
|
||||||
g_iLoadingJson = 1;
|
g_iLoadingJson = 1;
|
||||||
|
|
@ -6535,7 +6539,7 @@ void MainWindowCurve::Open(QString fileFull)
|
||||||
QJsonValue value = object.value("heads");
|
QJsonValue value = object.value("heads");
|
||||||
if (value.isArray()) {
|
if (value.isArray()) {
|
||||||
m_headsArray = value.toArray();
|
m_headsArray = value.toArray();
|
||||||
qDebug() << "headsArray number:" << QString::number(m_headsArray.size());
|
//qDebug() << "headsArray number:" << QString::number(m_headsArray.size());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (object.contains("tails"))
|
if (object.contains("tails"))
|
||||||
|
|
@ -6546,7 +6550,7 @@ void MainWindowCurve::Open(QString fileFull)
|
||||||
QJsonValue value = object.value("tails");
|
QJsonValue value = object.value("tails");
|
||||||
if (value.isArray()) {
|
if (value.isArray()) {
|
||||||
m_tailsArray = value.toArray();
|
m_tailsArray = value.toArray();
|
||||||
qDebug() << "tailsArray number:" << QString::number(m_tailsArray.size());
|
//qDebug() << "tailsArray number:" << QString::number(m_tailsArray.size());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -6554,7 +6558,7 @@ void MainWindowCurve::Open(QString fileFull)
|
||||||
|
|
||||||
//
|
//
|
||||||
file.close();
|
file.close();
|
||||||
qDebug() << "JSON 模板文件读取成功!";
|
//qDebug() << "JSON 模板文件读取成功!";
|
||||||
|
|
||||||
//可视区域高度
|
//可视区域高度
|
||||||
int iScreenHeight = this->getScreenHeight();
|
int iScreenHeight = this->getScreenHeight();
|
||||||
|
|
@ -6604,7 +6608,7 @@ void MainWindowCurve::OpenMultiWell(QString fileFull)
|
||||||
QJsonValue value = object.value("wells");
|
QJsonValue value = object.value("wells");
|
||||||
if (value.isArray()) {
|
if (value.isArray()) {
|
||||||
wellsArray = value.toArray();
|
wellsArray = value.toArray();
|
||||||
qDebug() << "wellsArray number:" << QString::number(wellsArray.size());
|
//qDebug() << "wellsArray number:" << QString::number(wellsArray.size());
|
||||||
|
|
||||||
//是否正在加载json
|
//是否正在加载json
|
||||||
g_iLoadingJson = 1;
|
g_iLoadingJson = 1;
|
||||||
|
|
@ -6621,7 +6625,7 @@ void MainWindowCurve::OpenMultiWell(QString fileFull)
|
||||||
|
|
||||||
//
|
//
|
||||||
file.close();
|
file.close();
|
||||||
qDebug() << "JSON 模板文件读取成功!";
|
//qDebug() << "JSON 模板文件读取成功!";
|
||||||
|
|
||||||
//重置右侧滚动条
|
//重置右侧滚动条
|
||||||
// ui->verticalScrollBar->setRange(-m_iY2*100, -m_iY1*100);
|
// ui->verticalScrollBar->setRange(-m_iY2*100, -m_iY1*100);
|
||||||
|
|
@ -7109,7 +7113,7 @@ void MainWindowCurve::DisplayWells(QJsonArray wellsArray)
|
||||||
QJsonValue value = wellObj.value("id");
|
QJsonValue value = wellObj.value("id");
|
||||||
if (value.isDouble()) {
|
if (value.isDouble()) {
|
||||||
id = value.toInt();
|
id = value.toInt();
|
||||||
qDebug() << "id:" << QString::number(id);
|
//qDebug() << "id:" << QString::number(id);
|
||||||
//
|
//
|
||||||
mapWells.insert(id, i);
|
mapWells.insert(id, i);
|
||||||
}
|
}
|
||||||
|
|
@ -7152,7 +7156,7 @@ void MainWindowCurve::DisplayWell_One(QJsonObject wellObjInfo)
|
||||||
QJsonValue value = wellObjInfo.value("WellName");
|
QJsonValue value = wellObjInfo.value("WellName");
|
||||||
if (value.isString()) {
|
if (value.isString()) {
|
||||||
strWellName = value.toString();
|
strWellName = value.toString();
|
||||||
qDebug() << "WellName:" << strWellName;
|
//qDebug() << "WellName:" << strWellName;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -7161,7 +7165,7 @@ void MainWindowCurve::DisplayWell_One(QJsonObject wellObjInfo)
|
||||||
QJsonValue value = wellObjInfo.value("SlfName");
|
QJsonValue value = wellObjInfo.value("SlfName");
|
||||||
if (value.isString()) {
|
if (value.isString()) {
|
||||||
strSlfName = value.toString();
|
strSlfName = value.toString();
|
||||||
qDebug() << "strSlfName:" << strSlfName;
|
//qDebug() << "strSlfName:" << strSlfName;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//新建井
|
//新建井
|
||||||
|
|
@ -7186,7 +7190,7 @@ void MainWindowCurve::DisplayWell_One(QJsonObject wellObjInfo)
|
||||||
QJsonValue value = wellObjInfo.value("formTracks");
|
QJsonValue value = wellObjInfo.value("formTracks");
|
||||||
if (value.isArray()) {
|
if (value.isArray()) {
|
||||||
tracksArray = value.toArray();
|
tracksArray = value.toArray();
|
||||||
qDebug() << "tracksArray number:" << QString::number(tracksArray.size());
|
//qDebug() << "tracksArray number:" << QString::number(tracksArray.size());
|
||||||
//展示所有道
|
//展示所有道
|
||||||
DisplayTracks(tracksArray);
|
DisplayTracks(tracksArray);
|
||||||
}
|
}
|
||||||
|
|
@ -7211,7 +7215,7 @@ void MainWindowCurve::DisplayTracks(QJsonArray tracksArray)
|
||||||
QJsonValue value = trackObj.value("id");
|
QJsonValue value = trackObj.value("id");
|
||||||
if (value.isDouble()) {
|
if (value.isDouble()) {
|
||||||
id = value.toInt();
|
id = value.toInt();
|
||||||
qDebug() << "id:" << QString::number(id);
|
//qDebug() << "id:" << QString::number(id);
|
||||||
//
|
//
|
||||||
mapTracks.insert(id, i);
|
mapTracks.insert(id, i);
|
||||||
}
|
}
|
||||||
|
|
@ -7272,7 +7276,7 @@ void MainWindowCurve::DisplayTrack_Top(int id, QJsonObject trackTop, QJsonObject
|
||||||
QJsonValue value = trackTop.value("WellName");
|
QJsonValue value = trackTop.value("WellName");
|
||||||
if (value.isString()) {
|
if (value.isString()) {
|
||||||
strWellName = value.toString();
|
strWellName = value.toString();
|
||||||
qDebug() << "WellName:" << strWellName;
|
//qDebug() << "WellName:" << strWellName;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user