fixed effect context menu linking

This commit is contained in:
itsmattkc
2019-03-17 08:48:07 +11:00
parent 918ab6132d
commit 789b751935
3 changed files with 91 additions and 65 deletions
+21 -5
View File
@@ -289,23 +289,39 @@ void EffectUI::show_context_menu(const QPoint& pos) {
menu.addSeparator();
QAction* move_up_action = nullptr;
QAction* move_down_action = nullptr;
if (index > 0) {
menu.addAction(tr("Move &Up"), this, SLOT(move_up()));
move_up_action = menu.addAction(tr("Move &Up"), GetEffect(), SLOT(move_up()));
}
if (index < c->effects.size() - 1) {
menu.addAction(tr("Move &Down"), this, SLOT(move_down()));
move_down_action = menu.addAction(tr("Move &Down"), GetEffect(), SLOT(move_down()));
}
menu.addSeparator();
menu.addAction(tr("D&elete"), this, SLOT(delete_self()));
QAction* delete_action = menu.addAction(tr("D&elete"), GetEffect(), SLOT(delete_self()));
// Loop through additional effects and link these too
for (int i=0;i<additional_effects_.size();i++) {
if (move_up_action != nullptr) {
connect(move_up_action, SIGNAL(triggered(bool)), additional_effects_.at(i), SLOT(move_up()));
}
if (move_down_action != nullptr) {
connect(move_down_action, SIGNAL(triggered(bool)), additional_effects_.at(i), SLOT(move_down()));
}
connect(delete_action, SIGNAL(triggered(bool)), additional_effects_.at(i), SLOT(delete_self()));
}
menu.addSeparator();
menu.addAction(tr("Load Settings From File"), this, SLOT(load_from_file()));
menu.addAction(tr("Load Settings From File"), GetEffect(), SLOT(load_from_file()));
menu.addAction(tr("Save Settings to File"), this, SLOT(save_to_file()));
menu.addAction(tr("Save Settings to File"), GetEffect(), SLOT(save_to_file()));
menu.exec(title_bar->mapToGlobal(pos));
}