Search code examples
qtqobjectqlist

QObjectList and QList Differences


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?


Solution

  • 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.