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

Public Types

enum  ESubWindows {
  WIDGET_BOX , SAMPLE_TREE , PROPERTY_EDITOR , INFO ,
  REALSPACEPANEL
}
 

Public Member Functions

 SampleView (MainWindow *mainWindow)
 
void fillViewMenu (QMenu *menu)
 
ApplicationModelsmodels ()
 
void toggleRealSpaceView ()
 

Private Member Functions

void connectSignals ()
 
void createSubWindows ()
 
void resetLayout ()
 

Private Attributes

DocksControllerm_docks = nullptr
 
SamplePropertyWidgetm_propertyWidget = nullptr
 
RealSpacePanelm_realSpacePanel = nullptr
 
SampleDesignerm_sampleDesigner = nullptr
 
ScriptPanelm_scriptPanel = nullptr
 
SampleToolBarm_toolBar = nullptr
 
SampleTreeWidgetm_treeWidget = nullptr
 
SampleWidgetBoxm_widgetBox = nullptr
 

Detailed Description

Definition at line 32 of file SampleView.h.

Member Enumeration Documentation

◆ ESubWindows

Enumerator
WIDGET_BOX 
SAMPLE_TREE 
PROPERTY_EDITOR 
INFO 
REALSPACEPANEL 

Definition at line 35 of file SampleView.h.

Constructor & Destructor Documentation

◆ SampleView()

SampleView::SampleView ( MainWindow mainWindow)

Definition at line 32 of file SampleView.cpp.

33  : QMainWindow(mainWindow), m_docks(new DocksController(this))
34 {
35 
36  setObjectName("SampleView");
39 }
Handles creation and appearance of docked widgets in the context of QMainWindow.
void connectSignals()
Definition: SampleView.cpp:95
void createSubWindows()
Definition: SampleView.cpp:63
DocksController * m_docks
Definition: SampleView.h:48

References connectSignals(), and createSubWindows().

Here is the call graph for this function:

Member Function Documentation

◆ connectSignals()

void SampleView::connectSignals ( )
private

Definition at line 95 of file SampleView.cpp.

96 {
97  // toolBar should be initialized after MaterialBrowser
98  m_toolBar = new SampleToolBar(this);
111 
112  addToolBar(m_toolBar);
113 }
void selectionModeChangeRequest(int)
void deleteSelectedItems()
void onChangeScale(double)
void onSelectionMode(int)
void selectionModeChanged(int)
void onCenterView()
DesignerScene * getScene() const
DesignerView * getView() const
The SampleToolBar class represents a main toolbar on top of SampleView window.
Definition: SampleToolBar.h:32
void deleteItems()
void selectionMode(int)
void onViewSelectionMode(int)
void centerView()
void changeScale(double)
SampleDesigner * m_sampleDesigner
Definition: SampleView.h:51
SampleToolBar * m_toolBar
Definition: SampleView.h:49

References SampleToolBar::centerView(), SampleToolBar::changeScale(), SampleToolBar::deleteItems(), DesignerView::deleteSelectedItems(), SampleDesigner::getScene(), SampleDesigner::getView(), m_sampleDesigner, m_toolBar, DesignerView::onCenterView(), DesignerView::onChangeScale(), DesignerView::onSelectionMode(), SampleToolBar::onViewSelectionMode(), SampleToolBar::selectionMode(), DesignerView::selectionModeChanged(), and DesignerScene::selectionModeChangeRequest().

Referenced by SampleView().

Here is the call graph for this function:

◆ createSubWindows()

void SampleView::createSubWindows ( )
private

Definition at line 63 of file SampleView.cpp.

64 {
65  m_sampleDesigner = new SampleDesigner(this);
67  m_treeWidget = new SampleTreeWidget(this, models()->sampleModel());
68  m_propertyWidget = new SamplePropertyWidget(m_treeWidget->treeView()->selectionModel(), this);
69  m_scriptPanel = new ScriptPanel(this);
70  m_realSpacePanel = new RealSpacePanel(models()->sampleModel(),
71  m_treeWidget->treeView()->selectionModel(), this);
72 
73  m_docks->addWidget(WIDGET_BOX, m_widgetBox, Qt::LeftDockWidgetArea);
74  m_docks->addWidget(SAMPLE_TREE, m_treeWidget, Qt::RightDockWidgetArea);
75  m_docks->addWidget(PROPERTY_EDITOR, m_propertyWidget, Qt::RightDockWidgetArea);
76  m_docks->addWidget(INFO, m_scriptPanel, Qt::BottomDockWidgetArea);
77  m_docks->addWidget(REALSPACEPANEL, m_realSpacePanel, Qt::BottomDockWidgetArea);
78 
81 
82  m_scriptPanel->setSampleModel(models()->sampleModel());
83  m_scriptPanel->setInstrumentModel(models()->instrumentModel());
84 
87  m_treeWidget->treeView()->selectionModel(),
88  dynamic_cast<FilterPropertyProxy*>(
89  const_cast<QAbstractItemModel*>(m_treeWidget->treeView()->model())));
90 
91  setCentralWidget(m_sampleDesigner->getCentralWidget());
92  resetLayout();
93 }
void setDockHeightForWidget(int height)
A hack to request update of QDockWidget size if its child (e.g.
void addWidget(int id, QWidget *widget, Qt::DockWidgetArea area)
The FilterPropertyProxy class filters out all PropertyItem's and similar from SessionModel to have on...
void widgetHeightRequest(int)
Panel with item selector, property editor on the right side of RealSpaceWidget.
sample designer provide central window with graphic scene to drag and drop
void setModels(ApplicationModels *models)
QWidget * getCentralWidget()
void setSelectionModel(QItemSelectionModel *model, FilterPropertyProxy *proxy)
Property editor to modify property of the object currently selected on the graphics scene.
Holds tree to select top level sample items. Part of SampleView.
QTreeView * treeView()
ApplicationModels * models()
Definition: SampleView.cpp:41
RealSpacePanel * m_realSpacePanel
Definition: SampleView.h:56
void resetLayout()
Definition: SampleView.cpp:115
SampleTreeWidget * m_treeWidget
Definition: SampleView.h:53
SampleWidgetBox * m_widgetBox
Definition: SampleView.h:52
ScriptPanel * m_scriptPanel
Definition: SampleView.h:55
SamplePropertyWidget * m_propertyWidget
Definition: SampleView.h:54
widget box and tool window on the left side of SampleView
Resides at the bottom of SampleView and displays a Python script.
Definition: ScriptPanel.h:26
void setInstrumentModel(InstrumentModel *instrumentModel)
Definition: ScriptPanel.cpp:38
void setSampleModel(SampleModel *sampleModel)
Definition: ScriptPanel.cpp:33

References DocksController::addWidget(), SampleDesigner::getCentralWidget(), INFO, m_docks, m_propertyWidget, m_realSpacePanel, m_sampleDesigner, m_scriptPanel, m_treeWidget, m_widgetBox, models(), PROPERTY_EDITOR, REALSPACEPANEL, resetLayout(), SAMPLE_TREE, DocksController::setDockHeightForWidget(), ScriptPanel::setInstrumentModel(), SampleDesigner::setModels(), ScriptPanel::setSampleModel(), SampleDesigner::setSelectionModel(), SampleTreeWidget::treeView(), WIDGET_BOX, and InfoPanel::widgetHeightRequest().

Referenced by SampleView().

Here is the call graph for this function:

◆ fillViewMenu()

void SampleView::fillViewMenu ( QMenu *  menu)

Definition at line 51 of file SampleView.cpp.

52 {
54 
55  menu->addSeparator();
56 
57  QAction* action = new QAction(menu);
58  action->setText("Reset to default layout");
59  connect(action, &QAction::triggered, this, &SampleView::resetLayout);
60  menu->addAction(action);
61 }
void addDockActionsToMenu(QMenu *menu)

References DocksController::addDockActionsToMenu(), m_docks, and resetLayout().

Here is the call graph for this function:

◆ models()

ApplicationModels * SampleView::models ( )

Definition at line 41 of file SampleView.cpp.

42 {
43  return MainWindow::instance()->models();
44 }
static MainWindow * instance()
Returns the one and only instance of this class.
Definition: mainwindow.cpp:129
ApplicationModels * models()
Definition: mainwindow.cpp:159

References MainWindow::instance(), and MainWindow::models().

Referenced by createSubWindows().

Here is the call graph for this function:

◆ resetLayout()

void SampleView::resetLayout ( )
private

Definition at line 115 of file SampleView.cpp.

116 {
117  m_docks->resetLayout();
118  tabifyDockWidget(m_docks->findDock(REALSPACEPANEL), m_docks->findDock(INFO));
119  m_docks->findDock(REALSPACEPANEL)->raise(); // makes first tab active
120 
121  m_docks->findDock(REALSPACEPANEL)->hide();
122  m_docks->findDock(INFO)->hide();
123 }
QDockWidget * findDock(int id)

References DocksController::findDock(), INFO, m_docks, REALSPACEPANEL, and DocksController::resetLayout().

Referenced by createSubWindows(), and fillViewMenu().

Here is the call graph for this function:

◆ toggleRealSpaceView()

void SampleView::toggleRealSpaceView ( )

Definition at line 46 of file SampleView.cpp.

47 {
49 }
void toggleDock(int id)

References m_docks, REALSPACEPANEL, and DocksController::toggleDock().

Referenced by SampleToolBar::SampleToolBar().

Here is the call graph for this function:

Member Data Documentation

◆ m_docks

DocksController* SampleView::m_docks = nullptr
private

Definition at line 48 of file SampleView.h.

Referenced by createSubWindows(), fillViewMenu(), resetLayout(), and toggleRealSpaceView().

◆ m_propertyWidget

SamplePropertyWidget* SampleView::m_propertyWidget = nullptr
private

Definition at line 54 of file SampleView.h.

Referenced by createSubWindows().

◆ m_realSpacePanel

RealSpacePanel* SampleView::m_realSpacePanel = nullptr
private

Definition at line 56 of file SampleView.h.

Referenced by createSubWindows().

◆ m_sampleDesigner

SampleDesigner* SampleView::m_sampleDesigner = nullptr
private

Definition at line 51 of file SampleView.h.

Referenced by connectSignals(), and createSubWindows().

◆ m_scriptPanel

ScriptPanel* SampleView::m_scriptPanel = nullptr
private

Definition at line 55 of file SampleView.h.

Referenced by createSubWindows().

◆ m_toolBar

SampleToolBar* SampleView::m_toolBar = nullptr
private

Definition at line 49 of file SampleView.h.

Referenced by connectSignals().

◆ m_treeWidget

SampleTreeWidget* SampleView::m_treeWidget = nullptr
private

Definition at line 53 of file SampleView.h.

Referenced by createSubWindows().

◆ m_widgetBox

SampleWidgetBox* SampleView::m_widgetBox = nullptr
private

Definition at line 52 of file SampleView.h.

Referenced by createSubWindows().


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