QStringList fruits; fruits << "Apple" << "Banana" << "Grapes" << "Pineapple"; fruits.removeAt(2); // Removes the item at index 2 (i.e. "Grapes") // fruits now contains {"Apple", "Banana", "Pineapple"}
QStringList numbers; numbers << "One" << "Two" << "Three" << "Four" << "Five"; numbers.removeAt(2); // Removes the item at index 2 (i.e. "Three") numbers.removeAt(3); // Removes the item at index 3 (i.e. "Five") // numbers now contains {"One", "Two", "Four"}In both examples, the removeAt() method is called on the QStringList object to remove the item(s) at the specified index(es). The resulting QStringList object contains the remaining items in the same order as before.