From 15837659b061aab97717a1b31c4b764e72cd63c8 Mon Sep 17 00:00:00 2001 From: Gennady Pospelov <g.pospelov@fz-juelich.de> Date: Fri, 7 Oct 2016 10:34:16 +0200 Subject: [PATCH] Fix for older Qt with absence of QStringList comparison operator --- GUI/coregui/Models/ComboProperty.cpp | 3 +-- GUI/coregui/utils/GUIHelpers.cpp | 10 ++++++++++ GUI/coregui/utils/GUIHelpers.h | 2 ++ 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/GUI/coregui/Models/ComboProperty.cpp b/GUI/coregui/Models/ComboProperty.cpp index 3688fe5f8d3..a275ab757cb 100644 --- a/GUI/coregui/Models/ComboProperty.cpp +++ b/GUI/coregui/Models/ComboProperty.cpp @@ -74,8 +74,7 @@ void ComboProperty::setCachedValue(const QString &name) bool ComboProperty::operator==(const ComboProperty &other) const { if(m_current_value != other.m_current_value) return false; - if(m_values != other.m_values) return false; -// if(!GUIHelpers::isTheSame(m_values, other.m_values)) return false; + if(!GUIHelpers::isTheSame(m_values, other.m_values)) return false; // if(m_cached_value != other.m_cached_value) return false; // if(m_cache_contains_GUI_value != other.m_cache_contains_GUI_value) return false; return true; diff --git a/GUI/coregui/utils/GUIHelpers.cpp b/GUI/coregui/utils/GUIHelpers.cpp index 513a97e9c29..cdb49e1dfbf 100644 --- a/GUI/coregui/utils/GUIHelpers.cpp +++ b/GUI/coregui/utils/GUIHelpers.cpp @@ -245,5 +245,15 @@ QString createUuid() return QUuid::createUuid().toString(); } +bool isTheSame(const QStringList &lhs, const QStringList &rhs) +{ + if(lhs.size() != rhs.size()) return false; + for(int i=0; i<lhs.size(); ++i) + if(lhs.at(i) != rhs.at(i)) + return false; + + return true; +} + } // namespace GUIHelpers diff --git a/GUI/coregui/utils/GUIHelpers.h b/GUI/coregui/utils/GUIHelpers.h index 0456704d569..442aeb50a96 100644 --- a/GUI/coregui/utils/GUIHelpers.h +++ b/GUI/coregui/utils/GUIHelpers.h @@ -80,6 +80,8 @@ template<class T, class... Ts> std::unique_ptr<T> make_unique(Ts&&... params) BA_CORE_API_ QString createUuid(); +BA_CORE_API_ bool isTheSame(const QStringList &lhs, const QStringList &rhs); + } // namespace GUIHelpers #endif // GUIHELPERS_H -- GitLab