QStringList list {"apple", "banana", "cherry", "date"}; for (auto it = list.cbegin(); it != list.cend(); ++it) { std::cout << *it << '\n'; }In this example, we create a QStringList object named "list" and initialize it with four string values. We then use a range-based for loop to iterate over the elements in the list using the cbegin() and cend() methods to get iterators pointing to the beginning and end of the list, respectively. In each iteration, we print the current element to the console. Package library: Qt. The QStringList class is part of the Qt library, which is a cross-platform application development framework.