QList<QStringList> 求最大值

江南王小帅 / 2024-10-09 / 原文

double findMaxValue(const QList<QStringList>& list) {
    double maxValue = std::numeric_limits<double>::lowest();

    for (const QStringList& stringList : list) {
        for (const QString& str : stringList) {
            bool ok;
            double value = str.toDouble(&ok);
            if (ok) {
                maxValue = std::max(maxValue, value);
            }
        }
    }
    return maxValue;
}