Skip to content

Commit

Permalink
Enforce all columns resize to content and fixed
Browse files Browse the repository at this point in the history
This will also resize child row's columns on group item's expanding automatically, but the size will be fixed and user can not resize them.
  • Loading branch information
davidlatwe committed Jul 8, 2019
1 parent faeb6de commit 65940c3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
5 changes: 0 additions & 5 deletions avalon/tools/cbloader/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,11 +183,6 @@ def _assetschanged(self):
document = asset_item.data(DocumentRole)
subsets_model.set_asset(document['_id'])

# Enforce the columns to fit the data (purely cosmetic)
columns = subsets_model.columnCount(QtCore.QModelIndex())
for i in range(columns):
subsets.view.resizeColumnToContents(i)

# Clear the version information on asset change
self.data['model']['version'].set_version(None)

Expand Down
4 changes: 4 additions & 0 deletions avalon/tools/cbloader/widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,10 @@ def __init__(self, parent=None):
self.view.setModel(self.family_proxy)
self.view.customContextMenuRequested.connect(self.on_context_menu)

header = self.view.header()
# Enforce the columns to fit the data (purely cosmetic)
header.setSectionResizeMode(QtWidgets.QHeaderView.ResizeToContents)

selection = view.selectionModel()
selection.selectionChanged.connect(self.active_changed)

Expand Down

0 comments on commit 65940c3

Please sign in to comment.