c – 从QVariantList获取字符串
我的数据库中的数据位于QVariantList中,我想循环遍历它并获取firstname.
QVariantList sqlData = database->loadDatabase("quotes.db", "quotes");
for (int i = 1; i <= sqlData.size(); i++)
{
qDebug() << sqlData.value(i);
}
这会产生:
Debug: QVariant(QVariantMap, QMap(("firstname", QVariant(QString, "Glenford") ) ( "id" , QVariant(qlonglong, 2) ) ( "lastname" , QVariant(QString, "Myers") ) ( "quote" , QVariant(QString, "We try to solve the problem by rushing through the design process so that enough time will be left at the end of the project to uncover errors that were made because we rushed through the design process.") ) ) )
我怎样才能调试“firstname”的值?例如debug = Glenford.
谢谢