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

Method changeActiveAccount

launcher/ui/MainWindow.cpp:1421–1438  ·  view source on GitHub ↗

* Assumes the sender is a QAction */

Source from the content-addressed store, hash-verified

1419 * Assumes the sender is a QAction
1420 */
1421void MainWindow::changeActiveAccount()
1422{
1423 QAction *sAction = (QAction *)sender();
1424
1425 // Profile's associated Mojang username
1426 if (sAction->data().type() != QVariant::Type::Int)
1427 return;
1428
1429 QVariant data = sAction->data();
1430 bool valid = false;
1431 int index = data.toInt(&valid);
1432 if(!valid) {
1433 index = -1;
1434 }
1435 auto accounts = APPLICATION->accounts();
1436 accounts->setDefaultAccount(index == -1 ? nullptr : accounts->at(index));
1437 defaultAccountChanged();
1438}
1439
1440void MainWindow::defaultAccountChanged()
1441{

Callers

nothing calls this directly

Calls 5

accountsMethod · 0.80
setDefaultAccountMethod · 0.80
typeMethod · 0.45
dataMethod · 0.45
atMethod · 0.45

Tested by

no test coverage detected