c++qtqstringlist

QStringList contains throwing error


I've got a string I want to compare to the contents of a QStringList.

My string is held in test[1] and my QStringList is imagez.

I believe the QStringList::contains is what I need to use but I'm getting an error.

if(imagez::contains(test[1]) == true){
    foundFiles << file;
}

Error:

expected a class or namespace

Can someone help me out here please!


Solution

  • Since imagez is a pointer to an object, not a class name, you want the -> operator not the namespace qualifier (::). Like this:

    if(imagez->contains(test[1]))
    

    No need to compare booleans for equality to true.