From e0da7a008c7ed0bcc52af0ae24773fa3e1b0b2d5 Mon Sep 17 00:00:00 2001 From: Tobias Knopff <t.knopff@fz-juelich.de> Date: Mon, 10 May 2021 16:01:24 +0200 Subject: [PATCH] Make AmplitudeAxisItem::P_LOCK_MIN_MAX private --- GUI/Models/AxesItems.cpp | 11 +++++++++++ GUI/Models/AxesItems.h | 5 ++++- GUI/Models/IntensityDataItem.cpp | 4 ++-- GUI/Views/InstrumentWidgets/DetectorMaskDelegate.cpp | 2 +- 4 files changed, 18 insertions(+), 4 deletions(-) diff --git a/GUI/Models/AxesItems.cpp b/GUI/Models/AxesItems.cpp index 5f81767bd40..644b1ab5961 100644 --- a/GUI/Models/AxesItems.cpp +++ b/GUI/Models/AxesItems.cpp @@ -180,6 +180,17 @@ bool AmplitudeAxisItem::isLogScalePropertyName(const QString& name) return name == P_IS_LOGSCALE; } +bool AmplitudeAxisItem::isLocked() const +{ + return getItemValue(P_LOCK_MIN_MAX).toBool(); +} + +void AmplitudeAxisItem::setLocked(bool locked) +{ + setItemValue(P_LOCK_MIN_MAX, locked); +} + + //! Sets editor for min, max values of axes void AmplitudeAxisItem::setMinMaxEditor(const QString& editorType) diff --git a/GUI/Models/AxesItems.h b/GUI/Models/AxesItems.h index 973982f0742..bf15e92b767 100644 --- a/GUI/Models/AxesItems.h +++ b/GUI/Models/AxesItems.h @@ -69,15 +69,18 @@ protected: class BA_CORE_API_ AmplitudeAxisItem : public BasicAxisItem { private: static const QString P_IS_LOGSCALE; + static const QString P_LOCK_MIN_MAX; public: - static const QString P_LOCK_MIN_MAX; AmplitudeAxisItem(); bool isLogScale() const; void setLogScale(bool value); static bool isLogScalePropertyName(const QString& name); + bool isLocked() const; + void setLocked(bool locked); + private: void setMinMaxEditor(const QString& editorType); }; diff --git a/GUI/Models/IntensityDataItem.cpp b/GUI/Models/IntensityDataItem.cpp index 85956a2ec95..3407f8e651a 100644 --- a/GUI/Models/IntensityDataItem.cpp +++ b/GUI/Models/IntensityDataItem.cpp @@ -199,12 +199,12 @@ QString IntensityDataItem::getYaxisTitle() const bool IntensityDataItem::isZAxisLocked() const { - return getItem(P_ZAXIS)->getItemValue(AmplitudeAxisItem::P_LOCK_MIN_MAX).toBool(); + return item<AmplitudeAxisItem>(P_ZAXIS)->isLocked(); } void IntensityDataItem::setZAxisLocked(bool state) { - return getItem(P_ZAXIS)->setItemValue(AmplitudeAxisItem::P_LOCK_MIN_MAX, state); + item<AmplitudeAxisItem>(P_ZAXIS)->setLocked(state); } void IntensityDataItem::setXaxisTitle(const QString& title) diff --git a/GUI/Views/InstrumentWidgets/DetectorMaskDelegate.cpp b/GUI/Views/InstrumentWidgets/DetectorMaskDelegate.cpp index cfd72b7c84b..c0e54338709 100644 --- a/GUI/Views/InstrumentWidgets/DetectorMaskDelegate.cpp +++ b/GUI/Views/InstrumentWidgets/DetectorMaskDelegate.cpp @@ -65,7 +65,7 @@ void DetectorMaskDelegate::createIntensityDataItem() zAxisItem->setLowerBound(0.0); zAxisItem->setUpperBound(2.0); zAxisItem->setLogScale(false); - zAxisItem->setItemValue(AmplitudeAxisItem::P_LOCK_MIN_MAX, true); + zAxisItem->setLocked(true); // creating output data corresponding to the detector auto instrument = dynamic_cast<const GISASInstrumentItem*>( -- GitLab