BornAgain  1.19.0
Simulate and fit neutron and x-ray scattering at grazing incidence
InstrumentView.cpp
Go to the documentation of this file.
1 // ************************************************************************************************
2 //
3 // BornAgain: simulate and fit reflection and scattering
4 //
5 //! @file GUI/coregui/Views/InstrumentView.cpp
6 //! @brief Implements class InstrumentView
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 
23 #include <QBoxLayout>
24 
26  : QWidget(mainWindow)
27  , m_actions(new InstrumentViewActions(this))
28  , m_toolBar(new InstrumentViewToolBar(m_actions, this))
29  , m_instrumentSelector(new InstrumentSelectorWidget)
30  , m_instrumentEditor(new ItemStackPresenter<InstrumentEditorWidget>(true))
31  , m_instrumentModel(mainWindow->instrumentModel())
32 {
33  auto horizontalLayout = new QHBoxLayout;
34  horizontalLayout->addWidget(m_instrumentSelector);
35  horizontalLayout->addWidget(m_instrumentEditor, 1);
36 
37  auto mainLayout = new QVBoxLayout;
38  mainLayout->setMargin(0);
39  mainLayout->setSpacing(0);
40  mainLayout->addWidget(m_toolBar);
41  mainLayout->addLayout(horizontalLayout);
42  setLayout(mainLayout);
43 
47 
50 
53 }
54 
56 {
57  auto dialog = new ExtendedDetectorDialog(this);
58  dialog->setDetectorContext(m_instrumentModel, detectorItem);
59  dialog->show();
60 }
61 
63 {
64  m_instrumentEditor->setItem(instrumentItem);
65 }
66 
67 void InstrumentView::showEvent(QShowEvent*)
68 {
70 }
Defines class DistributionDialog.
Defines class MainWindow.
Defines class InstrumentEditorWidget.
Defines class InstrumentModel.
Defines class InstrumentSelectorWidget.
Defines class InstrumentViewActions.
Defines class InstrumentViewToolBar.
Defines class InstrumentView.
The dialog which shows a MaskEditor.
Main widget of InstrumentView.
Instrument selector on the left side of InstrumentView.
Collection of actions to add/remove/clone instrument.
void onContextMenuRequest(const QPoint &point, const QModelIndex &indexAtPoint)
void setModel(SessionModel *model)
void setSelectionModel(QItemSelectionModel *selectionModel)
Styled tool bar on top of InstrumentView with add/remove/clone instrument buttons.
InstrumentViewToolBar * m_toolBar
void showEvent(QShowEvent *)
void onItemSelectionChanged(SessionItem *instrumentItem)
InstrumentModel * m_instrumentModel
InstrumentViewActions * m_actions
ItemStackPresenter< InstrumentEditorWidget > * m_instrumentEditor
InstrumentView(MainWindow *mainWindow)
InstrumentSelectorWidget * m_instrumentSelector
void onExtendedDetectorEditorRequest(DetectorItem *detectorItem)
QItemSelectionModel * selectionModel()
void contextMenuRequest(const QPoint &point, const QModelIndex &index)
void updateSelection()
select last item if no selection exists
void setModel(SessionModel *model)
void selectionChanged(SessionItem *item)
The ItemStackPresenter templated class extends ItemStackWidget so it could operate with SesionItem ed...
void setItem(U *item, bool *isNew=0)
Shows the widget for given item (and hides previous one).