Get rid of deprecation warning when compiling against Qt 5.15

In Qt 5.15 the comparison operator for QVariant got deprecated.
Fix the warning by substituting comparison operator by custom
method.

Change-Id: I1a5c4ab6742a6d8d85f6cff5a73d5f49c2d5aa73
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
This commit is contained in:
Jarek Kobus
2020-11-16 12:02:01 +01:00
parent 5da4c61f6c
commit ad2d635a09
@@ -105,23 +105,26 @@ bool operator ==(const InformationContainer &first, const InformationContainer &
&& first.m_thirdInformation == second.m_thirdInformation;
}
#if QT_VERSION < QT_VERSION_CHECK(5, 2, 0) || QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
static bool operator <(const QVariant &first, const QVariant &second)
static bool isFirstLessThenSecond(const QVariant &first, const QVariant &second)
{
#if QT_VERSION < QT_VERSION_CHECK(5, 2, 0) || QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
if (first.userType() == second.userType()) {
if (first.canConvert<QByteArray>())
return first.value<QByteArray>() < second.value<QByteArray>();
}
return true;
}
#else
return first < second;
#endif
}
bool operator <(const InformationContainer &first, const InformationContainer &second)
{
return (first.m_instanceId < second.m_instanceId)
|| (first.m_instanceId == second.m_instanceId && first.m_name < second.m_name)
|| (first.m_instanceId == second.m_instanceId && first.m_name == second.m_name && first.m_information < second.m_information);
|| (first.m_instanceId == second.m_instanceId && first.m_name == second.m_name
&& isFirstLessThenSecond(first.m_information, second.m_information));
}
QDebug operator <<(QDebug debug, const InformationContainer &container)