私はこれを理解できないようです!「'*'トークンの前にプライマリ式が必要です」というエラーが表示され続けますが、他のヒントはありません。それは次のように見えるラインで起こります
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());
}