diff --git a/Source/Core/DolphinQt/MenuBar.cpp b/Source/Core/DolphinQt/MenuBar.cpp index 6b6617cff8..3c5653913d 100644 --- a/Source/Core/DolphinQt/MenuBar.cpp +++ b/Source/Core/DolphinQt/MenuBar.cpp @@ -701,20 +701,29 @@ void MenuBar::AddShowRegionsMenu(QMenu* view_menu) {tr("Show World"), &SConfig::GetInstance().m_ListWorld}, {tr("Show Unknown"), &SConfig::GetInstance().m_ListUnknown}}; - QActionGroup* region_group = new QActionGroup(this); - QMenu* region_menu = view_menu->addMenu(tr("Show Regions")); - region_group->setExclusive(false); + QMenu* const region_menu = view_menu->addMenu(tr("Show Regions")); + const QAction* const show_all_regions = region_menu->addAction(tr("Show All")); + const QAction* const hide_all_regions = region_menu->addAction(tr("Hide All")); + region_menu->addSeparator(); for (const auto& key : region_map.keys()) { - bool* config = region_map[key]; - QAction* action = region_group->addAction(region_menu->addAction(key)); - action->setCheckable(true); - action->setChecked(*config); - connect(action, &QAction::toggled, [this, config, key](bool value) { - *config = value; - emit GameListRegionVisibilityToggled(key, value); - }); + bool* const config = region_map[key]; + QAction* const menu_item = region_menu->addAction(key); + menu_item->setCheckable(true); + menu_item->setChecked(*config); + + const auto set_visibility = [this, config, key, menu_item](bool visibility) { + menu_item->setChecked(visibility); + *config = visibility; + emit GameListRegionVisibilityToggled(key, visibility); + }; + const auto set_visible = std::bind(set_visibility, true); + const auto set_hidden = std::bind(set_visibility, false); + + connect(menu_item, &QAction::toggled, set_visibility); + connect(show_all_regions, &QAction::triggered, menu_item, set_visible); + connect(hide_all_regions, &QAction::triggered, menu_item, set_hidden); } }