BornAgain  1.19.0
Simulate and fit neutron and x-ray scattering at grazing incidence
TestView Class Reference
Inheritance diagram for TestView:
[legend]
Collaboration diagram for TestView:
[legend]

Public Member Functions

 TestView (MainWindow *mainWindow=nullptr)
 

Private Member Functions

void test_AccordionWidget ()
 
void test_ba3d ()
 
void test_ComponentProxyModel ()
 
void test_MaterialEditor ()
 
void test_MinimizerSettings ()
 
void test_specular_data_widget ()
 

Private Attributes

MainWindowm_mainWindow
 

Detailed Description

Definition at line 22 of file TestView.h.

Constructor & Destructor Documentation

◆ TestView()

TestView::TestView ( MainWindow mainWindow = nullptr)

Definition at line 46 of file TestView.cpp.

46  : QWidget(mainWindow), m_mainWindow(mainWindow)
47 {
48  // test_ComponentProxyModel();
49  // test_MaterialEditor();
50  // test_MinimizerSettings();
51  // test_AccordionWidget();
52  // test_RunFitWidget();
53  // test_ba3d();
54  // test_specular_data_widget();
55 }
MainWindow * m_mainWindow
Definition: TestView.h:35

Member Function Documentation

◆ test_AccordionWidget()

void TestView::test_AccordionWidget ( )
private

Definition at line 92 of file TestView.cpp.

93 {
94  AccordionWidget* myAccordion = new AccordionWidget();
95  myAccordion->setMultiActive(true);
96  // add the Accordion to your layout
97  QVBoxLayout* layout = new QVBoxLayout;
98  layout->addWidget(myAccordion);
99  setLayout(layout);
100 
101  // add a content pane with a header
102  int firstPaneIndex = myAccordion->addContentPane("My first content pane");
103  // make sure our content pane was added
104  if (firstPaneIndex != -1) {
105  // get a QFrame* from the Content Pane. This is where we place our content
106  QFrame* contentFrame = myAccordion->getContentPane(firstPaneIndex)->getContentFrame();
107  // give the QFrame a QLayout
108  contentFrame->setLayout(new QVBoxLayout());
109  // add a simpel QLabel to the frame
110  contentFrame->layout()->addWidget(new QLabel("Hello Cute World!!!"));
111  }
112 
113  // add a content pane with a header
114  int secondPaneIndex = myAccordion->addContentPane("Basic settings");
115  // make sure our content pane was added
116  if (secondPaneIndex != -1) {
117  // get a QFrame* from the Content Pane. This is where we place our content
118  QFrame* contentFrame = myAccordion->getContentPane(secondPaneIndex)->getContentFrame();
119  // give the QFrame a QLayout
120  contentFrame->setLayout(new QVBoxLayout());
121  // add a simpel QLabel to the frame
122  QLineEdit* led = new QLineEdit();
123  QLineEdit* led2 = new QLineEdit();
124  contentFrame->layout()->addWidget(new QLabel("Name:"));
125  contentFrame->layout()->addWidget(led);
126  contentFrame->layout()->addWidget(new QLabel("Living place:"));
127  contentFrame->layout()->addWidget(led2);
128  }
129 
130  // add a content pane with a header
131  int third = myAccordion->addContentPane("Advanced");
132  // make sure our content pane was added
133  if (third != -1) {
134  // get a QFrame* from the Content Pane. This is where we place our content
135  myAccordion->getContentPane(third)->setMaximumHeight(500);
136  QFrame* contentFrame = myAccordion->getContentPane(third)->getContentFrame();
137  contentFrame->setMaximumHeight(500);
138  // give the QFrame a QLayout
139  contentFrame->setLayout(new QVBoxLayout());
140  // add a simpel QLabel to the frame
141  QCheckBox* cb = new QCheckBox();
142  cb->setText("Option 1");
143  QCheckBox* cb2 = new QCheckBox();
144  cb2->setText("Option 2");
145  QCheckBox* cb3 = new QCheckBox();
146  cb3->setText("Option 3");
147  QCheckBox* cb4 = new QCheckBox();
148  cb4->setText("Option 4");
149  QCheckBox* cb5 = new QCheckBox();
150  cb5->setText("Option 5");
151  QCheckBox* cb6 = new QCheckBox();
152  cb6->setText("Option 6");
153  QCheckBox* cb7 = new QCheckBox();
154  cb7->setText("Option 7");
155  contentFrame->layout()->addWidget(cb);
156  contentFrame->layout()->addWidget(cb2);
157  contentFrame->layout()->addWidget(cb3);
158  contentFrame->layout()->addWidget(cb4);
159  contentFrame->layout()->addWidget(cb5);
160  contentFrame->layout()->addWidget(cb6);
161  contentFrame->layout()->addWidget(cb7);
162  }
163 }
QAccordion base class.
ContentPane * getContentPane(uint index)
Get content pane.
int addContentPane(QString header)
Add a new content Pane.
void setMultiActive(bool status)
Allow multiple ContentPane to be open.
QFrame * getContentFrame()
Get the content frame of the content pane.
Definition: ContentPane.cpp:53
void setMaximumHeight(int maxHeight)
Set the maximum height of the content pane container.
Definition: ContentPane.cpp:72

References AccordionWidget::addContentPane(), ContentPane::getContentFrame(), AccordionWidget::getContentPane(), ContentPane::setMaximumHeight(), and AccordionWidget::setMultiActive().

Here is the call graph for this function:

◆ test_ba3d()

void TestView::test_ba3d ( )
private

Definition at line 165 of file TestView.cpp.

166 {
167  // After putting this 3D view in Sample Viewer with the necessary changes, it does not work
168  // in test view and needs to be refactored in order to be used.
169 
170  QVBoxLayout* layout = new QVBoxLayout;
171  layout->setMargin(0);
172  layout->setSpacing(0);
174  layout->addWidget(widget);
175  setLayout(layout);
176 }
SampleModel * sampleModel()
Definition: mainwindow.cpp:144
Prototype of real space widget to present sample structure in 3D view.

References m_mainWindow, and MainWindow::sampleModel().

Here is the call graph for this function:

◆ test_ComponentProxyModel()

void TestView::test_ComponentProxyModel ( )
private

Definition at line 57 of file TestView.cpp.

58 {
59  auto layout = new QHBoxLayout();
60  layout->setMargin(0);
61  layout->setSpacing(0);
62 
63  layout->addWidget(new TestComponentView(m_mainWindow));
64 
65  setLayout(layout);
66 }
View to tests QListView working with ComponentProxyModel.

References m_mainWindow.

◆ test_MaterialEditor()

void TestView::test_MaterialEditor ( )
private

Definition at line 68 of file TestView.cpp.

69 {
70  MaterialEditor* materialEditor = new MaterialEditor(m_mainWindow->materialModel());
71  QVBoxLayout* layout = new QVBoxLayout;
72  layout->setMargin(0);
73  layout->setSpacing(0);
74  layout->addWidget(materialEditor);
75  setLayout(layout);
76 }
MaterialModel * materialModel()
Definition: mainwindow.cpp:134
Main widget of MaterialEditor.

References m_mainWindow, and MainWindow::materialModel().

Here is the call graph for this function:

◆ test_MinimizerSettings()

void TestView::test_MinimizerSettings ( )
private

Definition at line 78 of file TestView.cpp.

79 {
81  QVBoxLayout* layout = new QVBoxLayout;
82  layout->setMargin(0);
83  layout->setSpacing(0);
84  layout->addWidget(widget);
85  setLayout(layout);
86 
87  SessionModel* model = new SessionModel("TempModel", this);
88  auto minimizerItem = model->insertItem<MinimizerContainerItem>();
89  widget->setItem(minimizerItem);
90 }
The MinimizerContainerItem class holds collection of minimizers.
Definition: MinimizerItem.h:33
The MinimizerSettingsWidget contains editor for all minnimizer settings and related fit options.
void setItem(JobItem *jobItem)
T * insertItem(SessionItem *parent=nullptr, int row=-1, QString tag="")
Definition: SessionModel.h:125

References SessionModel::insertItem(), and MinimizerSettingsWidget::setItem().

Here is the call graph for this function:

◆ test_specular_data_widget()

void TestView::test_specular_data_widget ( )
private

Definition at line 178 of file TestView.cpp.

179 {
180  SessionModel* tempModel = new SessionModel("Test", this);
181 
182  // creating job item
183  auto job_item = tempModel->insertItem<JobItem>();
184 
185  // creating "simulation" data
186  auto data_item = new SpecularDataItem();
187  job_item->insertItem(-1, data_item, JobItem::T_OUTPUT);
188  fillTestItem(data_item, 1.0);
189 
190  // creating "real" data
191  auto real_data = new RealDataItem();
192  job_item->insertItem(-1, real_data, JobItem::T_REALDATA);
193  data_item = new SpecularDataItem();
194  real_data->insertItem(-1, data_item, RealDataItem::T_INTENSITY_DATA);
195  fillTestItem(data_item, 2.0);
196 
197  // creating data view
198  auto data_view = new Data1DViewItem();
199  job_item->insertItem(-1, data_view, JobItem::T_DATAVIEW);
200  data_view->insertItem(-1, new DataPropertyContainer, Data1DViewItem::T_DATA_PROPERTIES);
201  auto container = data_view->item<DataPropertyContainer>(Data1DViewItem::T_DATA_PROPERTIES);
202  container->addItem(job_item->realDataItem()->dataItem());
203  container->addItem(job_item->dataItem());
204 
205  QVBoxLayout* layout = new QVBoxLayout;
206  layout->setMargin(0);
207  layout->setSpacing(0);
208  auto widget = new Plot1DCanvas(this);
209  widget->setItem(job_item->dataItemView());
210  layout->addWidget(widget);
211  setLayout(layout);
212 }
View model for 1D DataItem.
static const QString T_DATA_PROPERTIES
void addItem(DataItem *data_item)
static const QString T_DATAVIEW
Definition: JobItem.h:52
static const QString T_OUTPUT
Definition: JobItem.h:50
static const QString T_REALDATA
Definition: JobItem.h:51
The Plot1DCanvas class contains SpecularPlotWithDataView for specular data presentation,...
Definition: Plot1DCanvas.h:29
The RealDataItem class represents intensity data imported from file and intended for fitting.
Definition: RealDataItem.h:35
static const QString T_INTENSITY_DATA
Definition: RealDataItem.h:45

References DataPropertyContainer::addItem(), SessionModel::insertItem(), Data1DViewItem::T_DATA_PROPERTIES, JobItem::T_DATAVIEW, RealDataItem::T_INTENSITY_DATA, JobItem::T_OUTPUT, and JobItem::T_REALDATA.

Here is the call graph for this function:

Member Data Documentation

◆ m_mainWindow

MainWindow* TestView::m_mainWindow
private

Definition at line 35 of file TestView.h.

Referenced by test_ba3d(), test_ComponentProxyModel(), and test_MaterialEditor().


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