QVectorvector = {1, 2, 3, 4, 5}; int count = vector.count(); qDebug() << "No. of elements in vector: " << count;
QVectorIn this example, we create a QVector of QString and initialize it with some names. We then use the count method to get the number of names present in the list. Library: The QVector class is part of the QtCore module of the Qt library.names = {"John", "Mike", "Dave", "Samantha"}; int count = names.count(); qDebug() << "No. of names in the list: " << count;