Älskar
Älskar

Reputation: 2579

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?

Upvotes: 2

Views: 1786

Answers (2)

bogl
bogl

Reputation: 1864

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.

Upvotes: 6

Zaiborg
Zaiborg

Reputation: 2522

QList is the generic template version for lists.

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

Upvotes: 1

Related Questions