Qt QList - check for first item - bool conversion error
I can understand that it is a BOOL conversion. How to check for the first item in a QList inside an IF (condition)?
Thank you!
#include "mainwindow.h"
#include
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
QList group1 = {"Carl", "Hans", "Marcus"};
if (group1.first()){ //... error: No viable conversion from 'QString' to 'bool'
//Do this just for first item in QList;
} else {
//Do that in all other cases;
}
MainWindow w;
w.show();
return QApplication::exec();
}