Qt: Ensure action set is clean before (re)building

This commit is contained in:
Vicki Pfau 2023-08-18 20:43:05 -07:00
parent 6e65b70c32
commit 3ee12b1a55
3 changed files with 10 additions and 0 deletions

View File

@ -220,6 +220,10 @@ void ConfigController::updateOption(const char* key) {
m_optionSet[optionName]->setValue(mCoreConfigGetValue(&m_config, key));
}
void ConfigController::clearOptions() {
m_optionSet.clear();
}
QString ConfigController::getOption(const char* key, const QVariant& defaultVal) const {
const char* val = mCoreConfigGetValue(&m_config, key);
if (val) {

View File

@ -80,6 +80,7 @@ public:
ConfigOption* addOption(const char* key);
void updateOption(const char* key);
void clearOptions();
QString getOption(const char* key, const QVariant& defaultVal = QVariant()) const;
QString getOption(const QString& key, const QVariant& defaultVal = QVariant()) const;

View File

@ -1259,6 +1259,11 @@ void Window::setupMenu(QMenuBar* menubar) {
installEventFilter(m_shortcutController);
menubar->clear();
m_gameActions.clear();
m_nonMpActions.clear();
m_platformActions.clear();
m_config->clearOptions();
m_actions.addMenu(tr("&File"), "file");
m_actions.addAction(tr("Load &ROM..."), "loadROM", this, &Window::selectROM, "file", QKeySequence::Open);