mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2025-12-18 14:38:04 -06:00
Add "Auto resize columns" functionality
This commit is contained in:
@@ -182,6 +182,7 @@ void PropertiesWidget::displayColumnHeaderMenu()
|
||||
QMenu *menu = new QMenu(this);
|
||||
menu->setAttribute(Qt::WA_DeleteOnClose);
|
||||
menu->setTitle(tr("Column visibility"));
|
||||
menu->setToolTipsVisible(true);
|
||||
|
||||
for (int i = 0; i < TorrentContentModelItem::TreeItemColumns::NB_COL; ++i)
|
||||
{
|
||||
@@ -202,6 +203,18 @@ void PropertiesWidget::displayColumnHeaderMenu()
|
||||
action->setEnabled(false);
|
||||
}
|
||||
|
||||
menu->addSeparator();
|
||||
QAction *resizeAction = menu->addAction(tr("Resize columns"), this, [this]()
|
||||
{
|
||||
for (int i = 0, count = m_ui->filesList->header()->count(); i < count; ++i)
|
||||
{
|
||||
if (!m_ui->filesList->isColumnHidden(i))
|
||||
m_ui->filesList->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