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; //锁头