曲线支持黑白图

This commit is contained in:
jiayulong 2026-05-20 17:40:23 +08:00
parent 4aed169d4a
commit c7adedde28
6 changed files with 90 additions and 7 deletions

View File

@ -3723,8 +3723,8 @@ void QCPDataContainer<DataType>::preallocateGrow(int minimumPreallocSize)
int newPreallocSize = minimumPreallocSize;
//jyl
//newPreallocSize += (1u << qBound(4, mPreallocIteration + 4, 15)) - 12; // do 4 up to 32768-12 preallocation, doubling in each intermediate iteration
newPreallocSize += (1u << qBound(4, mPreallocIteration + 4, 23)) - 12; // do 4 up to 32768-12 preallocation, doubling in each intermediate iteration
newPreallocSize += (1u << qBound(4, mPreallocIteration + 4, 15)) - 12; // do 4 up to 32768-12 preallocation, doubling in each intermediate iteration
//newPreallocSize += (1u << qBound(4, mPreallocIteration + 4, 23)) - 12; // do 4 up to 32768-12 preallocation, doubling in each intermediate iteration
++mPreallocIteration;
int sizeDifference = newPreallocSize - mPreallocSize;

View File

@ -84,6 +84,8 @@ FormInfo::FormInfo(QWidget *parent, QString strSlfName, QString strWellName, QSt
//修改曲线选择状态 iSelect=0未知1标准曲线2主曲线3从曲线
connect(CallManage::getInstance(), SIGNAL(sig_ChangeLineStatus(QString, QString, QString, QString, QString, int, bool)), this, SLOT(s_ChangeLineStatus(QString, QString, QString, QString, QString, int, bool)));
//黑白图
connect(CallManage::getInstance(), SIGNAL(sig_changeBlack(QString, bool)), this, SLOT(s_changeBlack(QString, bool)));
QFont font1("微软雅黑", 10);
QFont font2("微软雅黑", 8);
@ -1350,7 +1352,15 @@ void FormInfo::paintEvent(QPaintEvent* event)
QString strShowTxt = "";
painter.setBrush(Qt::NoBrush); // 确保文字不被填充色遮挡
painter.setFont(m_curveNameFont);
painter.setPen(m_lineColor); // fontColor QColor(220, 220, 220)
//黑白图
if(m_bBlack)
{
painter.setPen(QColor(0,0,0));
}
else
{
painter.setPen(m_lineColor);
}
//painter.drawText(rect.left() + 20, 30, m_strAliasName); // titleBarText QStringLiteral("动画")
//painter.drawText(rect, Qt::AlignCenter, m_strAliasName);
if(m_strAliasName == "")
@ -1583,7 +1593,15 @@ void FormInfo::paintEvent(QPaintEvent* event)
//单位------------------------------
painter.setFont(m_curveUnitFont);
painter.setPen(m_lineColor);
//黑白图
if(m_bBlack)
{
painter.setPen(QColor(0,0,0));
}
else
{
painter.setPen(m_lineColor);
}
//painter.drawText(rect.left() + 20, 55, m_strUnit);
//painter.drawText(rect.left() + 20, 80, QString::number(m_vmin)+" ~ "+QString::number(m_vmax));
@ -1613,7 +1631,15 @@ void FormInfo::paintEvent(QPaintEvent* event)
painter.drawText(rect.width()/2- tRect.width()/2, nbay - 6, m_strUnit);
painter.setFont(oldFont);
painter.setPen(QPen(m_lineColor, m_dWidth, m_lineStyle));
//黑白图
if(m_bBlack)
{
painter.setPen(QPen(QColor(0,0,0), m_dWidth, m_lineStyle));
}
else
{
painter.setPen(QPen(m_lineColor, m_dWidth, m_lineStyle));
}
// 刻度线
painter.drawLine(rect.x()-5, nbay, rect.x()+ rect.width()-5, nbay);
}
@ -2957,3 +2983,18 @@ void FormInfo::onDeleteWave()
//删除Wave
emit CallManage::getInstance()->sig_delWave(m_strUuid, m_strWellName, m_strTrackName, m_strLineName);
}
//黑白图
void FormInfo::s_changeBlack(QString strUuid, bool bBlack)
{
if(m_strUuid==strUuid)
{
}
else
{
return;
}
m_bBlack = bBlack;
update();
}

View File

@ -97,6 +97,8 @@ public slots:
//修改曲线选择状态 iSelect=0未知1标准曲线2主曲线3从曲线
void s_ChangeLineStatus(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, int iSelect, bool bMerge);
//修改黑白图
void s_changeBlack(QString strUuid, bool bBlack);
public:
QString m_strUuid;
@ -132,6 +134,9 @@ public:
QFont m_curveUnitFont; // 曲线单位字体
QFont m_curveScaleFont; // 曲线刻度字体
//黑白图
bool m_bBlack = false;
bool m_bConBackAndForth = false; // 单比例连续折返
// 曲线第二比例

View File

@ -257,6 +257,8 @@ void MainWindowCurve::s_mouseWheel(QWheelEvent *event)
//自定义滚动条
void MainWindowCurve::vertScrollBarChanged(int value)
{
//AppendConsole(PAI_INFO, "鼠标滚动开始");
int low = -m_iY1;
int upper = -m_iY2;
@ -308,6 +310,8 @@ void MainWindowCurve::vertScrollBarChanged(int value)
//通知界面重设范围(三图一表)
emit CallManage::getInstance()->sig_vertScrollBarChanged_santuyibiao(m_strUuid, value, -m_iY1, -m_iY2);
//AppendConsole(PAI_INFO, "鼠标滚动结束");
}
//初始化工具栏
@ -2629,7 +2633,13 @@ void MainWindowCurve::s_Save()
//黑白图
void MainWindowCurve::s_Black()
{
//
bool bBlack = false;
if(m_blackAc->isChecked())
{
bBlack = true;
}
emit CallManage::getInstance()->sig_changeBlack(m_strUuid, bBlack);
}
//单曲线头

View File

@ -14237,4 +14237,31 @@ void QMyCustomPlot::s_changeBlack(QString strUuid, bool bBlack)
}
m_bBlack = bBlack;
//黑白图
if(m_bBlack)
{
QCPGraph* graph =this->graph(0);
if(graph)
{
QPen pen = graph->pen();
pen.setColor(QColor(0,0,0));
graph->setPen(pen);
//
replot();
}
}
else {
QCPGraph* graph =this->graph(0);
if(graph)
{
FormInfo* pInfo = m_formTrack->getFormInfoByParameters(m_strUuid, m_strWellName, m_strTrackName, m_strLineName);
QPen pen = graph->pen();
pen.setColor(pInfo->m_lineColor);
graph->setPen(pen);
//
replot();
}
}
}

View File

@ -261,7 +261,7 @@ public:
QVector<double> m_showY;
int m_iCurNum=0;
//分段刷新
int m_iSplitNum=2000; //2000000; //2000;
int m_iSplitNum=2000000; //2000;
bool m_addRandomGraph=false;//当前是否绘制曲线 true:是。
bool m_bEditRect=false; //当前是否正在编辑曲线。
bool m_bFirstTimeConnect=true; //初次绑定编辑曲线信号槽。