NOISSUE Hide the join world buttons properly

This also fixes `QAction::setVisible` not working correctly in other parts of the codebase
This commit is contained in:
arthomnix
2023-04-09 19:18:31 +01:00
parent 1ad3e4417f
commit 5ff03584a5
3 changed files with 5 additions and 10 deletions

View File

@@ -320,12 +320,6 @@ void WorldListPage::worldChanged(const QModelIndex &current, const QModelIndex &
bool enable = index.isValid();
ui->actionJoin->setVisible(enableJoinActions);
ui->actionJoinOffline->setVisible(enableJoinActions);
// The above lines will only hide the actions from the right click menu, to hide them from the toolbar we need to do this.
// If any more actions are added above the Join/Join Offline actions, these indices will need to be updated!
ui->toolBar->actions().at(2)->setVisible(enableJoinActions);
ui->toolBar->actions().at(3)->setVisible(enableJoinActions);
// Also disable the separator so there aren't 2 separators in a row
ui->toolBar->actions().at(4)->setVisible(enableJoinActions);
ui->actionJoin->setEnabled(enable && enableJoinActions);
ui->actionJoinOffline->setEnabled(enable && enableJoinActions);
ui->actionCopy_Seed->setEnabled(enable);