1.解决32276高度限制问题。2.采用自定义滚动条进行上下滚动。3.支持锁头 4.pdf出图支持双道头
This commit is contained in:
parent
51ba66e2e9
commit
1e3579ef1e
|
|
@ -168,6 +168,9 @@ signals:
|
|||
//改变缩放比例
|
||||
void sig_changeScale(QString strUuid, int iNewScale);
|
||||
|
||||
//自定义滚动条
|
||||
void sig_vertScrollBarChanged(QString strUuid, int iNewValue);
|
||||
|
||||
//改变深度
|
||||
void sig_changeDepth(QString strUuid, QString strSlfName, QString strWellName, int iY1, int iY2);
|
||||
|
||||
|
|
|
|||
|
|
@ -3229,8 +3229,8 @@ void FormDraw::setRowHeight(double dHight, QProgressBar *progressBar, int iSplit
|
|||
QMyCustomPlot *form = (QMyCustomPlot*)childWidget;
|
||||
if(form)
|
||||
{
|
||||
int nw = form->geometry().width();
|
||||
form->setGeometry(0, 0, nw, (int)dHight);//7500-3184
|
||||
//jyl int nw = form->geometry().width();
|
||||
//jyl form->setGeometry(0, 0, nw, (int)dHight);
|
||||
form->updateDepthY(m_iY1, m_iY2);
|
||||
|
||||
//emit CallManage::getInstance()->sig_ChangeLeftScale(m_strUuid, form->m_strSlfName, m_strWellName, m_strTrackName, form->m_strLineName, form->m_iX1);
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@
|
|||
#include <QDebug>
|
||||
#include <QMenu>
|
||||
#include <QFile>
|
||||
#include <QScrollBar>
|
||||
#include "newheaddialog.h"
|
||||
#include "formhead.h"
|
||||
#include "qtcommonclass.h"
|
||||
|
|
@ -355,15 +356,15 @@ void FormMultiHeads::getTableSize(int &iWidth, int &iHight)
|
|||
//获取可视视图大小 tableWidget
|
||||
iHight = 0;
|
||||
iWidth = 0;
|
||||
for(int i=0; i<ui->tableWidget->rowCount(); i++)
|
||||
{
|
||||
//高度
|
||||
iHight += ui->tableWidget->rowHeight(i);
|
||||
}
|
||||
|
||||
for(int j=0; j<ui->tableWidget->columnCount(); j++)
|
||||
if(ui->tableWidget->rowCount()==0)
|
||||
{
|
||||
//高度
|
||||
iWidth += ui->tableWidget->columnWidth(j);
|
||||
iHight = 0;
|
||||
iWidth = ui->tableWidget->width();
|
||||
}
|
||||
else {
|
||||
iHight = ui->tableWidget->height();
|
||||
iWidth = ui->tableWidget->width();
|
||||
iHight = iHight + 9; //Margin上方
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -48,6 +48,10 @@ FormWell::FormWell(QWidget *parent, QString strWellName) :
|
|||
// 连接信号和槽
|
||||
connect(ui->tableWidget, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(slotContextMenu(QPoint)));
|
||||
|
||||
//隐藏滚动条
|
||||
ui->tableWidget->verticalScrollBar()->setDisabled(true); // 禁用滚动
|
||||
ui->tableWidget->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); //隐藏垂直滚动条
|
||||
|
||||
//关联信号槽
|
||||
connect(CallManage::getInstance(), SIGNAL(sig_NewTrack(QString, QString, QString, QString, QString,int)), this, SLOT(s_NewTrack(QString, QString, QString, QString, QString,int)));
|
||||
//关联信号槽
|
||||
|
|
@ -75,6 +79,11 @@ FormWell::~FormWell()
|
|||
delete ui;
|
||||
}
|
||||
|
||||
void FormWell::resizeEvent(QResizeEvent *event)
|
||||
{
|
||||
//重设表格高度
|
||||
}
|
||||
|
||||
int FormWell::insertColumn(int nw)
|
||||
{
|
||||
auto table = ui->tableWidget;
|
||||
|
|
@ -230,14 +239,18 @@ QVector<QWidget *> FormWell::new_track(QStringList listdt, QString strTrackName)
|
|||
{
|
||||
dHight = 32767;
|
||||
}
|
||||
//jyl ui->tableWidget->setRowHeight(i, (int)dHight);
|
||||
|
||||
// 屏幕高度
|
||||
int iHeightOfScreen = 30000;//QApplication::desktop()->height();
|
||||
ui->tableWidget->setRowHeight(i, (int)iHeightOfScreen);
|
||||
|
||||
//设置高度
|
||||
ui->tableWidget->setRowHeight(i, (int)dHight);//7582
|
||||
//曲线绘制栏
|
||||
FormDraw *formDraw = new FormDraw(this, strWellName, strTrackName);
|
||||
formDraw->setBorderFlags(BorderFlags(BottomBorder | RightBorder));
|
||||
vec << formDraw;
|
||||
formDraw->m_iY1 = m_iY1;
|
||||
//
|
||||
formDraw->m_iY1 = m_iY2 - (iHeightOfScreen/g_dPixelPerCm/100.0 * (double)m_iScale);
|
||||
formDraw->m_iY2 = m_iY2;
|
||||
formDraw->setGridProperty(m_cuProperty.m_nInv, QPen(m_cuProperty.m_clor, m_cuProperty.m_nWidth, Qt::PenStyle(m_cuProperty.m_nType)),
|
||||
m_zhongProperty.m_nInv, QPen(m_zhongProperty.m_clor, m_zhongProperty.m_nWidth, Qt::PenStyle(m_zhongProperty.m_nType)),
|
||||
|
|
@ -248,7 +261,7 @@ QVector<QWidget *> FormWell::new_track(QStringList listdt, QString strTrackName)
|
|||
formDraw->m_iScale = m_iScale;
|
||||
formDraw->m_nTrackW = nW;
|
||||
|
||||
ui->tableWidget->setCellWidget(i, columnCount, formDraw);
|
||||
ui->tableWidget->setCellWidget(i, columnCount, formDraw);//默认用formDraw填充满
|
||||
}
|
||||
}
|
||||
m_mapFormDraw.insert(formTrack->getTrackUuid(), vec);
|
||||
|
|
@ -644,8 +657,12 @@ void FormWell::setWellProperty(QVariantList listVal)
|
|||
|
||||
void FormWell::setRowHeight(double dHight, QProgressBar *progressBar, int iSplit)
|
||||
{
|
||||
// 屏幕高度
|
||||
int iHeightOfScreen = 30000;//QApplication::desktop()->height();
|
||||
//int iHeightOfRow = ui->tableWidget->rowHeight(2);
|
||||
|
||||
//设置高度
|
||||
ui->tableWidget->setRowHeight(2, (int)dHight);//7582
|
||||
//jyl ui->tableWidget->setRowHeight(2, (int)dHight);//7582
|
||||
|
||||
ui->tableWidget->m_iScale = m_iScale;
|
||||
ui->tableWidget->m_strUuid = m_strUuid;
|
||||
|
|
@ -667,10 +684,11 @@ void FormWell::setRowHeight(double dHight, QProgressBar *progressBar, int iSplit
|
|||
if(formDraw)
|
||||
{
|
||||
//progressBar->setValue(iBeginValue+ i*iSplitWell); // 更新进度条的值
|
||||
formDraw->m_iY1 = m_iY1;
|
||||
formDraw->m_iY1 = m_iY2 - (iHeightOfScreen/g_dPixelPerCm/100.0 * (double)m_iScale);
|
||||
formDraw->m_iY2 = m_iY2;
|
||||
formDraw->m_iScale = m_iScale;
|
||||
formDraw->setRowHeight(dHight, progressBar, iSplitWell);
|
||||
//formDraw->setRowHeight(dHight, progressBar, iSplitWell);
|
||||
formDraw->setRowHeight(iHeightOfScreen, progressBar, iSplitWell);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -876,3 +894,20 @@ void FormWell::resizeWindow()
|
|||
MainWindowCurve *parent = (MainWindowCurve *)m_parent;
|
||||
parent->resizeItem(m_strWellName, tempWidth, tempHight);
|
||||
}
|
||||
|
||||
//获取头2行的宽高,方便输出图
|
||||
void FormWell::getTableSize_Head(int &iHight)
|
||||
{
|
||||
//获取可视视图大小 tableWidget
|
||||
iHight = 0;
|
||||
|
||||
for(int i=0; i<2; i++)
|
||||
{
|
||||
//高度
|
||||
iHight += ui->tableWidget->rowHeight(i);
|
||||
}
|
||||
if(iHight == 0)
|
||||
{
|
||||
iHight = 100 + 300;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -48,6 +48,10 @@ public:
|
|||
|
||||
protected:
|
||||
void paintEvent(QPaintEvent *event);
|
||||
//
|
||||
void resizeEvent(QResizeEvent *event);
|
||||
//删除一列道后
|
||||
void resizeWindow();
|
||||
private:
|
||||
Ui::FormWell *ui;
|
||||
|
||||
|
|
@ -82,6 +86,7 @@ public:
|
|||
|
||||
//获取当前井的所有道名称
|
||||
QStringList getTrackNameList();
|
||||
void getTableSize_Head(int &iHight);
|
||||
|
||||
public slots:
|
||||
//void onTableColumnsInserted(const QModelIndex &parent, int first, int last);
|
||||
|
|
@ -104,7 +109,6 @@ public slots:
|
|||
void slotContextMenu(QPoint pos);
|
||||
void slotDeleteSelectTrack();
|
||||
|
||||
void resizeWindow();
|
||||
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -98,6 +98,13 @@ MainWindowCurve::MainWindowCurve(QWidget *parent) :
|
|||
// 连接信号和槽
|
||||
connect(ui->tableWidget_2, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(slotContextMenu(QPoint)));
|
||||
|
||||
//隐藏滚动条
|
||||
ui->tableWidget_2->verticalScrollBar()->setDisabled(true); // 禁用滚动
|
||||
ui->tableWidget_2->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); //隐藏垂直滚动条
|
||||
//自定义滚动条
|
||||
ui->verticalScrollBar->setRange(-m_iY2, -m_iY1);
|
||||
connect(ui->verticalScrollBar, SIGNAL(valueChanged(int)), this, SLOT(vertScrollBarChanged(int)));
|
||||
|
||||
connect(this, SIGNAL(sig_NewTrackChangeWidth(QString, double)), this, SLOT(s_NewTrackChangeWidth(QString, double)));
|
||||
//connect(this, SIGNAL(sig_NewWell(QString, QString)), this, SLOT(s_NewWell(QString, QString)));
|
||||
|
||||
|
|
@ -176,6 +183,10 @@ MainWindowCurve::~MainWindowCurve()
|
|||
delete ui;
|
||||
}
|
||||
|
||||
void MainWindowCurve::resizeEvent(QResizeEvent *event)
|
||||
{
|
||||
}
|
||||
|
||||
QToolBar * MainWindowCurve::getPluginToolBar()
|
||||
{
|
||||
return ui->toolBar_plugin;
|
||||
|
|
@ -185,15 +196,23 @@ QToolBar * MainWindowCurve::getPluginToolBar()
|
|||
void MainWindowCurve::s_mouseWheel(QWheelEvent *event)
|
||||
{
|
||||
if (event->angleDelta().y() > 0) {
|
||||
ui->tableWidget_2->verticalScrollBar()->triggerAction(QAbstractSlider::SliderSingleStepSub); // 向下滚动
|
||||
ui->verticalScrollBar->triggerAction(QAbstractSlider::SliderSingleStepSub); // 向下滚动
|
||||
} else {
|
||||
ui->tableWidget_2->verticalScrollBar()->triggerAction(QAbstractSlider::SliderSingleStepAdd); // 向上滚动
|
||||
ui->verticalScrollBar->triggerAction(QAbstractSlider::SliderSingleStepAdd); // 向上滚动
|
||||
}
|
||||
|
||||
//verticalScrollBar() horizontalScrollBar()
|
||||
//event->accept(); // 确保事件被处理
|
||||
}
|
||||
|
||||
//自定义滚动条
|
||||
void MainWindowCurve::vertScrollBarChanged(int value)
|
||||
{
|
||||
//通知界面缩放
|
||||
emit CallManage::getInstance()->sig_vertScrollBarChanged(m_strUuid, value);
|
||||
|
||||
}
|
||||
|
||||
//初始化工具栏
|
||||
void MainWindowCurve::initMainToolBar()
|
||||
{
|
||||
|
|
@ -2366,92 +2385,8 @@ void MainWindowCurve::s_SaveAsPicture()
|
|||
return;
|
||||
}
|
||||
|
||||
|
||||
//获取可视视图大小 tableWidget_2
|
||||
int iHight = 0;
|
||||
int iWidth = 0;
|
||||
for(int i=0; i<ui->tableWidget_2->rowCount(); i++)
|
||||
{
|
||||
//高度
|
||||
iHight += ui->tableWidget_2->rowHeight(i);
|
||||
}
|
||||
//ui->tableWidget_2->setRowHeight(1, iHight+200);
|
||||
//iHight += 3000;
|
||||
|
||||
for(int j=0; j<ui->tableWidget_2->columnCount(); j++)
|
||||
{
|
||||
//宽度
|
||||
iWidth += ui->tableWidget_2->columnWidth(j);
|
||||
}
|
||||
|
||||
//
|
||||
bool bVisible = m_dock1->isVisible();
|
||||
//第一次显示,判断是否从json加载
|
||||
if(m_bHeadLoadJson)
|
||||
{
|
||||
m_bHeadLoadJson = false;
|
||||
|
||||
QString strHeadOrTail = ""; //Head代表图头, Tail代表成果表
|
||||
//展示所有图头
|
||||
strHeadOrTail = "Head"; //Head代表图头, Tail代表成果表
|
||||
m_formMultiHeads->DisplayHeads(m_headsArray, strHeadOrTail);
|
||||
//展示所有成果表
|
||||
strHeadOrTail = "Tail"; //Head代表图头, Tail代表成果表
|
||||
m_formMultiTails->DisplayHeads(m_tailsArray, strHeadOrTail);
|
||||
}
|
||||
m_dock1->show();
|
||||
m_dock2->show();
|
||||
|
||||
//-----------------------------
|
||||
//头
|
||||
int iWidth_Head, iHight_Head;
|
||||
m_formMultiHeads->getTableSize(iWidth_Head, iHight_Head);
|
||||
QRect geoRect_FormHead = m_dock1->geometry();
|
||||
m_dock1->setGeometry(geoRect_FormHead.x(), geoRect_FormHead.y(), iWidth_Head, iHight_Head);
|
||||
|
||||
//中间
|
||||
// 获取客户区几何信息(不含边框)
|
||||
QRect geoRect = ui->centralwidget->geometry();
|
||||
qDebug() << "Geometry:" << geoRect.x() << "," << geoRect.y()
|
||||
<< "w:" << geoRect.width() << "h:" << geoRect.height();
|
||||
//指标体系图
|
||||
ui->centralwidget->setGeometry(geoRect.x(), geoRect.y(), iWidth, iHight);
|
||||
|
||||
//尾
|
||||
int iWidth_Tail, iHight_Tail;
|
||||
m_formMultiTails->getTableSize(iWidth_Tail, iHight_Tail);
|
||||
QRect geoRect_Tail = m_dock2->geometry();
|
||||
m_dock2->setGeometry(geoRect_Tail.x(), iHight+iHight_Head+40, iWidth_Tail, iHight_Tail);
|
||||
//-----------------------------
|
||||
|
||||
//QPixmap pPixmap = ui->centralwidget->grab(QRect(0, 0, ui->centralwidget->width(), ui->centralwidget->height()));
|
||||
int iMaxWidth = iWidth;
|
||||
if(iWidth_Head>iWidth_Tail)
|
||||
{
|
||||
if(iWidth_Head>iWidth)
|
||||
{
|
||||
iMaxWidth = iWidth_Head;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(iWidth_Tail>iWidth)
|
||||
{
|
||||
iMaxWidth = iWidth_Tail;
|
||||
}
|
||||
}
|
||||
QPixmap pPixmap = this->grab(QRect(geoRect_FormHead.x(), geoRect_FormHead.y(), iMaxWidth, iHight+iHight_Head+iHight_Tail+40));
|
||||
pPixmap.save(pngName);
|
||||
|
||||
//恢复窗口
|
||||
m_dock1->setGeometry(geoRect_FormHead.x(), geoRect_FormHead.y(), geoRect_FormHead.width(), geoRect_FormHead.height());
|
||||
ui->centralwidget->setGeometry(geoRect.x(), geoRect.y(), geoRect.width(), geoRect.height());
|
||||
m_dock2->setGeometry(geoRect_Tail.x(), geoRect_Tail.y(), geoRect_Tail.width(), geoRect_Tail.height());
|
||||
if(!bVisible)
|
||||
{
|
||||
m_dock1->hide();
|
||||
m_dock2->hide();
|
||||
}
|
||||
QPrinter aa;
|
||||
_slotExport(aa, 2, pngName, strTmpName);
|
||||
}
|
||||
|
||||
//导出PDF
|
||||
|
|
@ -2479,22 +2414,68 @@ void MainWindowCurve::s_SaveAsPdf()
|
|||
return;
|
||||
}
|
||||
|
||||
|
||||
QPrinter printer;//(QPrinter::ScreenResolution);
|
||||
printer.setOrientation(QPrinter::Portrait);
|
||||
printer.setResolution(200);
|
||||
printer.setPaperSize(QPrinter::Custom);//自定义大小
|
||||
printer.setOutputFormat(QPrinter::PdfFormat);
|
||||
printer.setPageMargins(0.0, 0.0, 0.0, 0.0, QPrinter::Point);
|
||||
printer.setOutputFileName(pngName);
|
||||
|
||||
_slotExport(printer,0, pngName, strTmpName);
|
||||
}
|
||||
|
||||
//isbmp=0 to printer or pdf
|
||||
// =1 to printer by use image
|
||||
// =2 to tif by created this soft
|
||||
// =3 to tif by qt qimage
|
||||
// =4 to svg
|
||||
void MainWindowCurve::_slotExport(QPrinter &printer, int IsBmp, QString pngName, QString strTmpName)
|
||||
{
|
||||
printer.setPageMargins(0.0,0.0,0.0,0.0,QPrinter::DevicePixel);
|
||||
printer.setFullPage(true);
|
||||
|
||||
//临时存储图片
|
||||
QString tmpPath = GetLogdataPath();
|
||||
tmpPath = tmpPath + g_prjname;
|
||||
if(strTmpName != "")
|
||||
{
|
||||
tmpPath=tmpPath + "/" + strTmpName +"/";
|
||||
tmpPath += QDateTime::currentDateTime().toString("yyyyMMddHHmmsszzz");
|
||||
//
|
||||
QDir dir;
|
||||
if (!dir.exists(tmpPath)) { // 如果目录不存在,则创建它。
|
||||
if (!dir.mkpath(tmpPath)) { // mkpath 尝试创建所有必需的中间目录。
|
||||
qDebug() << "Failed to create directory:" << tmpPath;
|
||||
} else {
|
||||
qDebug() << "Directory created:" << tmpPath;
|
||||
}
|
||||
}
|
||||
tmpPath += "/";
|
||||
}
|
||||
|
||||
//获取可视视图大小 tableWidget_2
|
||||
int iHight = 0;
|
||||
int iWidth = 0;
|
||||
//高度
|
||||
for(int i=0; i<ui->tableWidget_2->rowCount(); i++)
|
||||
{
|
||||
//高度
|
||||
|
||||
iHight += ui->tableWidget_2->rowHeight(i);
|
||||
}
|
||||
//ui->tableWidget_2->setRowHeight(1, iHight+200);
|
||||
//iHight += 3000;
|
||||
|
||||
iHight += 9 + (ui->tableWidget_2->rowCount()+1);//上margin + 边框n+1
|
||||
//宽度
|
||||
for(int j=0; j<ui->tableWidget_2->columnCount(); j++)
|
||||
{
|
||||
//宽度
|
||||
|
||||
iWidth += ui->tableWidget_2->columnWidth(j);
|
||||
}
|
||||
iWidth += 9*2 + (ui->tableWidget_2->columnCount()+1) +40;//左右margin + 边框n+1
|
||||
if(iWidth < ui->tableWidget_2->width())
|
||||
{
|
||||
iWidth = ui->tableWidget_2->width();
|
||||
}
|
||||
|
||||
//
|
||||
bool bVisible = m_dock1->isVisible();
|
||||
|
|
@ -2511,85 +2492,233 @@ void MainWindowCurve::s_SaveAsPdf()
|
|||
strHeadOrTail = "Tail"; //Head代表图头, Tail代表成果表
|
||||
m_formMultiTails->DisplayHeads(m_tailsArray, strHeadOrTail);
|
||||
}
|
||||
m_dock1->show();
|
||||
m_dock2->show();
|
||||
|
||||
//-----------------------------
|
||||
//头
|
||||
//计算最大宽度
|
||||
int iMaxWidth = iWidth;
|
||||
QRect geoRect_Head = m_dock1->geometry();
|
||||
QRect geoRect_Tail = m_dock2->geometry();
|
||||
//判断头宽
|
||||
int iWidth_Head, iHight_Head;
|
||||
m_formMultiHeads->getTableSize(iWidth_Head, iHight_Head);
|
||||
QRect geoRect_FormHead = m_dock1->geometry();
|
||||
m_dock1->setGeometry(geoRect_FormHead.x(), geoRect_FormHead.y(), iWidth_Head, iHight_Head);
|
||||
|
||||
//中间
|
||||
// 获取客户区几何信息(不含边框)
|
||||
QRect geoRect = ui->centralwidget->geometry();
|
||||
qDebug() << "Geometry:" << geoRect.x() << "," << geoRect.y()
|
||||
<< "w:" << geoRect.width() << "h:" << geoRect.height();
|
||||
//指标体系图
|
||||
ui->centralwidget->setGeometry(geoRect.x(), geoRect.y(), iWidth, iHight);
|
||||
|
||||
//尾
|
||||
int iWidth_Tail, iHight_Tail;
|
||||
m_formMultiTails->getTableSize(iWidth_Tail, iHight_Tail);
|
||||
QRect geoRect_Tail = m_dock2->geometry();
|
||||
m_dock2->setGeometry(geoRect_Tail.x(), iHight+iHight_Head+40, iWidth_Tail, iHight_Tail);
|
||||
//-----------------------------
|
||||
|
||||
//QPixmap pPixmap = ui->centralwidget->grab(QRect(0, 0, ui->centralwidget->width(), ui->centralwidget->height()));
|
||||
int iMaxWidth = iWidth;
|
||||
if(iWidth_Head>iWidth_Tail)
|
||||
if(iWidth_Head==0 || iHight_Head==0)
|
||||
{
|
||||
if(iWidth_Head>iWidth)
|
||||
{
|
||||
iMaxWidth = iWidth_Head;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(iWidth_Tail>iWidth)
|
||||
if(geoRect_Head.width()>iMaxWidth)
|
||||
{
|
||||
iMaxWidth = iWidth_Tail;
|
||||
iMaxWidth = geoRect_Head.width();
|
||||
}
|
||||
}
|
||||
QPixmap pPixmap = this->grab(QRect(geoRect_FormHead.x(), geoRect_FormHead.y(), iMaxWidth, iHight+iHight_Head+iHight_Tail+40));
|
||||
//pPixmap.save(pngName);
|
||||
//判断尾宽
|
||||
int iWidth_Tail, iHight_Tail;
|
||||
m_formMultiTails->getTableSize(iWidth_Tail, iHight_Tail);
|
||||
if(iWidth_Tail==0 || iHight_Tail==0)
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
if(geoRect_Tail.width()>iMaxWidth)
|
||||
{
|
||||
iMaxWidth = geoRect_Tail.width();
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------
|
||||
//头
|
||||
ui->centralwidget->hide();
|
||||
m_dock2->hide();
|
||||
m_dock1->show();
|
||||
//
|
||||
geoRect_Head = m_dock1->geometry();
|
||||
m_dock1->setGeometry(geoRect_Head.x(), geoRect_Head.y(), iMaxWidth, iHight_Head);
|
||||
QPixmap pPixmap_Head = this->grab(QRect(geoRect_Head.x(), geoRect_Head.y(), iMaxWidth, iHight_Head));
|
||||
//保存,方便查看
|
||||
pPixmap_Head.save(tmpPath + "pPixmap_Head.png");
|
||||
|
||||
//尾
|
||||
m_dock1->hide();
|
||||
ui->centralwidget->hide();
|
||||
m_dock2->show();
|
||||
geoRect_Tail = m_dock2->geometry();
|
||||
m_dock2->setGeometry(geoRect_Tail.x(), geoRect_Tail.y(), iMaxWidth, iHight_Tail);
|
||||
QPixmap pPixmap_Tail = this->grab(QRect(geoRect_Tail.x(), geoRect_Tail.y(), iMaxWidth, iHight_Tail));
|
||||
//保存,方便查看
|
||||
pPixmap_Tail.save(tmpPath + "pPixmap_Tail.png");
|
||||
|
||||
//中间
|
||||
m_dock1->hide();
|
||||
m_dock2->hide();
|
||||
ui->centralwidget->show();
|
||||
|
||||
// 获取客户区几何信息(不含边框)centralwidget
|
||||
QRect geoRect = ui->centralwidget->geometry();
|
||||
ui->centralwidget->setGeometry(geoRect.x(), geoRect.y(), iWidth, iHight+40);
|
||||
|
||||
//获取井well前2行的高度
|
||||
int iTableSize_Head = 0;
|
||||
getTableSize_Head(iTableSize_Head);
|
||||
//
|
||||
int iTableWellTrack_height = ui->tableWidget_2->rowHeight(0) + (9+4) + iTableSize_Head +1;
|
||||
// 屏幕高度
|
||||
int iHeightOfScreen = 30000;//QApplication::desktop()->height();
|
||||
double dScrollHeight = iHeightOfScreen/g_dPixelPerCm/100.0 * (double)m_iScale;
|
||||
//图片高度
|
||||
int iTotalSize_Height = iHight_Head+iHight_Tail;
|
||||
double dDeep = -m_iY1 - (-m_iY2);
|
||||
int iNum = dDeep/dScrollHeight;
|
||||
double dLastHeight = iHeightOfScreen;
|
||||
if(dDeep - (iNum * dScrollHeight) > 0)
|
||||
{
|
||||
dLastHeight = (m_iY2-m_iY1) *100.0/(double)m_iScale * g_dPixelPerCm - iNum*iHeightOfScreen;
|
||||
iNum++;
|
||||
}
|
||||
iTotalSize_Height += iTableWellTrack_height*2 + (iNum-1)*iHeightOfScreen + (int)dLastHeight;//双道头
|
||||
|
||||
//开始
|
||||
float sx=1;
|
||||
float sy=1;
|
||||
QPainter painter;
|
||||
QImage img;
|
||||
QSvgGenerator generator;
|
||||
if(IsBmp==0)
|
||||
{
|
||||
//pdf
|
||||
printer.setPaperSize(QSizeF(iMaxWidth, iTotalSize_Height),QPrinter::DevicePixel);
|
||||
painter.begin(&printer);
|
||||
}
|
||||
else if(IsBmp==4)
|
||||
{
|
||||
//svg
|
||||
generator.setFileName(pngName); // 设置输出SVG文件的路径和名称
|
||||
generator.setSize(QSize(iMaxWidth, iTotalSize_Height)); // 设置SVG的尺寸,这里使用QPixmap的尺寸
|
||||
generator.setViewBox(QRect(0, 0, iMaxWidth, iTotalSize_Height)); // 设置视图框,可选,根据需要设置
|
||||
painter.begin(&generator);
|
||||
}
|
||||
else
|
||||
{
|
||||
img = QImage(iMaxWidth, iTotalSize_Height, QImage::Format_RGB32);
|
||||
// painter.setViewport(0, 0, iMaxWidth, iTotalSize_Height);
|
||||
// painter.setWindow(img.rect()); //设置QPainter窗口大小为图像的大小
|
||||
// painter.begin(&img);
|
||||
|
||||
// generator.setFileName(pngName+".svg"); // 设置输出SVG文件的路径和名称
|
||||
// generator.setSize(QSize(iMaxWidth, iTotalSize_Height)); // 设置SVG的尺寸,这里使用QPixmap的尺寸
|
||||
// generator.setViewBox(QRect(0, 0, iMaxWidth, iTotalSize_Height)); // 设置视图框,可选,根据需要设置
|
||||
// painter.begin(&generator);
|
||||
}
|
||||
|
||||
painter.setRenderHint(QPainter::Antialiasing);
|
||||
painter.scale(sx,sy);
|
||||
//头
|
||||
if(IsBmp == 0 || IsBmp == 4)
|
||||
{
|
||||
//pdf,svg
|
||||
painter.save();
|
||||
painter.drawPixmap(0, 0, pPixmap_Head);
|
||||
painter.restore();
|
||||
}
|
||||
else
|
||||
{
|
||||
//img.copy(pPixmap_Head, 0, 0);
|
||||
}
|
||||
//中间
|
||||
ui->verticalScrollBar->hide(); //隐藏右侧滚动条
|
||||
ui->verticalScrollBar->setValue(-m_iY2);//设置右侧滚动条
|
||||
QPixmap pPixmap_wellTrackInfo = this->grab(QRect(geoRect.x(), geoRect.y(), iMaxWidth, iTableWellTrack_height));
|
||||
//保存,方便查看
|
||||
pPixmap_wellTrackInfo.save(tmpPath + "0.png");
|
||||
if(IsBmp == 0 || IsBmp == 4)
|
||||
{
|
||||
//pdf,svg
|
||||
painter.save();
|
||||
painter.drawPixmap(0, iHight_Head, pPixmap_wellTrackInfo);
|
||||
painter.restore();
|
||||
}
|
||||
|
||||
int iLoop = 0;
|
||||
for(iLoop = 0; iLoop<iNum; iLoop++)
|
||||
{
|
||||
double newValue = -m_iY2 + dScrollHeight*iLoop;
|
||||
if(newValue < -m_iY1)
|
||||
{
|
||||
ui->verticalScrollBar->setValue(newValue);//设置右侧滚动条
|
||||
if(iLoop==iNum-1)
|
||||
{
|
||||
//最后1页
|
||||
QPixmap pPixmap = this->grab(QRect(geoRect.x(), geoRect.y()+iTableWellTrack_height, iMaxWidth, dLastHeight-2));
|
||||
//保存,方便查看
|
||||
pPixmap.save(tmpPath + QString::number(iLoop+1) + ".png");
|
||||
if(IsBmp == 0 || IsBmp == 4)
|
||||
{
|
||||
//pdf,svg
|
||||
painter.save();
|
||||
painter.drawPixmap(0, iHight_Head + iTableWellTrack_height + (iHeightOfScreen-2)*iLoop, pPixmap);
|
||||
painter.restore();
|
||||
}
|
||||
}
|
||||
else{
|
||||
QPixmap pPixmap = this->grab(QRect(geoRect.x(), geoRect.y()+iTableWellTrack_height, iMaxWidth, iHeightOfScreen-2));
|
||||
//保存,方便查看
|
||||
pPixmap.save(tmpPath + QString::number(iLoop+1) + ".png");
|
||||
if(IsBmp == 0 || IsBmp == 4)
|
||||
{
|
||||
//pdf,svg
|
||||
painter.save();
|
||||
painter.drawPixmap(0, iHight_Head + iTableWellTrack_height + (iHeightOfScreen-2)*iLoop, pPixmap);
|
||||
painter.restore();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if(IsBmp == 0 || IsBmp == 4)
|
||||
{
|
||||
//pdf,svg
|
||||
//尾
|
||||
painter.save();
|
||||
painter.drawPixmap(0, iHight_Head + iTableWellTrack_height + (iHeightOfScreen-2)*(iNum-1) + (dLastHeight-2), pPixmap_wellTrackInfo);
|
||||
painter.restore();
|
||||
//双道头
|
||||
painter.save();
|
||||
painter.drawPixmap(0, iHight_Head + iTableWellTrack_height*2 + (iHeightOfScreen-2)*(iNum-1) + (dLastHeight-2), pPixmap_Tail);
|
||||
painter.restore();
|
||||
//结束
|
||||
painter.end();
|
||||
}
|
||||
|
||||
//恢复窗口
|
||||
m_dock1->setGeometry(geoRect_FormHead.x(), geoRect_FormHead.y(), geoRect_FormHead.width(), geoRect_FormHead.height());
|
||||
ui->centralwidget->setGeometry(geoRect.x(), geoRect.y(), geoRect.width(), geoRect.height());
|
||||
m_dock1->setGeometry(geoRect_Head.x(), geoRect_Head.y(), geoRect_Head.width(), geoRect_Head.height());
|
||||
m_dock2->setGeometry(geoRect_Tail.x(), geoRect_Tail.y(), geoRect_Tail.width(), geoRect_Tail.height());
|
||||
if(!bVisible)
|
||||
//if(!bVisible)//为了保证centralwidget还原位置与获取时一致,强制隐藏,因为获取时也是隐藏
|
||||
{
|
||||
m_dock1->hide();
|
||||
m_dock2->hide();
|
||||
}
|
||||
//中间
|
||||
ui->centralwidget->show();
|
||||
ui->verticalScrollBar->show(); //恢复右侧滚动条
|
||||
ui->centralwidget->setGeometry(geoRect.x(), geoRect.y(), geoRect.width(), geoRect.height());
|
||||
|
||||
//
|
||||
QPrinter printer;//(QPrinter::ScreenResolution);
|
||||
printer.setOrientation(QPrinter::Portrait);
|
||||
printer.setResolution(200);
|
||||
printer.setPaperSize(QPrinter::Custom);//自定义大小
|
||||
printer.setOutputFormat(QPrinter::PdfFormat);
|
||||
printer.setPageMargins(0.0, 0.0, 0.0, 0.0, QPrinter::Point);
|
||||
printer.setOutputFileName(pngName);
|
||||
if(IsBmp == 0 || IsBmp == 4)
|
||||
{
|
||||
//pdf,svg
|
||||
}
|
||||
else
|
||||
{
|
||||
if(!pngName.isEmpty())
|
||||
{
|
||||
//img.save(pngName);
|
||||
}
|
||||
// QImage image(iMaxWidth, iTotalSize_Height, QImage::Format_RGB32);
|
||||
// QPainter painterImg(&image);
|
||||
// QSvgRenderer renderer;
|
||||
// renderer.load(pngName+".svg");
|
||||
// renderer.render(&painterImg);
|
||||
// // 保存为PNG格式(可以直接使用image的save方法)
|
||||
// image.save(pngName);
|
||||
}
|
||||
|
||||
printer.setPageMargins(0.0,0.0,0.0,0.0,QPrinter::DevicePixel);
|
||||
printer.setFullPage(true);
|
||||
|
||||
printer.setOrientation(QPrinter::Portrait);
|
||||
printer.setPaperSize(QPrinter::Custom);
|
||||
printer.setPaperSize(QSizeF(iMaxWidth, iHight+iHight_Head+iHight_Tail+40),QPrinter::DevicePixel);
|
||||
|
||||
//
|
||||
float sx=1;
|
||||
float sy=1;
|
||||
QPainter painter;
|
||||
painter.begin(&printer);
|
||||
painter.setRenderHint(QPainter::Antialiasing);
|
||||
painter.scale(sx,sy);
|
||||
painter.drawPixmap(0, 0, pPixmap);
|
||||
painter.end();
|
||||
QMessageBox::information(NULL,"提示","图件输出完成!",QMessageBox::Ok);
|
||||
}
|
||||
|
||||
//导出长图
|
||||
|
|
@ -2616,116 +2745,9 @@ void MainWindowCurve::s_SaveAsSvg()
|
|||
if(pngName=="") {
|
||||
return;
|
||||
}
|
||||
//获取可视视图大小 tableWidget_2
|
||||
int iHight = 0;
|
||||
int iWidth = 0;
|
||||
for(int i=0; i<ui->tableWidget_2->rowCount(); i++)
|
||||
{
|
||||
//高度
|
||||
iHight += ui->tableWidget_2->rowHeight(i);
|
||||
}
|
||||
//ui->tableWidget_2->setRowHeight(1, iHight+200);
|
||||
//iHight += 3000;
|
||||
|
||||
for(int j=0; j<ui->tableWidget_2->columnCount(); j++)
|
||||
{
|
||||
//宽度
|
||||
iWidth += ui->tableWidget_2->columnWidth(j);
|
||||
}
|
||||
|
||||
//
|
||||
bool bVisible = m_dock1->isVisible();
|
||||
//第一次显示,判断是否从json加载
|
||||
if(m_bHeadLoadJson)
|
||||
{
|
||||
m_bHeadLoadJson = false;
|
||||
|
||||
QString strHeadOrTail = ""; //Head代表图头, Tail代表成果表
|
||||
//展示所有图头
|
||||
strHeadOrTail = "Head"; //Head代表图头, Tail代表成果表
|
||||
m_formMultiHeads->DisplayHeads(m_headsArray, strHeadOrTail);
|
||||
//展示所有成果表
|
||||
strHeadOrTail = "Tail"; //Head代表图头, Tail代表成果表
|
||||
m_formMultiTails->DisplayHeads(m_tailsArray, strHeadOrTail);
|
||||
}
|
||||
m_dock1->show();
|
||||
m_dock2->show();
|
||||
|
||||
//-----------------------------
|
||||
//头
|
||||
int iWidth_Head, iHight_Head;
|
||||
m_formMultiHeads->getTableSize(iWidth_Head, iHight_Head);
|
||||
QRect geoRect_FormHead = m_dock1->geometry();
|
||||
m_dock1->setGeometry(geoRect_FormHead.x(), geoRect_FormHead.y(), iWidth_Head, iHight_Head);
|
||||
|
||||
//中间
|
||||
// 获取客户区几何信息(不含边框)
|
||||
QRect geoRect = ui->centralwidget->geometry();
|
||||
qDebug() << "Geometry:" << geoRect.x() << "," << geoRect.y()
|
||||
<< "w:" << geoRect.width() << "h:" << geoRect.height();
|
||||
//指标体系图
|
||||
ui->centralwidget->setGeometry(geoRect.x(), geoRect.y(), iWidth, iHight);
|
||||
|
||||
//尾
|
||||
int iWidth_Tail, iHight_Tail;
|
||||
m_formMultiTails->getTableSize(iWidth_Tail, iHight_Tail);
|
||||
QRect geoRect_Tail = m_dock2->geometry();
|
||||
m_dock2->setGeometry(geoRect_Tail.x(), iHight+iHight_Head+40, iWidth_Tail, iHight_Tail);
|
||||
//-----------------------------
|
||||
|
||||
//QPixmap pPixmap = ui->centralwidget->grab(QRect(0, 0, ui->centralwidget->width(), ui->centralwidget->height()));
|
||||
int iMaxWidth = iWidth;
|
||||
if(iWidth_Head>iWidth_Tail)
|
||||
{
|
||||
if(iWidth_Head>iWidth)
|
||||
{
|
||||
iMaxWidth = iWidth_Head;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(iWidth_Tail>iWidth)
|
||||
{
|
||||
iMaxWidth = iWidth_Tail;
|
||||
}
|
||||
}
|
||||
QPixmap pPixmap = this->grab(QRect(geoRect_FormHead.x(), geoRect_FormHead.y(), iMaxWidth, iHight+iHight_Head+iHight_Tail+40));
|
||||
//pPixmap.save(pngName);
|
||||
|
||||
//恢复窗口
|
||||
m_dock1->setGeometry(geoRect_FormHead.x(), geoRect_FormHead.y(), geoRect_FormHead.width(), geoRect_FormHead.height());
|
||||
ui->centralwidget->setGeometry(geoRect.x(), geoRect.y(), geoRect.width(), geoRect.height());
|
||||
m_dock2->setGeometry(geoRect_Tail.x(), geoRect_Tail.y(), geoRect_Tail.width(), geoRect_Tail.height());
|
||||
if(!bVisible)
|
||||
{
|
||||
m_dock1->hide();
|
||||
m_dock2->hide();
|
||||
}
|
||||
|
||||
//
|
||||
// QString strTmpPng = pngName;
|
||||
// int indTmp=strTmpPng.lastIndexOf(".");
|
||||
// if(indTmp>=0) strTmpPng=strTmpPng.left(indTmp) + "_tmp.PNG";
|
||||
// pPixmap.save(strTmpPng);
|
||||
// QImage image;
|
||||
// image.load(strTmpPng);
|
||||
|
||||
QSvgGenerator generator;
|
||||
generator.setFileName(pngName); // 设置输出SVG文件的路径和名称
|
||||
generator.setSize(QSize(iMaxWidth, iHight+iHight_Head+iHight_Tail+40)); // 设置SVG的尺寸,这里使用QPixmap的尺寸
|
||||
generator.setViewBox(QRect(0, 0, iMaxWidth, iHight+iHight_Head+iHight_Tail+40)); // 设置视图框,可选,根据需要设置
|
||||
|
||||
//
|
||||
float sx=1;
|
||||
float sy=1;
|
||||
QPainter painter;
|
||||
painter.begin(&generator);
|
||||
painter.setRenderHint(QPainter::Antialiasing);
|
||||
painter.scale(sx,sy);
|
||||
painter.drawPixmap(0, 0, pPixmap); // 绘制QPixmap到SVG中
|
||||
//painter.drawImage(0, 0, image);
|
||||
painter.end(); // 结束绘制过程
|
||||
|
||||
QPrinter aa;
|
||||
_slotExport(aa, 4, pngName, strTmpName);
|
||||
}
|
||||
|
||||
//void MainWindowCurve::s_Open(QString fileFull)
|
||||
|
|
@ -2931,7 +2953,16 @@ void MainWindowCurve::s_NewWell(QString strWellName, QString strSlfName)
|
|||
|
||||
dHight = dHight+300+100+10;
|
||||
//设置高度
|
||||
ui->tableWidget_2->setRowHeight(i, (int)dHight);//8020
|
||||
//jyl ui->tableWidget_2->setRowHeight(i, (int)dHight);
|
||||
// 屏幕高度
|
||||
int iHeightOfScreen = 30000;//QApplication::desktop()->height();
|
||||
//
|
||||
//获取井well前2行的高度
|
||||
int iTableSize_Head = 100 + 300;
|
||||
//此处还没有生成well,所以不能这样获取
|
||||
//getTableSize_Head(iTableSize_Head);
|
||||
//
|
||||
ui->tableWidget_2->setRowHeight(i, (int)iHeightOfScreen+iTableSize_Head+(3+1));
|
||||
//
|
||||
FormWell *widgetWell = new FormWell(this, strWellName);
|
||||
widgetWell->setBorderFlags(BorderFlags(BottomBorder | LeftBorder | RightBorder));
|
||||
|
|
@ -2940,7 +2971,8 @@ void MainWindowCurve::s_NewWell(QString strWellName, QString strSlfName)
|
|||
widgetWell->m_strUuid = m_strUuid;
|
||||
widgetWell->m_strSlfName = strSlfName;
|
||||
widgetWell->m_iScale = m_iScale;
|
||||
ui->tableWidget_2->setCellWidget(i, columnCount, widgetWell);
|
||||
//
|
||||
ui->tableWidget_2->setCellWidget(i, columnCount, widgetWell);//默认用widgetWell填充满
|
||||
m_mapFWell.insert(strWellName, widgetWell);
|
||||
//
|
||||
m_listWell.push_back(strWellName);
|
||||
|
|
@ -4027,8 +4059,9 @@ void MainWindowCurve::Open(QString fileFull)
|
|||
file.close();
|
||||
qDebug() << "JSON 模板文件读取成功!";
|
||||
|
||||
//触发更新
|
||||
//QTimer::singleShot(2000, this, SLOT(slot_time()));
|
||||
//重置右侧滚动条
|
||||
ui->verticalScrollBar->setRange(-m_iY2, -m_iY1);
|
||||
ui->verticalScrollBar->setValue(-m_iY2);
|
||||
} else {
|
||||
qWarning() << "JSON 模板文件打开失败:" << file.errorString();
|
||||
}
|
||||
|
|
@ -4158,7 +4191,7 @@ void MainWindowCurve::s_changeScale(QString strUuid, int iNewScale)
|
|||
|
||||
double dHightOne = dHight+300+100+10;
|
||||
//设置高度
|
||||
ui->tableWidget_2->setRowHeight(1, (int)dHightOne);//8020
|
||||
//jyl ui->tableWidget_2->setRowHeight(1, (int)dHightOne);
|
||||
|
||||
//--------------------
|
||||
//
|
||||
|
|
@ -4219,6 +4252,8 @@ void MainWindowCurve::s_changeDepth(QString strUuid, QString strSlfName, QString
|
|||
|
||||
m_iY1 = iY1;
|
||||
m_iY2 = iY2;
|
||||
//自定义滚动条
|
||||
ui->verticalScrollBar->setRange(-m_iY2, -m_iY1);
|
||||
|
||||
double dHight = 0;
|
||||
dHight = (m_iY2-m_iY1)*100.0/(double)m_iScale * g_dPixelPerCm;
|
||||
|
|
@ -4285,7 +4320,7 @@ void MainWindowCurve::s_changeDepth(QString strUuid, QString strSlfName, QString
|
|||
dHightMax = dHightMax*100.0/(double)m_iScale * g_dPixelPerCm;
|
||||
double dHightOne = dHightMax+300+100+10;
|
||||
//设置高度
|
||||
ui->tableWidget_2->setRowHeight(1, (int)dHightOne);//8020
|
||||
//jyl ui->tableWidget_2->setRowHeight(1, (int)dHightOne);
|
||||
|
||||
//
|
||||
progressBar->deleteLater();
|
||||
|
|
@ -4937,3 +4972,23 @@ void MainWindowCurve::slotDeleteSelectWell()
|
|||
//resizeWindow();
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindowCurve::getTableSize_Head(int &iHight)
|
||||
{
|
||||
//获取可视视图大小 well井
|
||||
iHight = 0;
|
||||
|
||||
if( ui->tableWidget_2->cellWidget(1, 0) != nullptr )
|
||||
{
|
||||
auto myWidget = ui->tableWidget_2->cellWidget(1, 0);
|
||||
if(myWidget)
|
||||
{
|
||||
//
|
||||
FormWell *widgetWell = (FormWell*)myWidget;//获得widget
|
||||
if(widgetWell)
|
||||
{
|
||||
widgetWell->getTableSize_Head(iHight);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -40,9 +40,11 @@ private:
|
|||
Ui::MainWindowCurve *ui;
|
||||
|
||||
protected:
|
||||
void resizeEvent(QResizeEvent *event);
|
||||
|
||||
public:
|
||||
void resizeItem(QString strWellName, double tempWidth, double tempHight);
|
||||
void getTableSize_Head(int &iHight);
|
||||
|
||||
public slots:
|
||||
void dragEnterEvent(QDragEnterEvent* event);
|
||||
|
|
@ -52,6 +54,8 @@ public slots:
|
|||
|
||||
//鼠标滚动,通知可视解释窗口
|
||||
void s_mouseWheel(QWheelEvent *event);
|
||||
//自定义滚动条
|
||||
void vertScrollBarChanged(int value);
|
||||
|
||||
public:
|
||||
MainWindowSplitter* m_pParentWin = NULL;
|
||||
|
|
@ -249,6 +253,8 @@ public slots:
|
|||
void s_SaveAsPicture(); //导出长图
|
||||
void s_SaveAsPdf(); //导出PDF
|
||||
void s_SaveAsSvg(); //导出SVG
|
||||
//
|
||||
void _slotExport(QPrinter &printer, int IsBmp, QString pngName, QString strTmpName);
|
||||
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -28,12 +28,19 @@
|
|||
<number>9</number>
|
||||
</property>
|
||||
<item row="1" column="1">
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout" stretch="0,0">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QTableWidget" name="tableWidget_2"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QWidget" name="widget" native="true"/>
|
||||
<widget class="QScrollBar" name="verticalScrollBar">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
|
|
|
|||
|
|
@ -109,6 +109,8 @@ QMyCustomPlot::QMyCustomPlot(QWidget *parent, QString strSlfName, QString strWel
|
|||
connect(yAxis, SIGNAL(rangeChanged(QCPRange)), yAxis2, SLOT(setRange(QCPRange)));
|
||||
// 在自定义类中
|
||||
connect(this, SIGNAL(afterReplot()), this, SLOT(drawCustomElements()));
|
||||
//信号槽刷新
|
||||
connect(this, SIGNAL(sig_replot()), this, SLOT(slot_replot()));
|
||||
|
||||
//关联信号槽
|
||||
//左刻度
|
||||
|
|
@ -118,6 +120,9 @@ QMyCustomPlot::QMyCustomPlot(QWidget *parent, QString strSlfName, QString strWel
|
|||
//刻度类型
|
||||
connect(CallManage::getInstance(), SIGNAL(sig_ChangeScaleType(QString, QString, QString, QString, QString, QString)), this, SLOT(s_ChangeScaleType(QString, QString, QString, QString, QString, QString)));
|
||||
|
||||
//自定义滚动条
|
||||
connect(CallManage::getInstance(), SIGNAL(sig_vertScrollBarChanged(QString, int)), this, SLOT(vertScrollBarChanged(QString, int)));
|
||||
|
||||
//曲线选中,置顶
|
||||
connect(CallManage::getInstance(), SIGNAL(sig_Raise(QString, QString, QString, QString, QString, int, QString)), this, SLOT(s_Raise(QString, QString, QString, QString, QString, int, QString)));
|
||||
//颜色
|
||||
|
|
@ -6719,11 +6724,20 @@ void QMyCustomPlot::s_ChangeFillMode(QString strUuid, QString strSlfName, QStrin
|
|||
graph(0)->setChannelFillGraph( graph_Fill);//this->graph()
|
||||
}
|
||||
//
|
||||
replot();
|
||||
//replot();
|
||||
|
||||
//滚动条修改后,避免刷新后不更新,信号槽刷新
|
||||
emit sig_replot();
|
||||
//update();
|
||||
}
|
||||
}
|
||||
|
||||
void QMyCustomPlot::slot_replot()
|
||||
{
|
||||
this->replot();
|
||||
raise();
|
||||
}
|
||||
|
||||
//void QMyCustomPlot::mouseMoveEvent(QMouseEvent *event)
|
||||
//{
|
||||
// // 当前鼠标位置(像素坐标)
|
||||
|
|
@ -11156,3 +11170,39 @@ void QMyCustomPlot::addQCPItemLine(QMyCustomPlot *widget, float cx, float cy, co
|
|||
pLine->end->setCoords(cx,cy);
|
||||
pLine->setPoints(myPolygon);
|
||||
}
|
||||
|
||||
//自定义滚动条
|
||||
void QMyCustomPlot::vertScrollBarChanged(QString strUuid, int value)
|
||||
{
|
||||
if(m_strUuid==strUuid)
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
//
|
||||
FormInfo* pInfo = m_formTrack->getFormInfoByParameters(m_strUuid, m_strWellName, m_strTrackName, m_strLineName);
|
||||
if (pInfo == NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
QString strType = pInfo->m_strType;
|
||||
|
||||
if(m_bX2Y)
|
||||
{
|
||||
if (qAbs(xAxis->range().center()-value) > 0.01) // if user is dragging plot, we don't want to replot twice
|
||||
{
|
||||
xAxis->setRange(-value, xAxis->range().size(), Qt::AlignRight);
|
||||
replot();
|
||||
}
|
||||
}
|
||||
else{
|
||||
if (qAbs(this->yAxis->range().center()+value) > 0.01) // if user is dragging plot, we don't want to replot twice
|
||||
{
|
||||
this->yAxis->setRange(-value, this->yAxis->range().size(), Qt::AlignRight);
|
||||
this->replot();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -346,8 +346,15 @@ public:
|
|||
//检查套管组件名称,是否需要更新套管图形
|
||||
bool checkTubingName(QString m_Result);
|
||||
|
||||
signals:
|
||||
//信号槽刷新
|
||||
void sig_replot();
|
||||
public slots:
|
||||
void slot_time();
|
||||
//自定义滚动条
|
||||
void vertScrollBarChanged(QString strUuid, int value);
|
||||
//信号槽刷新
|
||||
void slot_replot();
|
||||
|
||||
public:
|
||||
void init(QString strName, QVector<double> x, QVector<double> y);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user