I can’t seem to figure this out! I keep getting an error that says “expected primary-expression before ‘*’ token” with no other hints. It happens on the line that looks like
todoList->addItem(QListWidgetItem *taskStr->append(taskQry.value(1).toString()));
What does this mean, from what I found by searching it seems to be a syntax error, but could somebody explain to me why it’s a syntax error? Is there a better way to attach strings to a list?
todoList = new QListWidget(todoGroupBox);
QSqlDatabase localdb = QSqlDatabase::database("TestERP");
if (localdb.open())
{
QSqlQuery taskQry;
if (taskQry.exec("SELECT * FROM erp_data.todo_lists;"))
{
if (taskQry.value(1).toString() == "")
{
QMessageBox::information(this,"No Connection","Nothing in the Manufacturer Database\n"
"\nError: " + db.lastError().text());
}
else
{
while (taskQry.next())
{
QString *taskStr = new QString;
todoList->addItem(QListWidgetItem *taskStr->append(taskQry.value(1).toString()));
}
}
}
else
{
QMessageBox::information(new QWidget,"Not Connected","Connection to the Database could not be Established\n"
"\nError: " + db.lastError().text());
}
}
else
{
QMessageBox::information(new QWidget,"Not Connected","Connection to the Database could not be Established\n"
"\nError: " + db.lastError().text());
}
I am not sure what you are trying to do. But this will make it compiled: