Fix library column stretching

This commit is contained in:
Petr Mrázek 2014-01-03 23:26:21 +01:00
parent 8fa69307d2
commit e558584af0

View File

@ -44,9 +44,19 @@ void ModListView::setModel ( QAbstractItemModel* model )
QTreeView::setModel ( model ); QTreeView::setModel ( model );
auto head = header(); auto head = header();
head->setStretchLastSection(false); head->setStretchLastSection(false);
head->setSectionResizeMode(0, QHeaderView::ResizeToContents); // HACK: this is true for the checkbox column of mod lists
head->setSectionResizeMode(1, QHeaderView::Stretch); auto string = model->headerData(0,head->orientation()).toString();
for(int i = 2; i < head->count(); i++) if(!string.size())
head->setSectionResizeMode(i, QHeaderView::ResizeToContents); {
dropIndicatorPosition(); head->setSectionResizeMode(0, QHeaderView::ResizeToContents);
head->setSectionResizeMode(1, QHeaderView::Stretch);
for(int i = 2; i < head->count(); i++)
head->setSectionResizeMode(i, QHeaderView::ResizeToContents);
}
else
{
head->setSectionResizeMode(0, QHeaderView::Stretch);
for(int i = 1; i < head->count(); i++)
head->setSectionResizeMode(i, QHeaderView::ResizeToContents);
}
} }