2

What are the differences between QObjectList and QList? Can they be used interchangeably? If not, can a QList be cast to a QObjectList and vice versa?

2 Answers 2

6

QObjectList is an alias for QList<QObject *>.

QList<T> is a template class for lists of type T.

In other words, QList<T> is a generic class for lists of any type. QObjectList is a special case of QList, where T is a QObject pointer.

0
1

QList is the generic template version for lists.

QObjectList is a 'list of pointers to QObjects' and basically just a typedef on QList<QObject*>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.