QVector indexOf is a function in the Qt framework that is used to find the index of an element in a QVector container. It returns the first index where the element is found, or -1 if it is not found.
Example 1: Finding the index of an element in a QVector
QVector vec {2, 4, 6, 8, 10};
int index = vec.indexOf(6); // returns 2
Example 2: Searching for a string in a QVector of QStrings
QVector vec {"apple", "banana", "orange"};
int index = vec.indexOf("banana"); // returns 1
This function is part of the Qt Core library.
C++ (Cpp) QVector::indexOf - 30 examples found. These are the top rated real world C++ (Cpp) examples of QVector::indexOf from package gcc-4.6.2-human68k extracted from open source projects. You can rate examples to help us improve the quality of examples.