Don't use lambda in addAction() for travis

This commit is contained in:
Maxime Gimeno 2018-01-19 09:22:52 +01:00
parent 6fa6b2afdd
commit e920af7e06
2 changed files with 23 additions and 17 deletions

View File

@ -1343,23 +1343,8 @@ void MainWindow::showSceneContextMenu(const QPoint& p) {
QMenu menu;
Q_FOREACH(QString name, menu_actions.keys())
{
menu.addAction(name,
[this, name]()
{
Q_FOREACH(Scene::Item_id id, scene->selectionIndices())
{
Scene_item* item = scene->item(id);
Q_FOREACH(QAction* action, item->contextMenu()->actions())
{
if(action->text() == name)
{
action->trigger();
break;
}
}
}
}
);
QAction* action = menu.addAction(name);
connect(action, &QAction::triggered, this, &MainWindow::propagate_action);
}
QAction* reload = menu.addAction(tr("&Reload Item from File"));
@ -2152,3 +2137,22 @@ void MainWindow::exportStatistics()
outStream << str;
output.close();
}
void MainWindow::propagate_action()
{
QAction* sender = qobject_cast<QAction*>(this->sender());
if(!sender) return;
QString name = sender->text();
Q_FOREACH(Scene::Item_id id, scene->selectionIndices())
{
Scene_item* item = scene->item(id);
Q_FOREACH(QAction* action, item->contextMenu()->actions())
{
if(action->text() == name)
{
action->trigger();
break;
}
}
}
}

View File

@ -354,6 +354,8 @@ protected Q_SLOTS:
void on_actionRecenterScene_triggered();
//!Resizes the header of the scene view
void resetHeader();
//!apply an action named `name` to all selected items
void propagate_action();
protected:
QList<QAction*> createSubMenus(QList<QAction*>);
/*! For each objects in the Geometric Objects view, loads the associated plugins.