BornAgain  1.19.0
Simulate and fit neutron and x-ray scattering at grazing incidence
InstrumentViewToolBar.cpp
Go to the documentation of this file.
1 // ************************************************************************************************
2 //
3 // BornAgain: simulate and fit reflection and scattering
4 //
5 //! @file GUI/coregui/Views/InstrumentWidgets/InstrumentViewToolBar.cpp
6 //! @brief Implements class InstrumentViewToolBar
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 
17 #include <QMenu>
18 #include <QToolButton>
19 
21  : StyledToolBar(parent)
22  , m_addInstrumentButton(new QToolButton)
23  , m_removeInstrumentButton(new QToolButton)
24  , m_cloneInstrumentButton(new QToolButton)
25  , m_addInstrumentMenu(actions->instrumentMenu())
26 {
27  m_addInstrumentButton->setText("Add");
28  m_addInstrumentButton->setIcon(QIcon(":/images/shape-square-plus.svg"));
29  m_addInstrumentButton->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
30  m_addInstrumentButton->setToolTip("Add new instrument");
31  m_addInstrumentButton->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
32  m_addInstrumentButton->setPopupMode(QToolButton::MenuButtonPopup);
34  addWidget(m_addInstrumentButton);
35 
36  m_removeInstrumentButton->setText("Remove");
37  m_removeInstrumentButton->setIcon(QIcon(":/images/delete.svg"));
38  m_removeInstrumentButton->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
39  m_removeInstrumentButton->setToolTip("Remove currently selected instrument");
40  addWidget(m_removeInstrumentButton);
41 
42  m_cloneInstrumentButton->setText("Clone");
43  m_cloneInstrumentButton->setIcon(QIcon(":/images/content-copy.svg"));
44  m_cloneInstrumentButton->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
45  m_cloneInstrumentButton->setToolTip("Clone currently selected instrument");
46  addWidget(m_cloneInstrumentButton);
47 
48  connect(m_addInstrumentButton, &QToolButton::clicked, this,
50  connect(m_removeInstrumentButton, &QToolButton::clicked, actions,
52  connect(m_cloneInstrumentButton, &QToolButton::clicked, actions,
54 }
55 
57 {
58  m_addInstrumentMenu->defaultAction()->triggered();
59 }
Defines class InstrumentViewActions.
Defines class InstrumentViewToolBar.
Collection of actions to add/remove/clone instrument.
void onRemoveInstrument()
Removes currently selected instrument.
void onCloneInstrument()
Clones currently selected instrument.
QToolButton * m_cloneInstrumentButton
QToolButton * m_removeInstrumentButton
InstrumentViewToolBar(InstrumentViewActions *actions, QWidget *parent=nullptr)
QToolButton * m_addInstrumentButton
The StyledToolBar class represents our standard narrow toolbar with the height 24 pixels.
Definition: StyledToolBar.h:22