diff --git a/GUI/View/Plot2D/IntensityDataCanvas.cpp b/GUI/View/Plot2D/IntensityDataCanvas.cpp index 0813d3dda73107ba8f6ccada659ce81582e2779b..d58d784f0a6c96009a6c2e43cf5e74b3f7c80b8b 100644 --- a/GUI/View/Plot2D/IntensityDataCanvas.cpp +++ b/GUI/View/Plot2D/IntensityDataCanvas.cpp @@ -67,6 +67,8 @@ void IntensityDataCanvas::setItem(SessionItem* intensityItem) m_colorMap->setItem(intensityDataItem()); applyPersistentSettings(); + if(!m_rotateDataAction) + initRotation(); } QSize IntensityDataCanvas::sizeHint() const @@ -81,7 +83,10 @@ QSize IntensityDataCanvas::minimumSizeHint() const QList<QAction*> IntensityDataCanvas::actionList() { - return {m_resetViewAction, m_rotateDataAction, m_savePlotAction}; + if(m_rotateDataAction) + return {m_resetViewAction, m_rotateDataAction, m_savePlotAction}; + else + return {m_resetViewAction, m_savePlotAction}; } void IntensityDataCanvas::onResetViewAction() @@ -151,13 +156,18 @@ void IntensityDataCanvas::initActions() m_savePlotAction->setIcon(QIcon(":/images/content-save-outline.svg")); m_savePlotAction->setToolTip("Save plot"); connect(m_savePlotAction, &QAction::triggered, this, &IntensityDataCanvas::onSavePlotAction); +} - m_rotateDataAction = new QAction(this); - m_rotateDataAction->setText("Rotate"); - m_rotateDataAction->setIcon(QIcon(":/images/rotate-left.svg")); - m_rotateDataAction->setIconText("Rotate"); - m_rotateDataAction->setToolTip("Rotate intensity data by 90 deg counterclockwise"); - connect(m_rotateDataAction, &QAction::triggered, this, &IntensityDataCanvas::rotateData); +void IntensityDataCanvas::initRotation() +{ + if(dynamic_cast<RealDataItem*>(intensityDataItem()->parent())) { + m_rotateDataAction = new QAction(this); + m_rotateDataAction->setText("Rotate"); + m_rotateDataAction->setIcon(QIcon(":/images/rotate-left.svg")); + m_rotateDataAction->setIconText("Rotate"); + m_rotateDataAction->setToolTip("Rotate intensity data by 90 deg counterclockwise"); + connect(m_rotateDataAction, &QAction::triggered, this, &IntensityDataCanvas::rotateData); + } } //! Reads gradient/ interpolation settings from IntensityDataItem and writes to persistant diff --git a/GUI/View/Plot2D/IntensityDataCanvas.h b/GUI/View/Plot2D/IntensityDataCanvas.h index e31cb7451733b08794a6fb90a799926411969cb5..44e54f2ee98a009af4cafa5d555438a3c621a9fc 100644 --- a/GUI/View/Plot2D/IntensityDataCanvas.h +++ b/GUI/View/Plot2D/IntensityDataCanvas.h @@ -51,6 +51,7 @@ protected: private: IntensityDataItem* intensityDataItem(); void initActions(); + void initRotation(); void onPropertyChanged(const QString& name); void applyPersistentSettings();