@Dong
Hello,
Sorry for the late reply. Yes, you've got the essence of it. Qt's containers (QList included) are pretty smart in respect to copying, they will not copy the actual data until you change it. They are implicitly shared. This is done so you can return and copy the container many times, but in actuality internally only a pointer is reassigned and reference counter updated. When you call a non-const function on that list, Qt checks the reference counter and if more than one object is attached to the data, then and only then the data is detached (copied). When you put your list in the QVariant it is stored by value (making a shallow copy), but QVariant will return a shallow copy as well (meaning the data will not be changed, only the internal pointer reassigned and reference counter incremented).
Now, for your particular case:
The first line of code works, because you don't modify the list, but take an element (which is a pointer) and modify the object the list is holding reference to. This doesn't cause the list data to be copied. The second line you have, doesn't work, because you're changing the list data (assigning a new value to a list's element), which causes the list data to be detached and in practice, you're operating on a completely different set of data.
Here is a reference if you're interested in the way QList and other containers manage their data, and what implicit sharing is.