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

Method changeActiveAccount

launcher/ui/MainWindow.cpp:1105–1122  ·  view source on GitHub ↗

* Assumes the sender is a QAction */

Source from the content-addressed store, hash-verified

1103 * Assumes the sender is a QAction
1104 */
1105void MainWindow::changeActiveAccount()
1106{
1107 QAction *sAction = (QAction *)sender();
1108
1109 // Profile's associated Mojang username
1110 if (sAction->data().type() != QVariant::Type::Int)
1111 return;
1112
1113 QVariant data = sAction->data();
1114 bool valid = false;
1115 int index = data.toInt(&valid);
1116 if(!valid) {
1117 index = -1;
1118 }
1119 auto accounts = APPLICATION->accounts();
1120 accounts->setDefaultAccount(index == -1 ? nullptr : accounts->at(index));
1121 defaultAccountChanged();
1122}
1123
1124void MainWindow::defaultAccountChanged()
1125{

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