// Save button
QToolButton *const save_button = new QToolButton(this);
+ vector<QAction *> open_actions;
+ open_actions.push_back(main_window.action_save_as());
+
widgets::ExportMenu *export_menu = new widgets::ExportMenu(this,
session.device_manager().context(),
- main_window.action_save_as());
+ open_actions);
connect(export_menu,
SIGNAL(format_selected(std::shared_ptr<sigrok::OutputFormat>)),
&main_window_,
namespace widgets {
ExportMenu::ExportMenu(QWidget *parent, shared_ptr<Context> context,
- QAction *open_action) :
+ std::vector<QAction *>open_actions) :
QMenu(parent),
context_(context),
mapper_(this)
{
assert(context);
- if (open_action) {
- addAction(open_action);
- setDefaultAction(open_action);
+ if (!open_actions.empty()) {
+ bool first_action = true;
+ for (auto open_action : open_actions) {
+ addAction(open_action);
+
+ if (first_action) {
+ first_action = false;
+ setDefaultAction(open_action);
+ }
+ }
addSeparator();
}
public:
ExportMenu(QWidget *parent, std::shared_ptr<sigrok::Context> context,
- QAction *open_action = nullptr);
+ std::vector<QAction *>open_actions = std::vector<QAction *>());
private Q_SLOTS:
void on_action(QObject *action);