| 40 | } |
| 41 | |
| 42 | void ModListView::setModel ( QAbstractItemModel* model ) |
| 43 | { |
| 44 | QTreeView::setModel ( model ); |
| 45 | auto head = header(); |
| 46 | head->setStretchLastSection(false); |
| 47 | // HACK: this is true for the checkbox column of mod lists |
| 48 | auto string = model->headerData(0,head->orientation()).toString(); |
| 49 | if(head->count() < 1) |
| 50 | { |
| 51 | return; |
| 52 | } |
| 53 | if(!string.size()) |
| 54 | { |
| 55 | for(int i = 0; i < head->count(); i++) |
| 56 | head->setSectionResizeMode(i, QHeaderView::ResizeToContents); |
| 57 | head->setSectionResizeMode(1, QHeaderView::Stretch); |
| 58 | } |
| 59 | else |
| 60 | { |
| 61 | head->setSectionResizeMode(0, QHeaderView::Stretch); |
| 62 | for(int i = 1; i < head->count(); i++) |
| 63 | head->setSectionResizeMode(i, QHeaderView::ResizeToContents); |
| 64 | } |
| 65 | } |
nothing calls this directly
no test coverage detected