I want to pick subelements from a Qaxobject,but it is failed with Vs2015:
QAxObject* MyFrames
= MyWebObj
->querySubObject
("Document")->querySubObject
("Frames");
foreach
(QAxObject* MyFrame, MyFrames
)//somethingwrong here.... {
x += MyFrame->querySubObject("Document")->querySubObject("All")
->querySubObject("Item(Int32)", 0)->dynamicCall("OuterHtml()").toString();
}
QAxObject* MyAll
=MyWebObj
->querySubObject
("Document")->querySubObject
("All")->querySubObject
("Item(Int32)",
0);
x= MyAll->dynamicCall("OuterHtml()").toString();//workable
qDebug() << x;
return x;
QString x = "";
QAxObject* MyFrames = MyWebObj->querySubObject("Document")->querySubObject("Frames");
foreach(QAxObject* MyFrame, MyFrames)//somethingwrong here....
{
x += MyFrame->querySubObject("Document")->querySubObject("All")
->querySubObject("Item(Int32)", 0)->dynamicCall("OuterHtml()").toString();
}
QAxObject* MyAll=MyWebObj->querySubObject("Document")->querySubObject("All")->querySubObject("Item(Int32)", 0);
x= MyAll->dynamicCall("OuterHtml()").toString();//workable
qDebug() << x;
return x;
To copy to clipboard, switch view to plain text mode
so I have to change it with for loop:
QAxObject* MyFrames
= MyWebObj
->querySubObject
("Document")->querySubObject
("Frames");
x = MyWebObj->querySubObject("Document")->querySubObject("All")
->querySubObject("Item(Int32)", 0)->dynamicCall("OuterHtml()").toString();
for(int i=0;;i++)
{
MyFrame = MyFrames->querySubObject("Item(Int32)", i);
if (!MyFrame) break;
x += MyFrame->querySubObject("Document")->querySubObject("All")
->querySubObject("Item(Int32)", 0)->dynamicCall("OuterHtml()").toString();
}
qDebug() << x;
return x;
QString x = "";
QAxObject* MyFrames = MyWebObj->querySubObject("Document")->querySubObject("Frames");
QAxObject* MyFrame = 0;
x = MyWebObj->querySubObject("Document")->querySubObject("All")
->querySubObject("Item(Int32)", 0)->dynamicCall("OuterHtml()").toString();
for(int i=0;;i++)
{
MyFrame = MyFrames->querySubObject("Item(Int32)", i);
if (!MyFrame) break;
x += MyFrame->querySubObject("Document")->querySubObject("All")
->querySubObject("Item(Int32)", 0)->dynamicCall("OuterHtml()").toString();
}
qDebug() << x;
return x;
To copy to clipboard, switch view to plain text mode
My question is how to use foreach with Qaxobject, as it looks more simple.
Bookmarks