mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-07-11 07:46:17 -07:00
Add "Auto resize columns" functionality
This commit is contained in:
parent
208234b934
commit
7ae68b20e7
8 changed files with 115 additions and 0 deletions
|
@ -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());
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue