BornAgain  1.19.0
Simulate and fit neutron and x-ray scattering at grazing incidence
materialeditorwidget.cpp
Go to the documentation of this file.
1 // ************************************************************************************************
2 //
3 // BornAgain: simulate and fit reflection and scattering
4 //
5 //! @file gui2/materialeditor/materialeditorwidget.cpp
6 //! @brief Implements class CLASS?
7 //!
8 //! @homepage http://www.bornagainproject.org
9 //! @license GNU General Public License v3 or higher (see COPYING)
10 //! @copyright Forschungszentrum Jülich GmbH 2020
11 //! @authors Scientific Computing Group at MLZ (see CITATION, AUTHORS)
12 //
13 // ************************************************************************************************
14 
23 #include "mvvm/model/modelutils.h"
25 #include <QVBoxLayout>
26 
27 namespace gui2 {
28 
30  : QWidget(parent)
31  , m_materialView(new MaterialTreeView)
32  , m_delegate(std::make_unique<ModelView::ViewModelDelegate>())
33 {
34  auto layout = new QVBoxLayout;
35  layout->setContentsMargins(0, 0, 0, 0);
36  layout->addWidget(m_materialView);
37  setLayout(layout);
38  m_materialView->setItemDelegate(m_delegate.get());
39 }
40 
42 
44 {
45  m_materialModel = models->materialModel();
48  m_viewModel->setRootSessionItem(
49  ModelView::Utils::TopItem<MaterialContainerItem>(m_materialModel));
51  m_materialView->setSelectionModel(m_selectionModel);
52 }
53 
55 {
56  return m_selectionModel;
57 }
58 
59 } // namespace gui2
Defines class CLASS?
Model delegate to provide editing/painting for custom variants.
Main class to holds all models of GUI session.
MaterialModel * materialModel()
MaterialTreeView * m_materialView
MaterialEditorWidget(QWidget *parent=nullptr)
std::unique_ptr< ModelView::ViewModelDelegate > m_delegate
MaterialSelectionModel * selectionModel() const
MaterialSelectionModel * m_selectionModel
void setModels(ApplicationModels *models)
std::unique_ptr< ModelView::ViewModel > m_viewModel
Custom selection model for material view model (AbstractViewModel).
Extension of QTreeView for material editing.
void setModel(QAbstractItemModel *model) override
Defines class CLASS?
Defines class CLASS?
Defines class CLASS?
Defines class CLASS?
Defines class CLASS?
Defines class CLASS?
Defines class CLASS?
MVVM_VIEWMODEL_EXPORT std::unique_ptr< ViewModel > CreatePropertyTableViewModel(SessionModel *model)
Creates view model to represent SessionModel for Qt views.
materialitems.h Collection of materials to populate MaterialModel.
Based on Qt example "codeeditor" Copyright (C) 2016 The Qt Company Ltd.
Definition: app_constants.h:20
Definition: filesystem.h:81
Defines class CLASS?
Defines class CLASS?