From f911ab00d5309b3cd904d4f0c8513f7c2c147d65 Mon Sep 17 00:00:00 2001 From: Chris Whiteford Date: Fri, 15 Dec 2023 11:42:31 -0500 Subject: [PATCH] Calculate the default row height correctly Ensure that the temporary row that is added to the view on startup is sized correctly before storing that height as the default. Then use the calculated row height to set the default height for all added rows --- mainwindow.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/mainwindow.cpp b/mainwindow.cpp index b2718bd6..8b14149f 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -204,6 +204,7 @@ MainWindow::MainWindow(QWidget *parent) : temp.isReceived = true; temp.setTimeStamp(QCanBusFrame::TimeStamp(0, 100000000)); model->addFrame(temp, true); + ui->canFramesView->resizeRowToContents(0); // Resize the row to fit the contents so we get a proper height value qApp->processEvents(); tickGUIUpdate(); //force a GUI refresh so that the row exists to measure normalRowHeight = ui->canFramesView->rowHeight(0); @@ -211,6 +212,8 @@ MainWindow::MainWindow(QWidget *parent) : qDebug() << "normal row height = " << normalRowHeight; model->clearFrames(); + ui->canFramesView->verticalHeader()->setDefaultSectionSize(normalRowHeight); // Set the default height for all rows to the height that was calculated + //connect(CANConManager::getInstance(), CANConManager::connectionStatusUpdated, this, MainWindow::connectionStatusUpdated); connect(CANConManager::getInstance(), SIGNAL(connectionStatusUpdated(int)), this, SLOT(connectionStatusUpdated(int)));