Я пытаюсь написать простую программу просмотра журналов, используя порт/реализацию Qt4 WebKit. Мой HTML-код выглядит так:
В частности, я пытаюсь выяснить, как вызвать функцию add_message(), которая определена в разделе <script>
в документе HTML из моего кода C++.
// Doesn't work:
QWebElement targetElement = chatView->page()->mainFrame()->findFirstElement("head").firstChild("script");
// Function is not included, either...
qDebug() << targetElement.tagName() << targetElement.functions();
// The ultimate attempt in calling the function anyway:
QVariant functionResult = targetElement.callFunction("add_message");