QStringList list1;
list1 << "Project1" << "NewProject" << "Project2";
QStringList list2;
list2 << "Project1" << "Project2";
std::sort(list1.begin(), list1.end());
std::sort(list2.begin(), list2.end());
qDebug() << list1;
qDebug() << list2;
QStringList result;
std::set_difference(list1.begin(), list1.end(), list2.begin(), list2.end(), std::inserter(result, result.begin()));
qDebug() << result;
Как применять алгоритмы STL в Qt
To iterate over a list, you can either use index positions or QList's Java-style and STL-style iterator types: