diff --git a/src/qt_gui/game_list_frame.cpp b/src/qt_gui/game_list_frame.cpp index 46ea5b5ab..b64717aec 100644 --- a/src/qt_gui/game_list_frame.cpp +++ b/src/qt_gui/game_list_frame.cpp @@ -80,9 +80,10 @@ GameListFrame::GameListFrame(std::shared_ptr gui_settings, }); connect(this, &QTableWidget::customContextMenuRequested, this, [=, this](const QPoint& pos) { - m_gui_context_menus.RequestGameMenu(pos, m_game_info->m_games, m_compat_info, - m_gui_settings, this, true); - PopulateGameList(false); + int changedFavorite = m_gui_context_menus.RequestGameMenu( + pos, m_game_info->m_games, m_compat_info, m_gui_settings, this, true); + if (changedFavorite) + PopulateGameList(false); }); connect(this, &QTableWidget::cellClicked, this, [=, this](int row, int column) { diff --git a/src/qt_gui/gui_context_menus.h b/src/qt_gui/gui_context_menus.h index c6a0994f6..7fa4654da 100644 --- a/src/qt_gui/gui_context_menus.h +++ b/src/qt_gui/gui_context_menus.h @@ -31,13 +31,13 @@ class GuiContextMenus : public QObject { Q_OBJECT public: - void RequestGameMenu(const QPoint& pos, QVector& m_games, - std::shared_ptr m_compat_info, - std::shared_ptr settings, QTableWidget* widget, - bool isList) { + int RequestGameMenu(const QPoint& pos, QVector& m_games, + std::shared_ptr m_compat_info, + std::shared_ptr settings, QTableWidget* widget, bool isList) { QPoint global_pos = widget->viewport()->mapToGlobal(pos); std::shared_ptr m_gui_settings = std::move(settings); int itemID = 0; + int changedFavorite = 0; if (isList) { itemID = widget->currentRow(); } else { @@ -46,7 +46,7 @@ public: // Do not show the menu if no item is selected if (itemID < 0 || itemID >= m_games.size()) { - return; + return changedFavorite; } // Setup menu. @@ -142,7 +142,7 @@ public: // Show menu. auto selected = menu.exec(global_pos); if (!selected) { - return; + return changedFavorite; } if (selected == openGameFolder) { @@ -318,6 +318,7 @@ public: if (selected == toggleFavorite) { m_gui_settings->SetValue(gui::favorites, serialStr, !isFavorite, true); widget->setCurrentCell(-1, -1); + changedFavorite = 1; } if (selected == &openCheats) { @@ -605,6 +606,7 @@ public: QUrl(url_issues + m_games[itemID].compatibility.issue_number)); } } + return changedFavorite; } int GetRowIndex(QTreeWidget* treeWidget, QTreeWidgetItem* item) {