Thank you for the quick reply!
Alright so I added a QEventloop to make sure that it reaches initialLayoutCompleted(). I'm still new to siganls and slots but I believe this is right. It does print something now! However it doesn't make any sense. Its some random characters, but it should return an int. Also "int height" instead of "QString height" always returns a 0. Any suggestions?
Opage = new QWebPage(this);
Opage->mainFrame()->setHtml(reply->readAll());
QWebElement doc = Opage->mainFrame()->documentElement();
connect(Opage->mainFrame(),SIGNAL(initialLayoutCompleted()),&loop, SLOT(quit()));
loop.exec();
QWebElementCollection elements = doc.findAll("div");
foreach (QWebElement element, elements)
{
QString height
= element.
geometry().
height();
qDebug() << height;
}
Opage = new QWebPage(this);
Opage->mainFrame()->setHtml(reply->readAll());
QWebElement doc = Opage->mainFrame()->documentElement();
QEventLoop loop;
connect(Opage->mainFrame(),SIGNAL(initialLayoutCompleted()),&loop, SLOT(quit()));
loop.exec();
QWebElementCollection elements = doc.findAll("div");
foreach (QWebElement element, elements)
{
QString height = element.geometry().height();
qDebug() << height;
}
To copy to clipboard, switch view to plain text mode
Output:
"?"
"?"
""?"
"""""r"
""A"
"("
"""*"
""*"
""j"
""""?"
"U"
""
"`"
""
""
""P"
"?"
"?"
"<"
"""""i"
"?"
"?"
""?"
"""""r"
""A"
"("
"""*"
""*"
""j"
""""?"
"U"
""
"`"
""
""
""P"
"?"
"?"
"<"
"""""i"
To copy to clipboard, switch view to plain text mode
Bookmarks