mirror of
https://github.com/overte-org/overte.git
synced 2025-08-06 18:50:00 +02:00
Make sure that items added via plugins can be removed as well
This commit is contained in:
parent
ce781ba889
commit
9faf452196
1 changed files with 9 additions and 3 deletions
|
@ -4746,6 +4746,7 @@ static void addDisplayPluginToMenu(DisplayPluginPointer displayPlugin, bool acti
|
||||||
}
|
}
|
||||||
|
|
||||||
static QVector<QPair<QString, QString>> _currentDisplayPluginActions;
|
static QVector<QPair<QString, QString>> _currentDisplayPluginActions;
|
||||||
|
static bool _activatingDisplayPlugin{false};
|
||||||
|
|
||||||
void Application::updateDisplayMode() {
|
void Application::updateDisplayMode() {
|
||||||
auto menu = Menu::getInstance();
|
auto menu = Menu::getInstance();
|
||||||
|
@ -4792,7 +4793,9 @@ void Application::updateDisplayMode() {
|
||||||
|
|
||||||
if (newDisplayPlugin) {
|
if (newDisplayPlugin) {
|
||||||
_offscreenContext->makeCurrent();
|
_offscreenContext->makeCurrent();
|
||||||
|
_activatingDisplayPlugin = true;
|
||||||
newDisplayPlugin->activate();
|
newDisplayPlugin->activate();
|
||||||
|
_activatingDisplayPlugin = false;
|
||||||
_offscreenContext->makeCurrent();
|
_offscreenContext->makeCurrent();
|
||||||
offscreenUi->resize(fromGlm(newDisplayPlugin->getRecommendedUiSize()));
|
offscreenUi->resize(fromGlm(newDisplayPlugin->getRecommendedUiSize()));
|
||||||
_offscreenContext->makeCurrent();
|
_offscreenContext->makeCurrent();
|
||||||
|
@ -4909,14 +4912,17 @@ void Application::removeMenu(const QString& menuName) {
|
||||||
void Application::addMenuItem(const QString& path, const QString& name, std::function<void(bool)> onClicked, bool checkable, bool checked, const QString& groupName) {
|
void Application::addMenuItem(const QString& path, const QString& name, std::function<void(bool)> onClicked, bool checkable, bool checked, const QString& groupName) {
|
||||||
auto menu = Menu::getInstance();
|
auto menu = Menu::getInstance();
|
||||||
MenuWrapper* parentItem = menu->getMenu(path);
|
MenuWrapper* parentItem = menu->getMenu(path);
|
||||||
QAction* action = parentItem->addAction(name);
|
QAction* action = menu->addActionToQMenuAndActionHash(parentItem, name);
|
||||||
connect(action, &QAction::triggered, [=] {
|
connect(action, &QAction::triggered, [=] {
|
||||||
onClicked(action->isChecked());
|
onClicked(action->isChecked());
|
||||||
});
|
});
|
||||||
action->setCheckable(checkable);
|
action->setCheckable(checkable);
|
||||||
action->setChecked(checked);
|
action->setChecked(checked);
|
||||||
_currentDisplayPluginActions.push_back({ path, name });
|
if (_activatingDisplayPlugin) {
|
||||||
_currentInputPluginActions.push_back({ path, name });
|
_currentDisplayPluginActions.push_back({ path, name });
|
||||||
|
} else {
|
||||||
|
_currentInputPluginActions.push_back({ path, name });
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Application::removeMenuItem(const QString& menuName, const QString& menuItem) {
|
void Application::removeMenuItem(const QString& menuName, const QString& menuItem) {
|
||||||
|
|
Loading…
Reference in a new issue