MCPcopy Create free account
hub / github.com/MultiMC/Launcher / WorldListPage

Method WorldListPage

launcher/ui/pages/instance/WorldListPage.cpp:65–88  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

63
64
65WorldListPage::WorldListPage(BaseInstance *inst, std::shared_ptr<WorldList> worlds, QWidget *parent)
66 : QMainWindow(parent), m_inst(inst), ui(new Ui::WorldListPage), m_worlds(worlds)
67{
68 ui->setupUi(this);
69
70 ui->toolBar->insertSpacer(ui->actionRefresh);
71
72 WorldListProxyModel * proxy = new WorldListProxyModel(this);
73 proxy->setSortCaseSensitivity(Qt::CaseInsensitive);
74 proxy->setSourceModel(m_worlds.get());
75 ui->worldTreeView->setSortingEnabled(true);
76 ui->worldTreeView->setModel(proxy);
77 ui->worldTreeView->installEventFilter(this);
78 ui->worldTreeView->setContextMenuPolicy(Qt::CustomContextMenu);
79 ui->worldTreeView->setIconSize(QSize(64,64));
80 connect(ui->worldTreeView, &QTreeView::customContextMenuRequested, this, &WorldListPage::ShowContextMenu);
81
82 auto head = ui->worldTreeView->header();
83 head->setSectionResizeMode(0, QHeaderView::Stretch);
84 head->setSectionResizeMode(1, QHeaderView::ResizeToContents);
85
86 connect(ui->worldTreeView->selectionModel(), &QItemSelectionModel::currentChanged, this, &WorldListPage::worldChanged);
87 worldChanged(QModelIndex(), QModelIndex());
88}
89
90void WorldListPage::openedImpl()
91{

Callers

nothing calls this directly

Calls 6

QModelIndexClass · 0.85
insertSpacerMethod · 0.80
setSourceModelMethod · 0.80
setupUiMethod · 0.45
getMethod · 0.45
setModelMethod · 0.45

Tested by

no test coverage detected