J
J
JunPupil2015-12-26 23:05:41
Qt
JunPupil, 2015-12-26 23:05:41

How to pull an element from QList using indexOf?

hello, there is

struct Struct
{
int A;
int B;
};

QList<Struct*> list;

and you need to get the first occurrence of element A. that is, a la
list.indexOf(Struct.A == 0);
but this option will obviously not work, what should I do in this case?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
T
TriKrista, 2015-12-26
@JunPupil

indexOf and returns the position index of the first occurrence, or -1.
Perhaps you still need to redefine the == operator in the structure.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question