BornAgain  1.19.0
Simulate and fit neutron and x-ray scattering at grazing incidence
ViewModelDelegateTest::TestData Struct Reference
Collaboration diagram for ViewModelDelegateTest::TestData:
[legend]

Public Member Functions

 TestData ()
 
std::unique_ptr< CustomEditorcreate_editor (const QModelIndex &index)
 
void map_to_index (QWidget *widget, const QModelIndex &index)
 

Public Attributes

ViewModelDelegate delegate
 
QDataWidgetMapper mapper
 
SessionModel model {}
 
DefaultViewModel view_model
 

Detailed Description

Definition at line 34 of file viewmodeldelegate.test.cpp.

Constructor & Destructor Documentation

◆ TestData()

ViewModelDelegateTest::TestData::TestData ( )
inline

Definition at line 40 of file viewmodeldelegate.test.cpp.

40  : view_model(&model)
41  {
42  mapper.setModel(&view_model);
43  mapper.setItemDelegate(&delegate);
44  }

Member Function Documentation

◆ create_editor()

std::unique_ptr<CustomEditor> ViewModelDelegateTest::TestData::create_editor ( const QModelIndex &  index)
inline

Definition at line 46 of file viewmodeldelegate.test.cpp.

47  {
48  return std::unique_ptr<CustomEditor>(dynamic_cast<CustomEditor*>(
49  delegate.createEditor(nullptr, QStyleOptionViewItem(), index)));
50  }
Base class for all custom variant editors.
Definition: customeditor.h:26
QWidget * createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const override

References ModelView::ViewModelDelegate::createEditor().

Here is the call graph for this function:

◆ map_to_index()

void ViewModelDelegateTest::TestData::map_to_index ( QWidget *  widget,
const QModelIndex &  index 
)
inline

Definition at line 52 of file viewmodeldelegate.test.cpp.

53  {
54  mapper.setRootIndex(index.parent());
55  mapper.setCurrentModelIndex(index.sibling(index.row(), 0));
56  mapper.addMapping(widget, 1);
57  }

Member Data Documentation

◆ delegate

ViewModelDelegate ViewModelDelegateTest::TestData::delegate

Definition at line 37 of file viewmodeldelegate.test.cpp.

◆ mapper

QDataWidgetMapper ViewModelDelegateTest::TestData::mapper

Definition at line 38 of file viewmodeldelegate.test.cpp.

◆ model

SessionModel ViewModelDelegateTest::TestData::model {}

Definition at line 35 of file viewmodeldelegate.test.cpp.

◆ view_model

DefaultViewModel ViewModelDelegateTest::TestData::view_model

Definition at line 36 of file viewmodeldelegate.test.cpp.


The documentation for this struct was generated from the following file: