MCPcopy Create free account
hub / github.com/PolyMC/PolyMC / setModel

Method setModel

launcher/ui/widgets/ModListView.cpp:42–65  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

40}
41
42void 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}

Callers

nothing calls this directly

Calls 4

toStringMethod · 0.45
headerDataMethod · 0.45
countMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected