BornAgain  1.19.0
Simulate and fit neutron and x-ray scattering at grazing incidence
ModelView::Factory Namespace Reference

Functions

template<typename ChildrenStrategy , typename RowStrategy >
std::unique_ptr< ViewModelControllerCreateController (SessionModel *session_model, ViewModelBase *view_model)
 Create universal controller. More...
 
MVVM_VIEWMODEL_EXPORT std::unique_ptr< ViewModelCreateDefaultViewModel (SessionModel *model)
 Creates view model to represent SessionModel for Qt views. More...
 
MVVM_VIEWMODEL_EXPORT std::unique_ptr< ViewModelCreatePropertyFlatViewModel (SessionModel *model)
 Creates view model to represent SessionModel for Qt views. More...
 
MVVM_VIEWMODEL_EXPORT std::unique_ptr< ViewModelCreatePropertyTableViewModel (SessionModel *model)
 Creates view model to represent SessionModel for Qt views. More...
 
MVVM_VIEWMODEL_EXPORT std::unique_ptr< ViewModelCreatePropertyViewModel (SessionModel *model)
 Creates view model to represent SessionModel for Qt views. More...
 
MVVM_VIEWMODEL_EXPORT std::unique_ptr< ViewModelCreateTopItemsViewModel (SessionModel *model)
 Creates view model to represent SessionModel for Qt views. More...
 
template<typename ChildrenStrategy , typename RowStrategy >
std::unique_ptr< ViewModelCreateViewModel (SessionModel *session_model)
 Creates view model to represent SessionModel for Qt views. More...
 
template<typename ViewModelController >
std::unique_ptr< ViewModelCreateViewModel (SessionModel *session_model)
 Creates view model to represent SessionModel for Qt views. More...
 

Function Documentation

◆ CreateController()

template<typename ChildrenStrategy , typename RowStrategy >
std::unique_ptr<ViewModelController> ModelView::Factory::CreateController ( SessionModel session_model,
ViewModelBase view_model 
)

Create universal controller.

Definition at line 33 of file viewmodelcontrollerfactory.h.

35 {
36  return ViewModelControllerBuilder()
37  .model(session_model)
38  .viewModel(view_model)
39  .childrenStrategy(std::make_unique<ChildrenStrategy>())
40  .rowStrategy(std::make_unique<RowStrategy>());
41 }

References ModelView::ViewModelControllerBuilder::childrenStrategy(), ModelView::ViewModelControllerBuilder::model(), ModelView::ViewModelControllerBuilder::rowStrategy(), and ModelView::ViewModelControllerBuilder::viewModel().

Here is the call graph for this function:

◆ CreateDefaultViewModel()

std::unique_ptr< ViewModel > ModelView::Factory::CreateDefaultViewModel ( ModelView::SessionModel model)

Creates view model to represent SessionModel for Qt views.

The model has two columns, all items are shown.

Definition at line 24 of file viewmodelfactory.cpp.

25 {
26  return std::make_unique<DefaultViewModel>(model);
27 }

Referenced by ModelView::AllItemsTreeView::AllItemsTreeView().

◆ CreatePropertyFlatViewModel()

std::unique_ptr< ViewModel > ModelView::Factory::CreatePropertyFlatViewModel ( SessionModel model)

Creates view model to represent SessionModel for Qt views.

The model has two columns, shows only property items and simplified group items. Subproperties of group item moved one level up.

Definition at line 44 of file viewmodelfactory.cpp.

45 {
46  return std::make_unique<PropertyFlatViewModel>(model);
47 }

Referenced by ModelView::PropertyFlatView::setItem().

◆ CreatePropertyTableViewModel()

std::unique_ptr< ViewModel > ModelView::Factory::CreatePropertyTableViewModel ( SessionModel model)

Creates view model to represent SessionModel for Qt views.

Shows all properties of CompoundItem in columns of the table, rows of the table represent different CompoundItems. Items of same type and table like structure of the model are expected.

Definition at line 34 of file viewmodelfactory.cpp.

35 {
36  return std::make_unique<PropertyTableViewModel>(model);
37 }

Referenced by gui2::MaterialEditorWidget::setModels().

◆ CreatePropertyViewModel()

std::unique_ptr< ViewModel > ModelView::Factory::CreatePropertyViewModel ( SessionModel model)

Creates view model to represent SessionModel for Qt views.

The model has two columns, shows only property items and simplified group items.

Definition at line 29 of file viewmodelfactory.cpp.

30 {
31  return std::make_unique<PropertyViewModel>(model);
32 }

Referenced by ModelView::PropertyTreeView::setItem().

◆ CreateTopItemsViewModel()

std::unique_ptr< ViewModel > ModelView::Factory::CreateTopItemsViewModel ( SessionModel model)

Creates view model to represent SessionModel for Qt views.

Shows only top items.

Definition at line 39 of file viewmodelfactory.cpp.

40 {
41  return std::make_unique<TopItemsViewModel>(model);
42 }

Referenced by ModelView::TopItemsTreeView::TopItemsTreeView().

◆ CreateViewModel() [1/2]

template<typename ChildrenStrategy , typename RowStrategy >
std::unique_ptr<ViewModel> ModelView::Factory::CreateViewModel ( SessionModel session_model)

Creates view model to represent SessionModel for Qt views.

Use user provided types for ChildrenStrategy and RowStrategy.

Definition at line 55 of file viewmodelfactory.h.

56 {
57  auto controller = CreateController<ChildrenStrategy, RowStrategy>(session_model, nullptr);
58  return std::make_unique<ViewModel>(std::move(controller));
59 }

◆ CreateViewModel() [2/2]

template<typename ViewModelController >
std::unique_ptr<ViewModel> ModelView::Factory::CreateViewModel ( SessionModel session_model)

Creates view model to represent SessionModel for Qt views.

Use user provided controller type.

Definition at line 64 of file viewmodelfactory.h.

65 {
66  auto controller = std::make_unique<ViewModelController>(session_model);
67  return std::make_unique<ViewModel>(std::move(controller));
68 }