BornAgain  1.19.0
Simulate and fit neutron and x-ray scattering at grazing incidence
ComponentEditor Class Reference

Component editor for SessionItem. More...

Inheritance diagram for ComponentEditor:
[legend]
Collaboration diagram for ComponentEditor:
[legend]

Public Types

enum  EditorFlags {
  Tree = 0x1000 , Widget = 0x2000 , PlainLayout = 0x0010 , GroupLayout = 0x0020 ,
  InfoLayout = 0x0040 , T_Header = 0x0100 , T_Root = 0x0200 , W_NoChildren = 0x0400 ,
  FullTree = Tree | PlainLayout | T_Header | T_Root , HeaderTree = Tree | PlainLayout | T_Header , MiniTree = Tree | PlainLayout , PlainWidget = Widget | PlainLayout ,
  GroupWidget = Widget | GroupLayout , InfoWidget = Widget | InfoLayout
}
 

Signals

void dialogRequest (SessionItem *item, const QString &names)
 

Public Member Functions

 ComponentEditor (EditorType editorType=HeaderTree, const QString &title="")
 
void addItem (SessionItem *item)
 
void clearEditor ()
 
void setItem (SessionItem *item)
 

Private Slots

void onDialogRequest ()
 

Private Member Functions

ComponentViewcreateComponentView ()
 

Private Attributes

ComponentViewm_componentView
 
SessionItemm_item
 
QString m_title
 
EditorType m_type
 

Detailed Description

Component editor for SessionItem.

Can have various appearance depending on EditorFlags

Definition at line 27 of file ComponentEditor.h.

Member Enumeration Documentation

◆ EditorFlags

Enumerator
Tree 
Widget 
PlainLayout 
GroupLayout 
InfoLayout 
T_Header 
T_Root 
W_NoChildren 
FullTree 
HeaderTree 
MiniTree 
PlainWidget 
GroupWidget 
InfoWidget 

Definition at line 30 of file ComponentEditor.h.

30  {
31  Tree = 0x1000,
32  Widget = 0x2000,
33 
34  PlainLayout = 0x0010, // editor embedded in standard box layout
35  GroupLayout = 0x0020, // editor embedded in QGroupBox
36  InfoLayout = 0x0040, // editor embedded in GroupInfoBox
37 
38  T_Header = 0x0100, // to show QTreeView header (Tree mode only)
39  T_Root = 0x0200, // to show root item (Tree mode only)
40  W_NoChildren = 0x0400, // show no children (Widget mode only)
41 
48  };

Constructor & Destructor Documentation

◆ ComponentEditor()

ComponentEditor::ComponentEditor ( EditorType  editorType = HeaderTree,
const QString &  title = "" 
)

Definition at line 35 of file ComponentEditor.cpp.

36  : m_type(editorType), m_componentView(nullptr), m_item(nullptr), m_title(title)
37 {
39 
40  auto mainLayout = new QVBoxLayout;
41  mainLayout->setSpacing(0);
42  mainLayout->setMargin(0);
43 
44  if (m_type.testFlag(GroupLayout)) {
45  auto box = createGroupBox<QGroupBox>(m_componentView, title);
46  mainLayout->addWidget(box);
47  mainLayout->setMargin(4);
48  mainLayout->addStretch();
49 
50  } else if (m_type.testFlag(InfoLayout)) {
51  auto box = createGroupBox<GroupInfoBox>(m_componentView, title);
52  connect(box, &GroupInfoBox::clicked, this, &ComponentEditor::onDialogRequest);
53  mainLayout->addWidget(box);
54  mainLayout->setMargin(4);
55  mainLayout->addStretch();
56 
57  } else {
58  mainLayout->addWidget(m_componentView);
59  }
60 
61  setLayout(mainLayout);
62 }
EditorType m_type
SessionItem * m_item
ComponentView * createComponentView()
ComponentView * m_componentView

References createComponentView(), GroupLayout, InfoLayout, m_componentView, m_type, and onDialogRequest().

Here is the call graph for this function:

Member Function Documentation

◆ addItem()

void ComponentEditor::addItem ( SessionItem item)

Definition at line 76 of file ComponentEditor.cpp.

77 {
78  if (!m_item)
79  m_item = item;
80  m_componentView->addItem(item);
81 }
virtual void addItem(SessionItem *)
Definition: ComponentView.h:31

References ComponentView::addItem(), m_componentView, and m_item.

Referenced by RectangularDetectorEditor::init_alignment_editors(), DepthProbeInstrumentEditor::subscribeToItem(), SpecularBeamEditor::subscribeToItem(), and PolarizationAnalysisEditor::updateAnalyserEditor().

Here is the call graph for this function:

◆ clearEditor()

◆ createComponentView()

ComponentView * ComponentEditor::createComponentView ( )
private

Definition at line 88 of file ComponentEditor.cpp.

89 {
90  ComponentView* result(nullptr);
91 
92  if (m_type.testFlag(Tree)) {
93  auto view = new ComponentTreeView;
94  view->setShowHeader(m_type.testFlag(T_Header));
95  view->setShowRootItem(m_type.testFlag(T_Root));
96  result = view;
97  } else {
98  auto view = new ComponentFlatView;
99  view->setShowChildren(!m_type.testFlag(W_NoChildren));
100  result = view;
101  }
102 
103  return result;
104 }
Component property widget for SessionItems.
void setShowChildren(bool show)
Component property tree for SessionItems.
void setShowHeader(bool show)
Base class for ComponentTreeView and ComponentFlatView.
Definition: ComponentView.h:24

References m_type, ComponentFlatView::setShowChildren(), ComponentTreeView::setShowHeader(), T_Header, T_Root, Tree, and W_NoChildren.

Referenced by ComponentEditor().

Here is the call graph for this function:

◆ dialogRequest

◆ onDialogRequest

void ComponentEditor::onDialogRequest ( )
privateslot

Definition at line 83 of file ComponentEditor.cpp.

84 {
86 }
void dialogRequest(SessionItem *item, const QString &names)

References dialogRequest(), m_item, and m_title.

Referenced by ComponentEditor().

◆ setItem()

void ComponentEditor::setItem ( SessionItem item)

Member Data Documentation

◆ m_componentView

ComponentView* ComponentEditor::m_componentView
private

Definition at line 67 of file ComponentEditor.h.

Referenced by ComponentEditor(), addItem(), clearEditor(), and setItem().

◆ m_item

SessionItem* ComponentEditor::m_item
private

Definition at line 68 of file ComponentEditor.h.

Referenced by addItem(), clearEditor(), onDialogRequest(), and setItem().

◆ m_title

QString ComponentEditor::m_title
private

Definition at line 69 of file ComponentEditor.h.

Referenced by onDialogRequest().

◆ m_type

EditorType ComponentEditor::m_type
private

Definition at line 66 of file ComponentEditor.h.

Referenced by ComponentEditor(), and createComponentView().


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