我似乎无法弄清楚这一点!我不断收到一条错误消息,上面写着“'*' 标记之前的预期主表达式”,没有其他提示。它发生在看起来像的线上
todoList->addItem(QListWidgetItem *taskStr->append(taskQry.value(1).toString()));
这是什么意思,从我通过搜索发现它似乎是一个语法错误,但有人可以向我解释为什么它是一个语法错误吗?有没有更好的方法将字符串附加到列表中?
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());
}