diff --git a/GUI/View/SampleDesigner/LayerOrientedSampleEditor.cpp b/GUI/View/SampleDesigner/LayerOrientedSampleEditor.cpp index 10642c3b8365670db2c6395e241b54cc31bfcf9f..89281d78c24e41ba0bfe50b910e4f3dbdcfbf41d 100644 --- a/GUI/View/SampleDesigner/LayerOrientedSampleEditor.cpp +++ b/GUI/View/SampleDesigner/LayerOrientedSampleEditor.cpp @@ -111,6 +111,8 @@ void LayerOrientedSampleEditor::setCurrentSample(MultiLayerItem* multiLayerItem) m_editControllers.insert(m_currentMultiLayerItem, new SampleEditorController(m_currentMultiLayerItem)); auto* ec = m_editControllers[m_currentMultiLayerItem]; + connect(ec, &SampleEditorController::requestViewInRealSpace, this, + &LayerOrientedSampleEditor::requestViewInRealSpace); m_undoAction = ec->undoStack()->createUndoAction(this); m_redoAction = ec->undoStack()->createRedoAction(this); diff --git a/GUI/View/SampleDesigner/LayerOrientedSampleEditor.h b/GUI/View/SampleDesigner/LayerOrientedSampleEditor.h index 0a11350d6f41352da4358aab5a0dea36f6da6a80..df212a80ff41950be634ecdf9ab14e39de218d63 100644 --- a/GUI/View/SampleDesigner/LayerOrientedSampleEditor.h +++ b/GUI/View/SampleDesigner/LayerOrientedSampleEditor.h @@ -23,6 +23,7 @@ class QToolBar; class SampleEditorController; class MultiLayerForm; class QScrollArea; +class SessionItem; //! Sample editor with layer oriented presentation of a sample class LayerOrientedSampleEditor : public QWidget { @@ -33,6 +34,9 @@ public: void setCurrentSample(MultiLayerItem* multiLayerItem); +signals: + void requestViewInRealSpace(SessionItem* itemToShow); + private: void updateActionEnabling(); void onShowInlineEditButtonsToggled(bool checked); diff --git a/GUI/View/SampleDesigner/SampleEditorController.h b/GUI/View/SampleDesigner/SampleEditorController.h index 8134098ee10e63e2cf516ce235c3f1de18cea085..d8ab9b2dc68e5aef1c48a9213cb126188d8899bd 100644 --- a/GUI/View/SampleDesigner/SampleEditorController.h +++ b/GUI/View/SampleDesigner/SampleEditorController.h @@ -32,6 +32,7 @@ class ItemWithMaterial; class SelectionContainerForm; class AbstractSelectionDescriptor; class InterferenceForm; +class SessionItem; //! Class to modify a sample from the layer oriented sample editor. //! @@ -84,6 +85,9 @@ public: void onStartingToMoveLayer(); void onStoppedToMoveLayer(QWidget* widgetToMove, QWidget* moveAboveThisWidget); +signals: + void requestViewInRealSpace(SessionItem* itemToShow); + private: QUndoStack m_undoStack; MultiLayerItem* m_multiLayerItem; diff --git a/GUI/View/SampleDesigner/SampleView.cpp b/GUI/View/SampleDesigner/SampleView.cpp index 60c88ce44d9c5cef5a9d3be7d0a0254657b2fdfd..08471145e7ae35978c894eaf37897c2017b317e6 100644 --- a/GUI/View/SampleDesigner/SampleView.cpp +++ b/GUI/View/SampleDesigner/SampleView.cpp @@ -148,6 +148,9 @@ void SampleView::initLayerOrientedEditor() connect(sampleSelectionView, &SampleListView::currentSampleChanged, editor, &LayerOrientedSampleEditor::setCurrentSample); + connect(editor, &LayerOrientedSampleEditor::requestViewInRealSpace, this, + &SampleView::onRequestViewInRealSpace); + setCentralWidget(editor); resetLayout(); @@ -199,6 +202,15 @@ void SampleView::onSampleTreeViewSelectionChanged(const QItemSelection& selected m_realSpacePanel->canvas()->setCurrentItem(item); } +void SampleView::onRequestViewInRealSpace(SessionItem* itemToView) +{ + if (!itemToView) + return; + + m_docks->setDockVisible(REALSPACEPANEL); + m_realSpacePanel->canvas()->setCurrentItem(itemToView); +} + void SampleView::toggleRealSpaceView() { m_docks->toggleDock(REALSPACEPANEL); diff --git a/GUI/View/SampleDesigner/SampleView.h b/GUI/View/SampleDesigner/SampleView.h index 16e2f9851a2eef2f8a4f879ef66f3a7378154460..41af423e7af1dfa9d76a071695a12f819bc477f1 100644 --- a/GUI/View/SampleDesigner/SampleView.h +++ b/GUI/View/SampleDesigner/SampleView.h @@ -22,6 +22,7 @@ class ProjectDocument; class SampleToolBar; class RealSpacePanel; class QItemSelection; +class SessionItem; class SampleView : public QMainWindow { Q_OBJECT @@ -41,6 +42,11 @@ private: void updateFunctionalities(); void onSampleTreeViewSelectionChanged(const QItemSelection& selected, const QItemSelection&); + //! Show the item in the real space view + //! + //! If the real space view is not visible at the moment, it will be shown. + void onRequestViewInRealSpace(SessionItem* itemToView); + DocksController* m_docks = nullptr; ProjectDocument* m_document = nullptr; SampleToolBar* m_toolBar = nullptr;