QListnumbers = {1, 2, 3, 4, 5, 6}; QList subList = numbers.mid(2, 3); // subList contains {3, 4, 5}
QListThis example creates a QList of QStrings called `fruits` containing 5 different fruits. `startWithC` is assigned a new QList object created using the `mid()` function, starting at index 2 (which contains the string "cherry") and including all of the elements after that (which are "cherry", "date", and "elderberry"). The `mid()` function is part of the Qt Core library.fruits = {"apple", "banana", "cherry", "date", "elderberry"}; QList startWithC = fruits.mid(2); // startWithC contains {"cherry", "date", "elderberry"}