BornAgain  1.19.0
Simulate and fit neutron and x-ray scattering at grazing incidence
TableContextMenu.cpp
Go to the documentation of this file.
1 // ************************************************************************************************
2 //
3 // BornAgain: simulate and fit reflection and scattering
4 //
5 //! @file GUI/coregui/Views/ImportDataWidgets/CsvImportAssistant/TableContextMenu.cpp
6 //! @brief Implements class TableContextMenu
7 //!
8 //! @homepage http://www.bornagainproject.org
9 //! @license GNU General Public License v3 or higher (see COPYING)
10 //! @copyright Forschungszentrum Jülich GmbH 2018
11 //! @authors Scientific Computing Group at MLZ (see CITATION, AUTHORS)
12 //
13 // ************************************************************************************************
14 
16 
18  : QMenu(parent)
19  , m_coordSubMenu(this)
20  , m_selectFromThisRowOn(new QAction("Set As First Data Row", this))
21  , m_selectUntilThisRow(new QAction("Set As Last Data Row", this))
22  , m_resetAction(new QAction("Reset", this))
23  , m_setAsTheta(new QAction(csv::HeaderLabels[csv::_theta_], this))
24  , m_setAsQ(new QAction(csv::HeaderLabels[csv::_q_], this))
25  , m_setAsIntensity(
26  new QAction("Set As " + csv::HeaderLabels[csv::_intensity_] + " Column", this))
27  , m_discardRow(new QAction("Toogle Discard Selected Rows", this))
28 {
29  this->addAction(m_selectFromThisRowOn);
30  this->addAction(m_selectUntilThisRow);
31  this->addAction(m_discardRow);
32 
33  this->addSeparator();
34  this->addAction(m_setAsIntensity);
35 
36  m_coordSubMenu = this->addMenu("Set As Coordinate Column...");
37  m_coordSubMenu->addAction(m_setAsTheta);
38  m_coordSubMenu->addAction(m_setAsQ);
39 
40  this->addSeparator();
41  this->addAction(m_resetAction);
42 
43  connect(m_selectFromThisRowOn, &QAction::triggered, this, [this]() { emit setFirstRow(); });
44  connect(m_selectUntilThisRow, &QAction::triggered, this, [this]() { emit setLastRow(); });
45  connect(m_setAsIntensity, &QAction::triggered, this,
46  [this]() { emit setColumnAs(csv::_intensity_); });
47  connect(m_setAsTheta, &QAction::triggered, this, [this]() { emit setColumnAs(csv::_theta_); });
48  connect(m_setAsQ, &QAction::triggered, this, [this]() { emit setColumnAs(csv::_q_); });
49  connect(m_resetAction, &QAction::triggered, this, [this]() { emit resetTable(); });
50  connect(m_discardRow, &QAction::triggered, this, [this]() { emit discardRow(); });
51 }
Defines class TableContextMenu.
QAction * m_selectFromThisRowOn
QAction * m_setAsIntensity
TableContextMenu(QWidget *parent=nullptr)
QAction * m_discardRow
QAction * m_setAsTheta
void setColumnAs(csv::ColumnType)
QAction * m_resetAction
QAction * m_selectUntilThisRow
@ _q_
Definition: CsvNamespace.h:23
@ _theta_
Definition: CsvNamespace.h:23
@ _intensity_
Definition: CsvNamespace.h:23
const QStringList HeaderLabels
Definition: CsvNamespace.h:24