diff --git a/GUI/View/SampleDesigner/SampleView.cpp b/GUI/View/SampleDesigner/SampleView.cpp index 9b21acc8b0290321f364e7772dd41560c5b63053..dd49087c5082fda593b245f3d3a85de45c88029a 100644 --- a/GUI/View/SampleDesigner/SampleView.cpp +++ b/GUI/View/SampleDesigner/SampleView.cpp @@ -146,6 +146,9 @@ void SampleView::initLayerOrientedEditor() connect(scriptPanel, &ScriptPanel::widgetHeightRequest, m_docks, &DocksController::setDockHeightForWidget); + connect(sampleSelectionView, &SampleListView::currentSampleChanged, this, + &SampleView::onCurrentSampleChanged); + connect(sampleSelectionView, &SampleListView::currentSampleChanged, editor, &LayerOrientedSampleEditor::setCurrentSample); @@ -203,6 +206,13 @@ void SampleView::onSampleTreeViewSelectionChanged(const QItemSelection& selected m_realSpacePanel->canvas()->setCurrentItem(item); } +void SampleView::onCurrentSampleChanged(MultiLayerItem* current) +{ + if (m_layerOrientedSampleEditor) + m_layerOrientedSampleEditor->setCurrentSample(current); + m_realSpacePanel->canvas()->setCurrentItem(current); +} + void SampleView::onRequestViewInRealSpace(SessionItem* itemToView) { if (!itemToView) diff --git a/GUI/View/SampleDesigner/SampleView.h b/GUI/View/SampleDesigner/SampleView.h index 41af423e7af1dfa9d76a071695a12f819bc477f1..58c4019c4499880cbfe1761b4b72a25f17378b09 100644 --- a/GUI/View/SampleDesigner/SampleView.h +++ b/GUI/View/SampleDesigner/SampleView.h @@ -16,6 +16,7 @@ #define BORNAGAIN_GUI_VIEW_SAMPLEDESIGNER_SAMPLEVIEW_H #include <QMainWindow> +#include <QPointer> class DocksController; class ProjectDocument; @@ -23,6 +24,8 @@ class SampleToolBar; class RealSpacePanel; class QItemSelection; class SessionItem; +class LayerOrientedSampleEditor; +class MultiLayerItem; class SampleView : public QMainWindow { Q_OBJECT @@ -41,6 +44,7 @@ private: void deleteEditor(); void updateFunctionalities(); void onSampleTreeViewSelectionChanged(const QItemSelection& selected, const QItemSelection&); + void onCurrentSampleChanged(MultiLayerItem* current); //! Show the item in the real space view //! @@ -52,6 +56,7 @@ private: SampleToolBar* m_toolBar = nullptr; RealSpacePanel* m_realSpacePanel = nullptr; bool m_useLayerOrientedEditor = false; + QPointer<LayerOrientedSampleEditor> m_layerOrientedSampleEditor; }; #endif // BORNAGAIN_GUI_VIEW_SAMPLEDESIGNER_SAMPLEVIEW_H