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

Custom strategy to form table rows for nested multilayers and layers. More...

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

Public Member Functions

std::vector< std::unique_ptr< ViewItem > > constructRow (SessionItem *item)
 
QStringList horizontalHeaderLabels () const
 

Detailed Description

Custom strategy to form table rows for nested multilayers and layers.

Definition at line 28 of file layerviewmodelcontroller.cpp.

Member Function Documentation

◆ constructRow()

std::vector<std::unique_ptr<ViewItem> > gui2::CustomLayerRowStrategy::constructRow ( SessionItem item)
inlinevirtual

Implements ModelView::RowStrategyInterface.

Definition at line 39 of file layerviewmodelcontroller.cpp.

40  {
41  std::vector<std::unique_ptr<ViewItem>> result;
42 
43  // multilayer row contains its name, repetion and placeholders (instead of material and
44  // thickness)
45  if (auto multilayer = dynamic_cast<MultiLayerItem*>(item)) {
46  result.emplace_back(
47  std::make_unique<ViewDataItem>(multilayer->getItem(LayerItem::P_NAME)));
48  // result.push_back(new ViewLabelItem(multilayer));
49  result.emplace_back(std::make_unique<ViewDataItem>(
50  multilayer->getItem(MultiLayerItem::P_NREPETITIONS)));
51  result.emplace_back(std::make_unique<ViewEmptyItem>()); // instead of P_MATERIAL
52  result.emplace_back(std::make_unique<ViewEmptyItem>()); // instead of P_THICKNESS
53  result.emplace_back(std::make_unique<ViewEmptyItem>()); // instead of P_ROUGHNESS
54  }
55 
56  // layer row contains its name, placeholder for repetition, layer material and thickness
57  if (auto layer = dynamic_cast<LayerItem*>(item)) {
58  result.emplace_back(std::make_unique<ViewDataItem>(layer->getItem(LayerItem::P_NAME)));
59  // result.push_back(new ViewLabelItem(layer));
60  result.emplace_back(std::make_unique<ViewEmptyItem>()); // instead of P_NREPETITIONS
61  result.emplace_back(
62  std::make_unique<ViewDataItem>(layer->getItem(LayerItem::P_MATERIAL)));
63  result.emplace_back(
64  std::make_unique<ViewDataItem>(layer->getItem(LayerItem::P_THICKNESS)));
65  result.emplace_back(std::make_unique<ViewDataItem>(
66  layer->getItem(LayerItem::P_ROUGHNESS)->getItem(RoughnessItem::P_SIGMA)));
67  }
68 
69  return result;
70  }
static const std::string P_MATERIAL
Definition: sampleitems.h:42
static const std::string P_THICKNESS
Definition: sampleitems.h:43
static const std::string P_NAME
Definition: sampleitems.h:41
static const std::string P_ROUGHNESS
Definition: sampleitems.h:44
static const std::string P_NREPETITIONS
Definition: sampleitems.h:55
static const std::string P_SIGMA
Definition: sampleitems.h:30

References LayerItem::P_MATERIAL, SessionItem::P_NAME, LayerItem::P_ROUGHNESS, and LayerItem::P_THICKNESS.

◆ horizontalHeaderLabels()

QStringList gui2::CustomLayerRowStrategy::horizontalHeaderLabels ( ) const
inlinevirtual

Implements ModelView::RowStrategyInterface.

Definition at line 30 of file layerviewmodelcontroller.cpp.

31  {
32  return QStringList() << "Name"
33  << "Nr."
34  << "Material"
35  << "Thickness [nm]"
36  << "Sigma [nm]";
37  }

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