From ec0071303390fd45dd93f620a8495a0f81f37b4d Mon Sep 17 00:00:00 2001 From: Andy Huska Date: Wed, 2 Nov 2022 16:06:50 -0500 Subject: [PATCH] Improved auto row expansion for new unique frames coming in --- mainwindow.cpp | 23 ++++++++++++++--------- mainwindow.h | 1 + 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/mainwindow.cpp b/mainwindow.cpp index b46df02..c3e477a 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -442,8 +442,7 @@ void MainWindow::headerClicked(int logicalIndex) //ui->canFramesView->sortByColumn(logicalIndex); model->sortByColumn(logicalIndex); - if(rowExpansionActive && model->getInterpretMode()) - ui->canFramesView->resizeRowsToContents(); + manageRowExpansion(); } void MainWindow::expandAllRows() @@ -469,6 +468,12 @@ void MainWindow::expandAllRows() } } +void MainWindow::manageRowExpansion() +{ + if(rowExpansionActive && model->getInterpretMode()) + ui->canFramesView->resizeRowsToContents(); +} + void MainWindow::collapseAllRows() { bool goAhead = false; @@ -628,6 +633,7 @@ void MainWindow::overwriteToggled(bool state) } else { + rowExpansionActive = false; model->setOverwriteMode(false); } } @@ -687,8 +693,7 @@ void MainWindow::filterListItemChanged(QListWidgetItem *item) model->setFilterState(ID, isSet); - if(rowExpansionActive && model->getInterpretMode()) - ui->canFramesView->resizeRowsToContents(); + manageRowExpansion(); } void MainWindow::busFilterListItemChanged(QListWidgetItem *item) @@ -703,8 +708,7 @@ void MainWindow::busFilterListItemChanged(QListWidgetItem *item) model->setBusFilterState(ID, isSet); - if(rowExpansionActive && model->getInterpretMode()) - ui->canFramesView->resizeRowsToContents(); + manageRowExpansion(); } void MainWindow::filterSetAll() @@ -717,8 +721,7 @@ void MainWindow::filterSetAll() inhibitFilterUpdate = false; model->setAllFilters(true); - if(rowExpansionActive && model->getInterpretMode()) - ui->canFramesView->resizeRowsToContents(); + manageRowExpansion(); } void MainWindow::filterClearAll() @@ -754,12 +757,14 @@ void MainWindow::tickGUIUpdate() framesPerSec = 0; ui->lbNumFrames->setText(QString::number(model->rowCount())); - if (rxFrames > 0 && /*allowCapture && */ ui->cbAutoScroll->isChecked()) ui->canFramesView->scrollToBottom(); + if (rxFrames > 0 && /*allowCapture && */ ui->cbAutoScroll->isChecked()) + ui->canFramesView->scrollToBottom(); ui->lbFPS->setText(QString::number(framesPerSec)); if (rxFrames > 0) { bDirty = true; emit framesUpdated(rxFrames); //anyone care that frames were updated? + manageRowExpansion(); } if (model->needsFilterRefresh()) updateFilterList(); diff --git a/mainwindow.h b/mainwindow.h index 9daf12d..60a6a34 100644 --- a/mainwindow.h +++ b/mainwindow.h @@ -205,6 +205,7 @@ private: void readSettings(); void writeSettings(); bool eventFilter(QObject *obj, QEvent *event); + void manageRowExpansion(); }; #endif // MAINWINDOW_H