Solved Help with deprecated code
-
Hi,
I had this code working fine in 5.12.4 but when I upgraded to 5.15, I now get warnings on this deprecated code. Any ideas how to fix it?
std::sort(list.begin(), list.end(),[column,order](const QList<QVariant>list, const QList<QVariant>list1)->bool { const auto aV = list.at(column); const auto bV = list1.at(column); if(order == Qt::AscendingOrder) return aV == bV ? list.at(1) < list1.at(1) : aV < bV; return aV == bV ? list.at(1) > list1.at(1) : aV > bV; });
-
-
@leinad
bool QVariant::operator<(const QVariant &v) const
is deprecated as per https://doc.qt.io/qt-5/qvariant-obsolete.html#operator-lt. -
basically you need to convert them into the underlying type before comparing them
-
Yes, but would you know how to fix this particular issue?
-
OK, I see. I converted to QString which seems to fix the error.