BornAgain  1.19.79
Simulate and fit neutron and x-ray scattering at grazing incidence
ImportDataView.cpp
Go to the documentation of this file.
1 // ************************************************************************************************
2 //
3 // BornAgain: simulate and fit reflection and scattering
4 //
5 //! @file GUI/View/Import/ImportDataView.cpp
6 //! @brief Implements class ImportDataView
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 
21 #include <QAction>
22 #include <QSplitter>
23 #include <QVBoxLayout>
24 
25 namespace {
26 
27 const bool reuse_widget = true;
28 }
29 
31  : QWidget(parent)
32  , m_selectorWidget(new RealDataSelectorWidget(this, document))
33  , m_stackedWidget(new ItemStackPresenter<RealDataPresenter>(reuse_widget))
34  , m_document(document)
35 {
36  auto* mainLayout = new QVBoxLayout;
37  mainLayout->setMargin(0);
38  mainLayout->setSpacing(0);
39  mainLayout->setContentsMargins(0, 0, 0, 0);
40 
41  m_stackedWidget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
42  m_selectorWidget->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Expanding);
43  m_stackedWidget->setSizeHint(QSize(1024, 1024));
44 
45  auto* splitter = new QSplitter;
46  splitter->addWidget(m_selectorWidget);
47  splitter->addWidget(m_stackedWidget);
48  splitter->setCollapsible(0, false);
49  splitter->setCollapsible(1, false);
50 
51  splitter->setSizes(QList<int>() << GUI::Constants::ITEM_SELECTOR_WIDGET_WIDTH
53 
54  mainLayout->addWidget(splitter);
55 
56  setLayout(mainLayout);
57 
59 
62 
63  connect(m_document, &ProjectDocument::modified, this,
65 
67 
70 }
71 
73 {
74  m_stackedWidget->setItem(item);
75 }
76 
78 {
81 
86 }
Defines class ImportDataView.
Defines class ProjectDocument.
Defines class RealDataItem.
Defines class RealDataModel.
Defines class RealDataSelectorWidget.
void updateFunctionalityNarrowing()
Show/hide UI elements according to settings in current project.
RealDataSelectorWidget * m_selectorWidget
ItemStackPresenter< RealDataPresenter > * m_stackedWidget
void onSelectionChanged(RealDataItem *item)
ProjectDocument * m_document
ImportDataView(QWidget *parent, ProjectDocument *document)
The ItemStackPresenter templated class extends ItemStackWidget so it could operate with SesionItem ed...
void setItem(U *item, bool *isNew=nullptr)
Shows the widget for given item (and hides previous one). If no widget yet exists,...
void setModel(SessionModel *model)
void setSizeHint(const QSize &size_hint)
Project document class handles all data related to the opened project (sample, job,...
RealDataModel * realDataModel() const
Functionalities functionalities() const
void modified()
Emitted for any modifications in the document.
Provides access to experimental data, for display and fitting. Owns an AbstractDataLoader.
Definition: RealDataItem.h:33
Presents imported data (RealDataItem) using stack of different widgets and combo box in the right top...
The RealDataSelectorWidget represents left panel of ImportDataView. Contains a tree to select data se...
void selectionChanged(RealDataItem *)
Defines namespace GUI::Constants.
const unsigned int ITEM_SELECTOR_WIDGET_WIDTH