mirror of
https://github.com/Xaymar/obs-StreamFX
synced 2024-11-10 22:05:06 +00:00
ui: Insert StreamFX menu before OBS "Help" menu
Instead of adding ourselves as the last entry which seems to confuse the MacOS Qt implementation, we instead insert ourselves before the Help menu. This should hopefully prevent the StreamFX menu from overriding the OBS About entry. Fixes #323
This commit is contained in:
parent
f01d2e6db1
commit
465158476a
1 changed files with 14 additions and 6 deletions
|
@ -158,12 +158,20 @@ void streamfx::ui::handler::on_obs_loaded()
|
|||
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->setMenu(_menu);
|
||||
_menu_action->setText(QString::fromUtf8(D_TRANSLATE(_i18n_menu.data())));
|
||||
main_widget->menuBar()->addAction(_menu_action);
|
||||
{ // Add an actual Menu entry.
|
||||
QMainWindow* main_widget = reinterpret_cast<QMainWindow*>(obs_frontend_get_main_window());
|
||||
_menu_action = new QAction(main_widget);
|
||||
_menu_action->setMenu(_menu);
|
||||
_menu_action->setText(QString::fromUtf8(D_TRANSLATE(_i18n_menu.data())));
|
||||
|
||||
// For unknown reasons, the "About StreamFX" menu replaces the OBS about menu.
|
||||
QList<QMenu*> obs_menus = main_widget->menuBar()->findChildren<QMenu*>(QString(), Qt::FindDirectChildrenOnly);
|
||||
if (QMenu* help_menu = obs_menus.at(1); help_menu) {
|
||||
main_widget->menuBar()->insertAction(help_menu->menuAction(), _menu_action);
|
||||
} else {
|
||||
main_widget->menuBar()->addAction(_menu_action);
|
||||
}
|
||||
}
|
||||
|
||||
// Show the 'About StreamFX' dialog if that has not happened yet.
|
||||
if (!have_shown_about_streamfx()) {
|
||||
|
|
Loading…
Reference in a new issue