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

Default editor factory for cell editors in Qt trees and tables. More...

Inheritance diagram for ModelView::DefaultEditorFactory:
[legend]
Collaboration diagram for ModelView::DefaultEditorFactory:
[legend]

Public Member Functions

 DefaultEditorFactory ()
 
std::unique_ptr< CustomEditorcreateEditor (const QModelIndex &index) const override
 Creates editor for given model index basing either on editorType() or specific variant name. More...
 

Private Attributes

std::unique_ptr< RoleDependentEditorFactorym_roleDependentFactory
 
std::unique_ptr< VariantDependentEditorFactorym_variantDependentFactory
 

Detailed Description

Default editor factory for cell editors in Qt trees and tables.

Internaly it uses two factories

Definition at line 66 of file defaulteditorfactory.h.

Constructor & Destructor Documentation

◆ DefaultEditorFactory()

DefaultEditorFactory::DefaultEditorFactory ( )

Definition at line 116 of file defaulteditorfactory.cpp.

117  : m_roleDependentFactory(std::make_unique<RoleDependentEditorFactory>())
118  , m_variantDependentFactory(std::make_unique<VariantDependentEditorFactory>())
119 {
120 }
std::unique_ptr< RoleDependentEditorFactory > m_roleDependentFactory
std::unique_ptr< VariantDependentEditorFactory > m_variantDependentFactory

Member Function Documentation

◆ createEditor()

std::unique_ptr< CustomEditor > DefaultEditorFactory::createEditor ( const QModelIndex &  index) const
overridevirtual

Creates editor for given model index basing either on editorType() or specific variant name.

Implements ModelView::EditorFactoryInterface.

Definition at line 124 of file defaulteditorfactory.cpp.

125 {
126  // trying to created an editor basing on possibly defined EDITOR role
127  auto editor = m_roleDependentFactory->createEditor(index);
128  // if we do not succeed, then creating editor from variant type
129  return editor ? std::move(editor) : m_variantDependentFactory->createEditor(index);
130 }
std::unique_ptr< CustomEditor > createEditor(const QModelIndex &index) const override
Creates editor for given model index basing either on editorType() or specific variant name.

References m_roleDependentFactory, and m_variantDependentFactory.

Referenced by gui2::CustomLayerTreeEditorFactory::createEditor(), and gui2::CustomBeamPropertyEditorFactory::createEditor().

Member Data Documentation

◆ m_roleDependentFactory

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

Definition at line 73 of file defaulteditorfactory.h.

Referenced by createEditor().

◆ m_variantDependentFactory

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

Definition at line 74 of file defaulteditorfactory.h.

Referenced by createEditor().


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