mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2026-01-01 13:18:06 -06:00
Add "Auto resize columns" functionality
This commit is contained in:
@@ -469,6 +469,7 @@ void SearchJobWidget::displayColumnHeaderMenu()
|
||||
auto menu = new QMenu(this);
|
||||
menu->setAttribute(Qt::WA_DeleteOnClose);
|
||||
menu->setTitle(tr("Column visibility"));
|
||||
menu->setToolTipsVisible(true);
|
||||
|
||||
for (int i = 0; i < SearchSortModel::DL_LINK; ++i)
|
||||
{
|
||||
@@ -489,6 +490,18 @@ void SearchJobWidget::displayColumnHeaderMenu()
|
||||
action->setChecked(!m_ui->resultsBrowser->isColumnHidden(i));
|
||||
}
|
||||
|
||||
menu->addSeparator();
|
||||
QAction *resizeAction = menu->addAction(tr("Resize columns"), this, [this]()
|
||||
{
|
||||
for (int i = 0, count = m_ui->resultsBrowser->header()->count(); i < count; ++i)
|
||||
{
|
||||
if (!m_ui->resultsBrowser->isColumnHidden(i))
|
||||
m_ui->resultsBrowser->resizeColumnToContents(i);
|
||||
}
|
||||
saveSettings();
|
||||
});
|
||||
resizeAction->setToolTip(tr("Resize all non-hidden columns to the size of their contents"));
|
||||
|
||||
menu->popup(QCursor::pos());
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user