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

Method changeActiveAccount

launcher/ui/MainWindow.cpp:1123–1140  ·  view source on GitHub ↗

* Assumes the sender is a QAction */

Source from the content-addressed store, hash-verified

1121 * Assumes the sender is a QAction
1122 */
1123void MainWindow::changeActiveAccount()
1124{
1125 QAction *sAction = (QAction *)sender();
1126
1127 // Profile's associated Mojang username
1128 if (sAction->data().type() != QVariant::Type::Int)
1129 return;
1130
1131 QVariant data = sAction->data();
1132 bool valid = false;
1133 int index = data.toInt(&valid);
1134 if(!valid) {
1135 index = -1;
1136 }
1137 auto accounts = APPLICATION->accounts();
1138 accounts->setDefaultAccount(index == -1 ? nullptr : accounts->at(index));
1139 defaultAccountChanged();
1140}
1141
1142void MainWindow::defaultAccountChanged()
1143{

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