From 4383c79fa29d09184f2275c7c96e385f1b969e4d Mon Sep 17 00:00:00 2001
From: Gennady Pospelov <g.pospelov@fz-juelich.de>
Date: Mon, 27 Apr 2020 11:57:46 +0200
Subject: [PATCH] Fix Qt5.14 warnings related to vector construction

---
 GUI/coregui/Models/Data1DViewItem.cpp                 | 10 ++++++++++
 .../IntensityDataWidgets/SaveProjectionsAssistant.cpp | 11 +++++++++++
 2 files changed, 21 insertions(+)

diff --git a/GUI/coregui/Models/Data1DViewItem.cpp b/GUI/coregui/Models/Data1DViewItem.cpp
index ff285ab0dbc..548fbadffd3 100644
--- a/GUI/coregui/Models/Data1DViewItem.cpp
+++ b/GUI/coregui/Models/Data1DViewItem.cpp
@@ -155,8 +155,18 @@ QPair<QVector<double>, QVector<double>> Data1DViewItem::graphData(Data1DProperti
     const auto data = DataViewUtils::getTranslatedData(this, property_item->dataItem());
     if (!data)
         return {};
+
+#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
+    auto centers = data->getAxis(0).getBinCenters();
+    auto values = data->getRawDataVector();
+    return {QVector<double>(centers.begin(), centers.end()),
+                   QVector<double>(values.begin(), values.end())};
+#else
     return {QVector<double>::fromStdVector(data->getAxis(0).getBinCenters()),
                 QVector<double>::fromStdVector(data->getRawDataVector())};
+#endif
+
+
 }
 
 JobItem* Data1DViewItem::jobItem()
diff --git a/GUI/coregui/Views/IntensityDataWidgets/SaveProjectionsAssistant.cpp b/GUI/coregui/Views/IntensityDataWidgets/SaveProjectionsAssistant.cpp
index 8037d7b48d8..e0744b47767 100644
--- a/GUI/coregui/Views/IntensityDataWidgets/SaveProjectionsAssistant.cpp
+++ b/GUI/coregui/Views/IntensityDataWidgets/SaveProjectionsAssistant.cpp
@@ -126,9 +126,20 @@ SaveProjectionsAssistant::projectionsData(const QString& projectionsType,
             data.axis_value = item->getItemValue(VerticalLineItem::P_POSX).toDouble();
             hist.reset(m_hist2d->projectionY(data.axis_value));
         }
+
+#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
+        auto values = hist->getBinValues();
+        auto centers = hist->getBinCenters();
+        data.bin_values = QVector<double>(values.begin(), values.end());
+        if (result.bin_centers.isEmpty())
+            result.bin_centers = QVector<double>(centers.begin(), centers.end());
+#else
         data.bin_values = QVector<double>::fromStdVector(hist->getBinValues());
         if (result.bin_centers.isEmpty())
             result.bin_centers = QVector<double>::fromStdVector(hist->getBinCenters());
+#endif
+
+
 
         result.projections.push_back(data);
     }
-- 
GitLab