I'm trying to return a list of matches returned from a QRegularExpression to a QList with this code below:
QList<QString> list();
QString str ("something by the way");
QRegularExpression reA("pattern");
QRegularExpressionMatchIterator i = reA.globalMatch(str);
while (i.hasNext()) {
QRegularExpressionMatch match = i.next();
if (match.hasMatch()) {
list.append(match.captured(0));
}
}
return list;
...But it shows me this errors:
/home/path/.../file:line# error: request for member 'append' in 'list', which is of non-class type 'QList<QString>()'
list.append(match.captured(0));
/home/path/.../file:line#: error: could not convert 'list' from 'QList<QString> (*)()' to 'QList<QString>'
return list;
How can i get it working, I've tried to cast into many types.