Skip to content

Commit

Permalink
Merge pull request #711 from pyjamasam/row_height_fix
Browse files Browse the repository at this point in the history
Calculate the default row height correctly
  • Loading branch information
collin80 authored Dec 20, 2023
2 parents 96cb06f + f911ab0 commit da5e502
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -204,13 +204,16 @@ 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);
if (normalRowHeight == 0) normalRowHeight = 30; //should not be necessary but provides a sane number if something stupid happened.
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)));

Expand Down

0 comments on commit da5e502

Please sign in to comment.