mirror of
https://github.com/obsproject/obs-studio.git
synced 2026-05-12 01:06:46 -04:00
frontend: Set Frontend-API QActions role to NoRole
When no role is set, the default is QAction::TextHeuristicRole. This means that the text of the item gets fuzzy-matched in Qt against a set of possible strings that could indicate that the menu should be in the application menu on macOS. For us this meant however that on some languages, the translation of "WebSocket Server Settings" would begin with "Config", and as such the related QAction replaces our "Settings" action for the PreferencesRole, and clicking "Preferences..." in the application menu would open the websocket settings. It should probably be considered a bug in Qt that implicit matches via TextHeuristicRole can overwrite ones that are explicitly set (like our PreferencesRole). However we explicitly set our roles ourselves anyways and there is no scenario where a plugin should overwrite them, we can just default actions added via the Frontend API to be NoRole; and worry about the Qt bug later.
This commit is contained in:
committed by
Ryan Foster
parent
059fd6210c
commit
d3c5d2ce0b
@@ -314,7 +314,9 @@ bool OBSStudioAPI::obs_frontend_replay_buffer_active()
|
||||
void *OBSStudioAPI::obs_frontend_add_tools_menu_qaction(const char *name)
|
||||
{
|
||||
main->ui->menuTools->setEnabled(true);
|
||||
return (void *)main->ui->menuTools->addAction(QT_UTF8(name));
|
||||
QAction *action = main->ui->menuTools->addAction(QT_UTF8(name));
|
||||
action->setMenuRole(QAction::NoRole);
|
||||
return static_cast<void *>(action);
|
||||
}
|
||||
|
||||
void OBSStudioAPI::obs_frontend_add_tools_menu_item(const char *name, obs_frontend_cb callback, void *private_data)
|
||||
@@ -326,6 +328,7 @@ void OBSStudioAPI::obs_frontend_add_tools_menu_item(const char *name, obs_fronte
|
||||
};
|
||||
|
||||
QAction *action = main->ui->menuTools->addAction(QT_UTF8(name));
|
||||
action->setMenuRole(QAction::NoRole);
|
||||
QObject::connect(action, &QAction::triggered, func);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user