mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2025-12-17 14:08:03 -06:00
Add "Auto resize columns" functionality
This commit is contained in:
@@ -643,6 +643,7 @@ void TransferListWidget::displayColumnHeaderMenu()
|
||||
auto menu = new QMenu(this);
|
||||
menu->setAttribute(Qt::WA_DeleteOnClose);
|
||||
menu->setTitle(tr("Column visibility"));
|
||||
menu->setToolTipsVisible(true);
|
||||
|
||||
for (int i = 0; i < TransferListModel::NB_COLUMNS; ++i)
|
||||
{
|
||||
@@ -666,6 +667,18 @@ void TransferListWidget::displayColumnHeaderMenu()
|
||||
action->setChecked(!isColumnHidden(i));
|
||||
}
|
||||
|
||||
menu->addSeparator();
|
||||
QAction *resizeAction = menu->addAction(tr("Resize columns"), this, [this]()
|
||||
{
|
||||
for (int i = 0, count = header()->count(); i < count; ++i)
|
||||
{
|
||||
if (!isColumnHidden(i))
|
||||
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