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";
}
これにより、次の結果が得られます。
「構文エラー: 行の解析エラー: 1 ソース: 未定義」
セグメンテーション違反
エラーは、リスト項目を関数に渡す方法にあると推測していますevaluateJavaScript
。
アップデート:
私はこれを試しました:
for (int i = 0; i < centerPointsList.size (); i++)
{
QVariant holdInformation = map->page ()->mainFrame ()->evaluateJavaScript (QString ("constructFileName (%1)").arg (centerPointsList [0].toFloat ()));
その結果:
「TypeError: 式 'centerPointFileName.split' [未定義] の結果は関数ではありません。行:65 ソース:file:///.../index.html」
関数constructFileName
(Javascript) は次のとおりです。
function constructFileName (centerPointFileName)
{
var removeSpaces = centerPointFileName.split (" ");
var fileNameWithoutSpaces = "", i;
for (i = 0; i < removeSpaces.length; i++)
fileNameWithoutSpaces = fileNameWithoutSpaces + removeSpaces [i];