Sure! Why couldn't we? QList is a regular C++ class... See, all classes even those commonly created/used as objects/references can be instanciated/used as pointers but the contrary isn't true (widgets for instances must be passed as pointers because a copy, even an implicit one would cause a segfault...)
AFAIK the only advantage is when you actually want to share data between several objects. i.e. any modification done by one of the owner will be known to the others. On the contrary if you want modifications to cause forks implicitely Qt takes care of it and pointers make it tricky. As it has already been said, "return by copy" is painless and everythin with such classes is painless as long as you only use const references which can't cause deep copy.





Reply With Quote
Bookmarks