0
for (int i = 0; i < centerPointsList.size(); i++)
{
QVariant holdInformation = map->page()->mainFrame()->evaluateJavaScript (QString ("constructFileName (%1).arg (centerPointsList[0].toFloat())"));
QList <QVariant> allListObj = holdInformation.toList();
QList <QVariant> fileNamesList = allListObj[0].toList();
std :: cout << fileNamesList[0].toFloat() << "================= \n";
}
這導致:如何將參數傳遞給evaluateJavaScript函數?
"SyntaxError: Parse error on line:1 Source:undefined"
Segmentation fault
我猜測的錯誤是在我傳遞的列表項功能evaluateJavaScript
的方式。
UPDATE:
我嘗試這樣做:
for (int i = 0; i < centerPointsList.size(); i++)
{
QVariant holdInformation = map->page()->mainFrame()->evaluateJavaScript (QString ("constructFileName (%1)").arg (centerPointsList [0].toFloat()));
這導致:
"TypeError: Result of expression 'centerPointFileName.split' [undefined] is not a function. on line:65 Source:file:///.../index.html"
函數constructFileName
(在Javascript)如下:
您是否在尋找'QString(「constructFileName(%1)」)。arg(centerPointsList [0] .toFloat())' ? – DCoder
@DCoder請參閱更新。 –