Skip to content
Snippets Groups Projects
Commit e2b5ccf7 authored by Matthias Puchner's avatar Matthias Puchner
Browse files

update realspace view when current sample changes or was deleted

parent ae629a27
No related branches found
No related tags found
1 merge request!447Real space for layer editor
...@@ -146,6 +146,9 @@ void SampleView::initLayerOrientedEditor() ...@@ -146,6 +146,9 @@ void SampleView::initLayerOrientedEditor()
connect(scriptPanel, &ScriptPanel::widgetHeightRequest, m_docks, connect(scriptPanel, &ScriptPanel::widgetHeightRequest, m_docks,
&DocksController::setDockHeightForWidget); &DocksController::setDockHeightForWidget);
connect(sampleSelectionView, &SampleListView::currentSampleChanged, this,
&SampleView::onCurrentSampleChanged);
connect(sampleSelectionView, &SampleListView::currentSampleChanged, editor, connect(sampleSelectionView, &SampleListView::currentSampleChanged, editor,
&LayerOrientedSampleEditor::setCurrentSample); &LayerOrientedSampleEditor::setCurrentSample);
...@@ -203,6 +206,13 @@ void SampleView::onSampleTreeViewSelectionChanged(const QItemSelection& selected ...@@ -203,6 +206,13 @@ void SampleView::onSampleTreeViewSelectionChanged(const QItemSelection& selected
m_realSpacePanel->canvas()->setCurrentItem(item); 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) void SampleView::onRequestViewInRealSpace(SessionItem* itemToView)
{ {
if (!itemToView) if (!itemToView)
......
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
#define BORNAGAIN_GUI_VIEW_SAMPLEDESIGNER_SAMPLEVIEW_H #define BORNAGAIN_GUI_VIEW_SAMPLEDESIGNER_SAMPLEVIEW_H
#include <QMainWindow> #include <QMainWindow>
#include <QPointer>
class DocksController; class DocksController;
class ProjectDocument; class ProjectDocument;
...@@ -23,6 +24,8 @@ class SampleToolBar; ...@@ -23,6 +24,8 @@ class SampleToolBar;
class RealSpacePanel; class RealSpacePanel;
class QItemSelection; class QItemSelection;
class SessionItem; class SessionItem;
class LayerOrientedSampleEditor;
class MultiLayerItem;
class SampleView : public QMainWindow { class SampleView : public QMainWindow {
Q_OBJECT Q_OBJECT
...@@ -41,6 +44,7 @@ private: ...@@ -41,6 +44,7 @@ private:
void deleteEditor(); void deleteEditor();
void updateFunctionalities(); void updateFunctionalities();
void onSampleTreeViewSelectionChanged(const QItemSelection& selected, const QItemSelection&); void onSampleTreeViewSelectionChanged(const QItemSelection& selected, const QItemSelection&);
void onCurrentSampleChanged(MultiLayerItem* current);
//! Show the item in the real space view //! Show the item in the real space view
//! //!
...@@ -52,6 +56,7 @@ private: ...@@ -52,6 +56,7 @@ private:
SampleToolBar* m_toolBar = nullptr; SampleToolBar* m_toolBar = nullptr;
RealSpacePanel* m_realSpacePanel = nullptr; RealSpacePanel* m_realSpacePanel = nullptr;
bool m_useLayerOrientedEditor = false; bool m_useLayerOrientedEditor = false;
QPointer<LayerOrientedSampleEditor> m_layerOrientedSampleEditor;
}; };
#endif // BORNAGAIN_GUI_VIEW_SAMPLEDESIGNER_SAMPLEVIEW_H #endif // BORNAGAIN_GUI_VIEW_SAMPLEDESIGNER_SAMPLEVIEW_H
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment