MCPcopy Create free account
hub / github.com/KDE/labplot / adjustHeaders

Method adjustHeaders

src/frontend/matrix/MatrixView.cpp:356–383  ·  view source on GitHub ↗

! set the row and column size to the saved sizes. */

Source from the content-addressed store, hash-verified

354 set the row and column size to the saved sizes.
355 */
356void MatrixView::adjustHeaders() {
357 auto* h_header = m_tableView->horizontalHeader();
358 auto* v_header = m_tableView->verticalHeader();
359
360 disconnect(v_header, &QHeaderView::sectionResized, this, &MatrixView::handleVerticalSectionResized);
361 disconnect(h_header, &QHeaderView::sectionResized, this, &MatrixView::handleHorizontalSectionResized);
362
363 // resize columns to the saved sizes or to fit the contents if the widht is 0
364 int cols = m_matrix->columnCount();
365 for (int i = 0; i < cols; i++) {
366 if (m_matrix->columnWidth(i) == 0)
367 m_tableView->resizeColumnToContents(i);
368 else
369 m_tableView->setColumnWidth(i, m_matrix->columnWidth(i));
370 }
371
372 // resize rows to the saved sizes or to fit the contents if the height is 0
373 int rows = m_matrix->rowCount();
374 for (int i = 0; i < rows; i++) {
375 if (m_matrix->rowHeight(i) == 0)
376 m_tableView->resizeRowToContents(i);
377 else
378 m_tableView->setRowHeight(i, m_matrix->rowHeight(i));
379 }
380
381 connect(v_header, &QHeaderView::sectionResized, this, &MatrixView::handleVerticalSectionResized);
382 connect(h_header, &QHeaderView::sectionResized, this, &MatrixView::handleHorizontalSectionResized);
383}
384
385/*!
386 Resizes the headers/columns to fit the new content. Called on changes of the header format in Matrix.

Callers

nothing calls this directly

Calls 6

columnCountMethod · 0.45
columnWidthMethod · 0.45
setColumnWidthMethod · 0.45
rowCountMethod · 0.45
rowHeightMethod · 0.45
setRowHeightMethod · 0.45

Tested by

no test coverage detected