From 94a1a3169ce93df5de0b045a0bdbe7cd051a0331 Mon Sep 17 00:00:00 2001
From: Matthias Puchner <github@mpuchner.de>
Date: Tue, 1 Feb 2022 16:15:35 +0100
Subject: [PATCH] fix GCC warnings

---
 GUI/Model/Item/RectangularDetectorItem.cpp  | 8 ++++++--
 GUI/View/Instrument/AxisPropertyEditor.cpp  | 2 +-
 GUI/View/Instrument/InstrumentListModel.cpp | 2 +-
 3 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/GUI/Model/Item/RectangularDetectorItem.cpp b/GUI/Model/Item/RectangularDetectorItem.cpp
index a897d82e931..d1c458c9b41 100644
--- a/GUI/Model/Item/RectangularDetectorItem.cpp
+++ b/GUI/Model/Item/RectangularDetectorItem.cpp
@@ -117,6 +117,8 @@ RectangularDetectorItem::RectangularDetectorItem()
 
 void RectangularDetectorItem::serialize(Serializer& s)
 {
+    int alignment = m_detectorAlignment;
+
     s.assertVersion(0);
     // base class members
     s.rw("masks", m_maskItems);
@@ -127,7 +129,7 @@ void RectangularDetectorItem::serialize(Serializer& s)
     s.rw("ySize", m_ySize);
     s.rw(m_width);
     s.rw(m_height);
-    s.rw("alignment", (int&)m_detectorAlignment);
+    s.rw("alignment", alignment);
     s.rw(m_normalVector);
     s.rw(m_directionVector);
     s.rw(m_u0);
@@ -136,8 +138,10 @@ void RectangularDetectorItem::serialize(Serializer& s)
     s.rw(m_directBeamV0);
     s.rw(m_distance);
 
-    if (s.isReading())
+    if (s.isReading()) {
+        m_detectorAlignment = static_cast<RectangularDetector::EDetectorArrangement>(alignment);
         updateTooltips();
+    }
 }
 
 void RectangularDetectorItem::setDetectorAlignment(
diff --git a/GUI/View/Instrument/AxisPropertyEditor.cpp b/GUI/View/Instrument/AxisPropertyEditor.cpp
index bde22ddd05d..b5a4beb5787 100644
--- a/GUI/View/Instrument/AxisPropertyEditor.cpp
+++ b/GUI/View/Instrument/AxisPropertyEditor.cpp
@@ -33,7 +33,7 @@ AxisPropertyEditor::AxisPropertyEditor(QWidget* parent, const QString& groupTitl
     m_maxSpinBox = GUI::Util::createSpinBox(formLayout, axisProperty->max());
 
     connect(nbinsSpinBox, qOverload<int>(&QSpinBox::valueChanged), [=](int v) {
-        if (axisProperty->nbins() != v) {
+        if (axisProperty->nbins() != static_cast<uint>(v)) {
             axisProperty->setNbins(v);
             emit dataChanged();
         }
diff --git a/GUI/View/Instrument/InstrumentListModel.cpp b/GUI/View/Instrument/InstrumentListModel.cpp
index 950a00737e3..77a8fc06e27 100644
--- a/GUI/View/Instrument/InstrumentListModel.cpp
+++ b/GUI/View/Instrument/InstrumentListModel.cpp
@@ -148,7 +148,7 @@ QModelIndex InstrumentListModel::copyInstrument(const InstrumentItem* source)
     const int row = m_ec->instrumentItems()->instrumentItems().size();
 
     beginInsertRows(QModelIndex(), row, row);
-    auto* copy = m_ec->addCopy(source, copyName);
+    m_ec->addCopy(source, copyName);
     endInsertRows();
 
     return createIndex(row, 0);
-- 
GitLab