Skip to content

Commit

Permalink
Allow resizing of reports table columns (keepassxreboot#6435)
Browse files Browse the repository at this point in the history
* Fix keepassxreboot#5678

Co-authored-by: Jonathan White <[email protected]>
  • Loading branch information
xvallspl and droidmonkey authored Apr 24, 2021
1 parent 7b7f52c commit 01d8676
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
7 changes: 5 additions & 2 deletions src/gui/reports/ReportsWidgetHealthcheck.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,10 @@ ReportsWidgetHealthcheck::ReportsWidgetHealthcheck(QWidget* parent)
m_modelProxy->setSortLocaleAware(true);
m_ui->healthcheckTableView->setModel(m_modelProxy.data());
m_ui->healthcheckTableView->setSelectionMode(QAbstractItemView::NoSelection);
m_ui->healthcheckTableView->horizontalHeader()->setSectionResizeMode(QHeaderView::ResizeToContents);
m_ui->healthcheckTableView->horizontalHeader()->setSectionResizeMode(QHeaderView::Interactive);
m_ui->healthcheckTableView->verticalHeader()->setSectionResizeMode(QHeaderView::ResizeToContents);
m_ui->healthcheckTableView->setSortingEnabled(true);
m_ui->healthcheckTableView->setWordWrap(true);

connect(m_ui->healthcheckTableView, SIGNAL(customContextMenuRequested(QPoint)), SLOT(customMenuRequested(QPoint)));
connect(m_ui->healthcheckTableView, SIGNAL(doubleClicked(QModelIndex)), SLOT(emitEntryActivated(QModelIndex)));
Expand Down Expand Up @@ -279,7 +281,8 @@ void ReportsWidgetHealthcheck::calculateHealth()
m_ui->healthcheckTableView->sortByColumn(0, Qt::AscendingOrder);
}

m_ui->healthcheckTableView->resizeRowsToContents();
m_ui->healthcheckTableView->resizeColumnsToContents();
m_ui->healthcheckTableView->horizontalHeader()->setSectionResizeMode(0, QHeaderView::Fixed);

// Show the "show known bad entries" checkbox if there's any known
// bad entry in the database.
Expand Down
5 changes: 3 additions & 2 deletions src/gui/reports/ReportsWidgetHibp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@ ReportsWidgetHibp::ReportsWidgetHibp(QWidget* parent)
m_modelProxy->setSortLocaleAware(true);
m_ui->hibpTableView->setModel(m_modelProxy.data());
m_ui->hibpTableView->setSelectionMode(QAbstractItemView::NoSelection);
m_ui->hibpTableView->horizontalHeader()->setSectionResizeMode(QHeaderView::ResizeToContents);
m_ui->hibpTableView->horizontalHeader()->setSectionResizeMode(QHeaderView::Interactive);
m_ui->hibpTableView->verticalHeader()->setSectionResizeMode(QHeaderView::ResizeToContents);
m_ui->hibpTableView->setSortingEnabled(true);

connect(m_ui->hibpTableView, SIGNAL(doubleClicked(QModelIndex)), SLOT(emitEntryActivated(QModelIndex)));
Expand Down Expand Up @@ -203,7 +204,7 @@ void ReportsWidgetHibp::makeHibpTable()
m_ui->showKnownBadCheckBox->hide();
}

m_ui->hibpTableView->resizeRowsToContents();
m_ui->hibpTableView->resizeColumnsToContents();
m_ui->hibpTableView->sortByColumn(2, Qt::DescendingOrder);

m_ui->stackedWidget->setCurrentIndex(1);
Expand Down

0 comments on commit 01d8676

Please sign in to comment.