BornAgain  1.19.0
Simulate and fit neutron and x-ray scattering at grazing incidence
gui2::CustomBeamPropertyEditorFactory Class Reference

Custom editor factory for LayerTreeView. More...

Inheritance diagram for gui2::CustomBeamPropertyEditorFactory:
[legend]
Collaboration diagram for gui2::CustomBeamPropertyEditorFactory:
[legend]

Public Member Functions

 CustomBeamPropertyEditorFactory (ApplicationModels *models)
 
 ~CustomBeamPropertyEditorFactory ()
 
std::unique_ptr< ModelView::CustomEditorcreateEditor (const QModelIndex &index) const
 

Private Attributes

ApplicationModelsm_models {nullptr}
 
std::unique_ptr< RoleDependentEditorFactorym_roleDependentFactory
 
std::unique_ptr< VariantDependentEditorFactorym_variantDependentFactory
 

Detailed Description

Custom editor factory for LayerTreeView.

Substitutes default ExternalProperty editor with custom one, which will offer the choice between all defined materials.

Definition at line 28 of file custombeampropertyeditorfactory.h.

Constructor & Destructor Documentation

◆ CustomBeamPropertyEditorFactory()

gui2::CustomBeamPropertyEditorFactory::CustomBeamPropertyEditorFactory ( ApplicationModels models)

Definition at line 48 of file custombeampropertyeditorfactory.cpp.

49  : m_models(models)
50 {
51 }

◆ ~CustomBeamPropertyEditorFactory()

gui2::CustomBeamPropertyEditorFactory::~CustomBeamPropertyEditorFactory ( )
default

Member Function Documentation

◆ createEditor()

std::unique_ptr< CustomEditor > gui2::CustomBeamPropertyEditorFactory::createEditor ( const QModelIndex &  index) const
virtual

Implements ModelView::EditorFactoryInterface.

Definition at line 54 of file custombeampropertyeditorfactory.cpp.

55 {
56  auto value = index.data(Qt::EditRole);
58  auto choice_callback = [this]() {
59  return available_graph_properties(m_models->experimentalDataModel());
60  };
61  return std::make_unique<ExternalPropertyComboEditor>(choice_callback);
62  } else {
64  }
65 }
std::unique_ptr< CustomEditor > createEditor(const QModelIndex &index) const override
Creates editor for given model index basing either on editorType() or specific variant name.
ExperimentalDataModel * experimentalDataModel()
MVVM_MODEL_EXPORT bool IsExtPropertyVariant(const Variant &variant)
Returns true in the case of ExternalProperty based variant.

References ModelView::DefaultEditorFactory::createEditor(), gui2::ApplicationModels::experimentalDataModel(), ModelView::Utils::IsExtPropertyVariant(), and m_models.

Here is the call graph for this function:

Member Data Documentation

◆ m_models

ApplicationModels* gui2::CustomBeamPropertyEditorFactory::m_models {nullptr}
private

Definition at line 36 of file custombeampropertyeditorfactory.h.

Referenced by createEditor().

◆ m_roleDependentFactory

std::unique_ptr<RoleDependentEditorFactory> ModelView::DefaultEditorFactory::m_roleDependentFactory
privateinherited

◆ m_variantDependentFactory

std::unique_ptr<VariantDependentEditorFactory> ModelView::DefaultEditorFactory::m_variantDependentFactory
privateinherited

The documentation for this class was generated from the following files: