mirror of
https://github.com/Xaymar/obs-StreamFX
synced 2024-12-28 18:41:14 +00:00
ui: Prevent Qt from automatically assigning Menu roles
Qt defaults to give every QAction a TextHeuristicRole, which means that certain key words will cause Qt to change how the QAction behaves. We do not want this, so we explicitly assign it to have NoRole instead. Fixes #323
This commit is contained in:
parent
465158476a
commit
ba61329dd1
2 changed files with 12 additions and 0 deletions
|
@ -136,20 +136,25 @@ streamfx::ui::updater::updater(QMenu* menu)
|
|||
|
||||
// Check for Updates
|
||||
_cfu = menu->addAction(QString::fromUtf8(D_TRANSLATE(D_I18N_MENU_CHECKFORUPDATES)));
|
||||
_cfu->setMenuRole(QAction::NoRole);
|
||||
connect(_cfu, &QAction::triggered, this, &streamfx::ui::updater::on_cfu_triggered);
|
||||
|
||||
// Automatically check for Updates
|
||||
_cfu_auto = menu->addAction(QString::fromUtf8(D_TRANSLATE(D_I18N_MENU_CHECKFORUPDATES_AUTOMATICALLY)));
|
||||
_cfu_auto->setMenuRole(QAction::NoRole);
|
||||
_cfu_auto->setCheckable(true);
|
||||
connect(_cfu_auto, &QAction::toggled, this, &streamfx::ui::updater::on_cfu_auto_toggled);
|
||||
|
||||
// Update Channel
|
||||
_channel_menu = menu->addMenu(QString::fromUtf8(D_TRANSLATE(D_I18N_MENU_CHANNEL)));
|
||||
_channel_menu->menuAction()->setMenuRole(QAction::NoRole);
|
||||
|
||||
_channel_stable = _channel_menu->addAction(QString::fromUtf8(D_TRANSLATE(D_I18N_MENU_CHANNEL_RELEASE)));
|
||||
_channel_stable->setMenuRole(QAction::NoRole);
|
||||
_channel_stable->setCheckable(true);
|
||||
|
||||
_channel_preview = _channel_menu->addAction(QString::fromUtf8(D_TRANSLATE(D_I18N_MENU_CHANNEL_TESTING)));
|
||||
_channel_preview->setMenuRole(QAction::NoRole);
|
||||
_channel_preview->setCheckable(true);
|
||||
|
||||
_channel_group = new QActionGroup(_channel_menu);
|
||||
|
|
|
@ -126,24 +126,29 @@ void streamfx::ui::handler::on_obs_loaded()
|
|||
|
||||
// Report an Issue
|
||||
_report_issue = _menu->addAction(QString::fromUtf8(D_TRANSLATE(_i18n_menu_report_issue.data())));
|
||||
_report_issue->setMenuRole(QAction::NoRole);
|
||||
connect(_report_issue, &QAction::triggered, this, &streamfx::ui::handler::on_action_report_issue);
|
||||
|
||||
// Request help
|
||||
_request_help = _menu->addAction(QString::fromUtf8(D_TRANSLATE(_i18n_menu_request_help.data())));
|
||||
_request_help->setMenuRole(QAction::NoRole);
|
||||
connect(_request_help, &QAction::triggered, this, &streamfx::ui::handler::on_action_request_help);
|
||||
|
||||
_menu->addSeparator();
|
||||
|
||||
// Website
|
||||
_link_website = _menu->addAction(QString::fromUtf8(D_TRANSLATE(_i18n_menu_website.data())));
|
||||
_link_website->setMenuRole(QAction::NoRole);
|
||||
connect(_link_website, &QAction::triggered, this, &streamfx::ui::handler::on_action_website);
|
||||
|
||||
// Discord
|
||||
_link_discord = _menu->addAction(QString::fromUtf8(D_TRANSLATE(_i18n_menu_discord.data())));
|
||||
_link_discord->setMenuRole(QAction::NoRole);
|
||||
connect(_link_discord, &QAction::triggered, this, &streamfx::ui::handler::on_action_discord);
|
||||
|
||||
// Github
|
||||
_link_github = _menu->addAction(QString::fromUtf8(D_TRANSLATE(_i18n_menu_github.data())));
|
||||
_link_github->setMenuRole(QAction::NoRole);
|
||||
connect(_link_github, &QAction::triggered, this, &streamfx::ui::handler::on_action_github);
|
||||
|
||||
// Create the updater.
|
||||
|
@ -155,12 +160,14 @@ void streamfx::ui::handler::on_obs_loaded()
|
|||
|
||||
// About
|
||||
_about_action = _menu->addAction(QString::fromUtf8(D_TRANSLATE(_i18n_menu_about.data())));
|
||||
_about_action->setMenuRole(QAction::NoRole);
|
||||
connect(_about_action, &QAction::triggered, this, &streamfx::ui::handler::on_action_about);
|
||||
}
|
||||
|
||||
{ // Add an actual Menu entry.
|
||||
QMainWindow* main_widget = reinterpret_cast<QMainWindow*>(obs_frontend_get_main_window());
|
||||
_menu_action = new QAction(main_widget);
|
||||
_menu_action->setMenuRole(QAction::NoRole);
|
||||
_menu_action->setMenu(_menu);
|
||||
_menu_action->setText(QString::fromUtf8(D_TRANSLATE(_i18n_menu.data())));
|
||||
|
||||
|
|
Loading…
Reference in a new issue