BornAgain
1.19.0
Simulate and fit neutron and x-ray scattering at grazing incidence
|
Main class which represents SessionModel on graphics scene. More...
Public Slots | |
void | deleteSelectedItems () |
propagates deletion of views on the scene to the model More... | |
void | dragMoveEvent (QGraphicsSceneDragDropEvent *event) |
handles drag event LayerView can be dragged only over MultiLayerView MultiLayerView can be dragged both, over the scene and over another MultiLayerView More... | |
void | dropEvent (QGraphicsSceneDragDropEvent *event) |
Hadles drop event LayerView can be dropped on MultiLayerView only MultiLayerView can be droped on the scene or another MultiLayerView. More... | |
void | onEstablishedConnection (NodeEditorConnection *) |
propagates connection established by NodeEditor to the model More... | |
void | onRowsAboutToBeRemoved (const QModelIndex &parent, int first, int last) |
void | onRowsInserted (const QModelIndex &parent, int first, int last) |
void | onRowsRemoved (const QModelIndex &parent, int first, int last) |
void | onSceneSelectionChanged () |
propagate selection from scene to model More... | |
void | onSessionSelectionChanged (const QItemSelection &, const QItemSelection &) |
propagate selection from model to scene More... | |
void | onSmartAlign () |
void | removeConnection (NodeEditorConnection *) |
propagates break of connection between views on scene to the model More... | |
void | resetScene () |
void | setLayerInterfaceLine (const QLineF &line={}) |
void | updateScene () |
Signals | |
void | selectionModeChangeRequest (int) |
Public Member Functions | |
DesignerScene (QObject *parent=0) | |
virtual | ~DesignerScene () |
NodeEditor * | getNodeEditor () |
SampleModel * | getSampleModel () |
IView * | getViewForItem (SessionItem *item) |
void | setInstrumentModel (InstrumentModel *instrumentModel) |
void | setMaterialModel (MaterialModel *materialModel) |
void | setSampleModel (SampleModel *sampleModel) |
void | setSelectionModel (QItemSelectionModel *model, FilterPropertyProxy *proxy) |
Protected Member Functions | |
const DesignerMimeData * | checkDragEvent (QGraphicsSceneDragDropEvent *event) |
returns proper MimeData if the object can be hadled by graphics scene More... | |
void | drawForeground (QPainter *painter, const QRectF &rect) |
shows appropriate layer interface to drop while moving ILayerView More... | |
void | mouseMoveEvent (QGraphicsSceneMouseEvent *event) |
Private Member Functions | |
IView * | addViewForItem (SessionItem *item) |
adds view for item, if it doesn't exists More... | |
void | adjustSceneRect () |
void | alignViews () |
aligns SampleView's on graphical canvas More... | |
void | deleteViews (const QModelIndex &parentIndex) |
runs recursively through model's item and schedules view removal More... | |
bool | isAcceptedByMultiLayer (const DesignerMimeData *mimeData, QGraphicsSceneDragDropEvent *event) |
bool | isLayerDragged () const |
bool | isMultiLayerNearby (QGraphicsSceneDragDropEvent *event) |
Returns true if there is MultiLayerView nearby during drag event. More... | |
void | removeItemViewFromScene (SessionItem *item) |
removes view from scene corresponding to given item More... | |
void | updateViews (const QModelIndex &parentIndex={}, IView *parentView=0) |
runs through all items recursively and updates corresponding views More... | |
Private Attributes | |
SampleViewAligner * | m_aligner |
bool | m_block_selection |
InstrumentModel * | m_instrumentModel |
QMap< SessionItem *, IView * > | m_ItemToView |
Correspondance of model's item and scene's view. More... | |
QLineF | m_layer_interface_line |
Foreground line representing appropriate interface during layer's movement. More... | |
MaterialModel * | m_materialModel |
NodeEditor * | m_nodeEditor |
FilterPropertyProxy * | m_proxy |
SampleModel * | m_sampleModel |
QItemSelectionModel * | m_selectionModel |
Main class which represents SessionModel on graphics scene.
Definition at line 37 of file DesignerScene.h.
|
explicit |
Definition at line 37 of file DesignerScene.cpp.
References NodeEditor::connectionIsEstablished(), DesignerHelper::getSceneBackground(), NodeEditor::install(), m_nodeEditor, onEstablishedConnection(), onSceneSelectionChanged(), selectionModeChangeRequest(), and NodeEditor::selectionModeChangeRequest().
|
virtual |
Definition at line 59 of file DesignerScene.cpp.
References m_aligner.
|
private |
adds view for item, if it doesn't exists
Definition at line 243 of file DesignerScene.cpp.
References ASSERT, SampleViewFactory::createSampleView(), getViewForItem(), m_ItemToView, SessionItem::modelType(), and IView::setParameterizedItem().
Referenced by updateViews().
|
private |
|
private |
aligns SampleView's on graphical canvas
Definition at line 264 of file DesignerScene.cpp.
References SampleViewAligner::alignSample(), and m_aligner.
Referenced by updateScene().
|
protected |
returns proper MimeData if the object can be hadled by graphics scene
Definition at line 446 of file DesignerScene.cpp.
Referenced by dragMoveEvent(), and dropEvent().
|
slot |
propagates deletion of views on the scene to the model
Definition at line 307 of file DesignerScene.cpp.
References SessionModel::itemForIndex(), m_ItemToView, m_proxy, m_sampleModel, m_selectionModel, removeConnection(), and SessionModel::removeRows().
Referenced by DesignerView::deleteSelectedItems().
|
private |
runs recursively through model's item and schedules view removal
Definition at line 270 of file DesignerScene.cpp.
References SessionModel::index(), SessionModel::itemForIndex(), m_sampleModel, removeItemViewFromScene(), and SessionModel::rowCount().
Referenced by onRowsAboutToBeRemoved().
|
slot |
handles drag event LayerView can be dragged only over MultiLayerView MultiLayerView can be dragged both, over the scene and over another MultiLayerView
Definition at line 385 of file DesignerScene.cpp.
References checkDragEvent(), and isAcceptedByMultiLayer().
|
protected |
shows appropriate layer interface to drop while moving ILayerView
Definition at line 337 of file DesignerScene.cpp.
References isLayerDragged(), and m_layer_interface_line.
|
slot |
Hadles drop event LayerView can be dropped on MultiLayerView only MultiLayerView can be droped on the scene or another MultiLayerView.
Definition at line 396 of file DesignerScene.cpp.
References adjustSceneRect(), SampleViewAligner::alignSample(), checkDragEvent(), GUIExamplesFactory::createSampleItems(), DesignerMimeData::getClassName(), DesignerHelper::getDefaultBoundingRect(), SessionModel::insertItem(), SessionModel::insertNewItem(), isAcceptedByMultiLayer(), GUIExamplesFactory::isValidExampleName(), SampleViewFactory::isValidType(), m_aligner, m_materialModel, m_sampleModel, SessionItem::modelType(), ParticleItem::P_FORM_FACTOR, SessionGraphicsItem::P_XPOS, SessionGraphicsItem::P_YPOS, SessionItem::setGroupProperty(), and SessionItem::setItemValue().
|
inline |
|
inline |
Definition at line 49 of file DesignerScene.h.
References m_sampleModel.
Referenced by SampleViewAligner::alignSample(), MultiLayerView::dropEvent(), SampleViewAligner::getViewForIndex(), ILayerView::mouseReleaseEvent(), and SampleViewAligner::updateViews().
IView * DesignerScene::getViewForItem | ( | SessionItem * | item | ) |
Definition at line 125 of file DesignerScene.cpp.
References m_ItemToView.
Referenced by addViewForItem(), SampleViewAligner::getConnectedViews(), and SampleViewAligner::getViewForIndex().
|
private |
Definition at line 487 of file DesignerScene.cpp.
References DesignerMimeData::getClassName(), and isMultiLayerNearby().
Referenced by dragMoveEvent(), and dropEvent().
|
private |
Definition at line 505 of file DesignerScene.cpp.
References m_layer_interface_line.
Referenced by drawForeground(), and mouseMoveEvent().
|
private |
Returns true if there is MultiLayerView nearby during drag event.
Definition at line 466 of file DesignerScene.cpp.
References DesignerHelper::getDefaultMultiLayerRect(), and ViewTypes::MULTILAYER.
Referenced by isAcceptedByMultiLayer().
|
protected |
Definition at line 457 of file DesignerScene.cpp.
References isLayerDragged().
|
slot |
propagates connection established by NodeEditor to the model
Definition at line 346 of file DesignerScene.cpp.
References NodeEditorConnection::getChildView(), ConnectableView::getInputPortIndex(), IView::getItem(), NodeEditorConnection::getParentView(), NodeEditorPort::getPortType(), NodeEditorConnection::inputPort(), NodeEditorPort::INTERFERENCE, m_sampleModel, SessionItem::modelType(), SessionModel::moveItem(), ParticleCoreShellItem::T_CORE, ParticleLayoutItem::T_INTERFERENCE, ParticleCoreShellItem::T_SHELL, ParticleItem::T_TRANSFORMATION, and NodeEditorPort::TRANSFORMATION.
Referenced by DesignerScene().
|
slot |
Definition at line 157 of file DesignerScene.cpp.
References deleteViews(), SessionModel::index(), m_block_selection, and m_sampleModel.
Referenced by setSampleModel().
|
slot |
Definition at line 147 of file DesignerScene.cpp.
References updateScene().
Referenced by setSampleModel().
|
slot |
Definition at line 152 of file DesignerScene.cpp.
References updateScene().
Referenced by setSampleModel().
|
slot |
propagate selection from scene to model
Definition at line 192 of file DesignerScene.cpp.
References ASSERT, IView::getItem(), SessionModel::indexOfItem(), m_block_selection, m_proxy, m_sampleModel, and m_selectionModel.
Referenced by DesignerScene().
|
slot |
propagate selection from model to scene
Definition at line 168 of file DesignerScene.cpp.
References SessionModel::indexOfItem(), m_block_selection, m_ItemToView, m_proxy, m_sampleModel, and m_selectionModel.
Referenced by setSelectionModel().
|
slot |
Definition at line 514 of file DesignerScene.cpp.
References m_aligner, and SampleViewAligner::smartAlign().
|
slot |
propagates break of connection between views on scene to the model
Definition at line 376 of file DesignerScene.cpp.
References IView::getItem(), m_sampleModel, SessionModel::moveItem(), and NodeEditorConnection::outputPort().
Referenced by deleteSelectedItems().
|
private |
removes view from scene corresponding to given item
Definition at line 287 of file DesignerScene.cpp.
References IView::aboutToBeDeleted(), ASSERT, and m_ItemToView.
Referenced by deleteViews().
|
slot |
Definition at line 134 of file DesignerScene.cpp.
References m_ItemToView, and m_layer_interface_line.
Referenced by setSampleModel().
|
signal |
Referenced by DesignerScene(), and SampleView::connectSignals().
void DesignerScene::setInstrumentModel | ( | InstrumentModel * | instrumentModel | ) |
Definition at line 96 of file DesignerScene.cpp.
References m_instrumentModel.
Referenced by SampleDesigner::setModels().
|
inlineslot |
Definition at line 68 of file DesignerScene.h.
Referenced by ILayerView::itemChange(), and ILayerView::mouseReleaseEvent().
void DesignerScene::setMaterialModel | ( | MaterialModel * | materialModel | ) |
Definition at line 101 of file DesignerScene.cpp.
References m_materialModel.
Referenced by SampleDesigner::setModels().
void DesignerScene::setSampleModel | ( | SampleModel * | sampleModel | ) |
Definition at line 64 of file DesignerScene.cpp.
References ASSERT, m_sampleModel, onRowsAboutToBeRemoved(), onRowsInserted(), onRowsRemoved(), resetScene(), and updateScene().
Referenced by SampleDesigner::setModels().
void DesignerScene::setSelectionModel | ( | QItemSelectionModel * | model, |
FilterPropertyProxy * | proxy | ||
) |
Definition at line 106 of file DesignerScene.cpp.
References ASSERT, m_proxy, m_selectionModel, and onSessionSelectionChanged().
Referenced by SampleDesigner::setSelectionModel().
|
slot |
Definition at line 141 of file DesignerScene.cpp.
References alignViews(), and updateViews().
Referenced by onRowsInserted(), onRowsRemoved(), and setSampleModel().
|
private |
runs through all items recursively and updates corresponding views
Definition at line 217 of file DesignerScene.cpp.
References IView::addView(), addViewForItem(), ASSERT, SessionModel::index(), SampleViewFactory::isValidType(), SessionModel::itemForIndex(), m_sampleModel, and SessionModel::rowCount().
Referenced by updateScene().
|
private |
Definition at line 114 of file DesignerScene.h.
Referenced by ~DesignerScene(), alignViews(), dropEvent(), and onSmartAlign().
|
private |
Definition at line 106 of file DesignerScene.h.
Referenced by onRowsAboutToBeRemoved(), onSceneSelectionChanged(), and onSessionSelectionChanged().
|
private |
Definition at line 102 of file DesignerScene.h.
Referenced by setInstrumentModel().
|
private |
Correspondance of model's item and scene's view.
Definition at line 108 of file DesignerScene.h.
Referenced by addViewForItem(), deleteSelectedItems(), getViewForItem(), onSessionSelectionChanged(), removeItemViewFromScene(), and resetScene().
|
private |
Foreground line representing appropriate interface during layer's movement.
Definition at line 111 of file DesignerScene.h.
Referenced by drawForeground(), isLayerDragged(), and resetScene().
|
private |
Definition at line 103 of file DesignerScene.h.
Referenced by dropEvent(), and setMaterialModel().
|
private |
Definition at line 116 of file DesignerScene.h.
Referenced by DesignerScene(), and getNodeEditor().
|
private |
Definition at line 105 of file DesignerScene.h.
Referenced by deleteSelectedItems(), onSceneSelectionChanged(), onSessionSelectionChanged(), and setSelectionModel().
|
private |
Definition at line 101 of file DesignerScene.h.
Referenced by deleteSelectedItems(), deleteViews(), dropEvent(), getSampleModel(), onEstablishedConnection(), onRowsAboutToBeRemoved(), onSceneSelectionChanged(), onSessionSelectionChanged(), removeConnection(), setSampleModel(), and updateViews().
|
private |
Definition at line 104 of file DesignerScene.h.
Referenced by deleteSelectedItems(), onSceneSelectionChanged(), onSessionSelectionChanged(), and setSelectionModel().