I want QWebPage for load html page (because I am in console application and I can't use QWebView).
When I do this :
bool webview::load(Arguments *args)
{
QRegularExpression url("^(file|http)://");
QRegularExpression fullPath("^/");
QRegularExpressionMatch pathMatch = fullPath.match(args->getSource());
QRegularExpressionMatch urlMatch = url.match(args->getSource());
frame = navigateur->mainFrame();
if(pathMatch.hasMatch()) {
frame->load(QUrl::fromLocalFile(args->getSource()));
} else {
if (urlMatch.hasMatch()) {
frame->load(QUrl(args->getSource()));
} else {
fprintf(stderr, "%s\n", qPrintable(QCoreApplication::translate("main", "Error: Invalide source file")));
return false;
}
}
return true;
}
I have this error :
/home/morgan/htmltopdf/webview.cpp:28: error: invalid use of incomplete type 'class QWebFrame'
frame->load(QUrl::fromLocalFile(args->getSource()));
^