From e486388b1b0841cc70d794d1f87e41bddd3abb8e Mon Sep 17 00:00:00 2001 From: jiayulong Date: Fri, 29 May 2026 11:31:24 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=97=E5=AE=BD=E6=94=B9=E5=8F=98=E5=90=8E?= =?UTF-8?q?=EF=BC=8C=E6=BF=80=E5=8F=91=E5=B1=85=E4=B8=AD=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- logPlus/mainwindowcurve.cpp | 18 +++++++++++++++++- logPlus/mainwindowcurve.h | 3 +++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/logPlus/mainwindowcurve.cpp b/logPlus/mainwindowcurve.cpp index d40898f..31db9bf 100644 --- a/logPlus/mainwindowcurve.cpp +++ b/logPlus/mainwindowcurve.cpp @@ -119,6 +119,8 @@ MainWindowCurve::MainWindowCurve(QWidget *parent) : ui->tableWidget_2->setContextMenuPolicy(Qt::CustomContextMenu); // 连接信号和槽 connect(ui->tableWidget_2, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(slotContextMenu(QPoint))); + //列宽改变 + connect(ui->tableWidget_2->horizontalHeader(), &QHeaderView::sectionResized, this, &MainWindowCurve::onSectionResized); //隐藏滚动条 ui->tableWidget_2->verticalScrollBar()->setDisabled(true); // 禁用滚动 @@ -275,7 +277,7 @@ void MainWindowCurve::s_setRangeVScrollBar2(QString strUuid) //2个滚动条位置 SetScrollBar_Geometry(); - emit sig_resizeWindow(); + //emit sig_resizeWindow(); } //窗口居中处理 @@ -6389,3 +6391,17 @@ void MainWindowCurve::slotCreateTail() { m_dock2->show(); } + +//列宽改变 +void MainWindowCurve::onSectionResized(int logicalIndex, int oldSize, int newSize) +{ + if(g_iLoadingJson==1)//针对模板加载,不处理列宽改变,避免多次冲突 + { + return; + } + + qDebug() << "onSectionResized"; + + //居中 + emit sig_resizeWindow(); +} diff --git a/logPlus/mainwindowcurve.h b/logPlus/mainwindowcurve.h index 7e06b36..89ecc27 100644 --- a/logPlus/mainwindowcurve.h +++ b/logPlus/mainwindowcurve.h @@ -228,6 +228,9 @@ public slots: //窗口居中处理 void resizeWindow(); + //列宽改变 + void onSectionResized(int logicalIndex, int oldSize, int newSize); + public: QAction* m_selectWellAc = nullptr; //选择井 QAction* m_fixwellsectionHeaderAc = nullptr; //锁头