Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 21 additions & 2 deletions picard/ui/itemviews/basetreeview.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,10 @@
from picard.ui.columns import Columns
from picard.ui.enums import MainAction
from picard.ui.filter import Filter
from picard.ui.itemviews.custom_columns import DelegateColumn
from picard.ui.itemviews.custom_columns import (
DelegateColumn,
IconColumn,
)
from picard.ui.itemviews.custom_columns.shared import get_recognized_view_columns
from picard.ui.itemviews.events import header_events
from picard.ui.ratingwidget import RatingWidget
Expand Down Expand Up @@ -417,8 +420,19 @@ def _set_header_labels(self, update_column_count=False):
if isinstance(cols, Columns):
if update_column_count:
self.setColumnCount(len(cols))
labels = tuple(_(c.title) for c in cols)
labels = []
header_tooltips = {}
for i, c in enumerate(cols):
if isinstance(c, IconColumn):
labels.append('')
header_tooltips[i] = _(c.title)
else:
labels.append(_(c.title))
self.setHeaderLabels(labels)
if header_tooltips:
header_item = self.headerItem()
for i, tooltip in header_tooltips.items():
header_item.setToolTip(i, tooltip)

def restore_default_columns(self):
self._set_header_labels(update_column_count=False)
Expand Down Expand Up @@ -446,6 +460,11 @@ def _refresh_header_labels(self):
# reflect the actual visibility state, especially for newly added columns
header = self.header()
header.sync_visible_columns()
# Restore fixed size for non-resizeable columns, e.g. after being
# stretched by stretchLastSection when they were the last column.
for i, c in enumerate(self.columns):
if not c.resizeable and c.width is not None:
header.resizeSection(i, c.width)

def _refresh_all_items_data(self):
"""Refresh data for all items in the tree view."""
Expand Down
Loading