Skip to content
Snippets Groups Projects
Commit c31cadca authored by Wuttke, Joachim's avatar Wuttke, Joachim
Browse files

new... actions made local

parent 625c5815
No related branches found
No related tags found
1 merge request!2387unify code for list views
......@@ -76,22 +76,6 @@ FrameActions::FrameActions()
cycle_data2d_edit_mode->setIcon(QIcon(":/images/sprocket3.svg"));
cycle_data2d_edit_mode->setToolTip("Cycle data 2d edit mode: Data, Mask, Projection");
new_gisas_instrument = new QAction("New GISAS");
new_gisas_instrument->setIcon(QIcon(":/images/shape-square-plus.svg"));
new_gisas_instrument->setToolTip("Add new GISAS instrument with default settings");
new_offspec_instrument = new QAction("New off-specular");
new_offspec_instrument->setIcon(QIcon(":/images/shape-square-plus.svg"));
new_offspec_instrument->setToolTip("Add new off-specular instrument with default settings");
new_specular_instrument = new QAction("New specular");
new_specular_instrument->setIcon(QIcon(":/images/shape-square-plus.svg"));
new_specular_instrument->setToolTip("Add new specular instrument with default settings");
new_depthprobe_instrument = new QAction("New depth probe");
new_depthprobe_instrument->setIcon(QIcon(":/images/shape-square-plus.svg"));
new_depthprobe_instrument->setToolTip("Add new depth probe instrument with default settings");
remove_instrument = ActionFactory::createRemoveAction("instrument");
copy_instrument = ActionFactory::createCopyAction("instrument");
......
......@@ -46,10 +46,6 @@ public:
QAction* cycle_data2d_edit_mode;
QAction* new_gisas_instrument;
QAction* new_offspec_instrument;
QAction* new_specular_instrument;
QAction* new_depthprobe_instrument;
QAction* remove_instrument;
QAction* copy_instrument;
QAction* store_in_library_instrument;
......
......@@ -45,10 +45,26 @@ InstrumentView::InstrumentView()
layout->addWidget(toolbar);
toolbar->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
toolbar->addAction(gActions->new_gisas_instrument);
toolbar->addAction(gActions->new_offspec_instrument);
toolbar->addAction(gActions->new_specular_instrument);
toolbar->addAction(gActions->new_depthprobe_instrument);
auto new_action = [toolbar](const QString& name, const QString& description) {
QAction* a = new QAction("New " + name);
a->setIcon(QIcon(":/images/shape-square-plus.svg"));
a->setToolTip("Add new " + description + " instrument with default settings");
toolbar->addAction(a);
return a;
};
connect(new_action("GISAS", "2D scattering"), &QAction::triggered,
[this] { m_qlistmodel->pushInstrument(new Scatter2DInstrumentItem); });
connect(new_action("offspec", "off-specular"), &QAction::triggered,
[this] { m_qlistmodel->pushInstrument(new OffspecInstrumentItem); });
connect(new_action("specular", "specular reflectivity"), &QAction::triggered,
[this] { m_qlistmodel->pushInstrument(new SpecularInstrumentItem); });
connect(new_action("depthprobe", "depth intensity profile"), &QAction::triggered,
[this] { m_qlistmodel->pushInstrument(new DepthprobeInstrumentItem); });
toolbar->addAction(gActions->remove_instrument);
toolbar->addAction(gActions->copy_instrument);
toolbar->addAction(gActions->store_in_library_instrument);
......@@ -74,18 +90,6 @@ InstrumentView::InstrumentView()
//... Finalize
connect(gActions->new_gisas_instrument, &QAction::triggered,
[this] { m_qlistmodel->pushInstrument(new Scatter2DInstrumentItem); });
connect(gActions->new_offspec_instrument, &QAction::triggered,
[this] { m_qlistmodel->pushInstrument(new OffspecInstrumentItem); });
connect(gActions->new_specular_instrument, &QAction::triggered,
[this] { m_qlistmodel->pushInstrument(new SpecularInstrumentItem); });
connect(gActions->new_depthprobe_instrument, &QAction::triggered,
[this] { m_qlistmodel->pushInstrument(new DepthprobeInstrumentItem); });
connect(gActions->remove_instrument, &QAction::triggered, m_qlistmodel,
&InstrumentsQModel::removeInstrument);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment