我需要加载html页面的QWebPage (因为我在控制台应用程序中,不能使用QWebView)。
当我这么做时:
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;
}我有一个错误:
/home/morgan/htmltopdf/webview.cpp:28: error: invalid use of incomplete type 'class QWebFrame'
frame->load(QUrl::fromLocalFile(args->getSource()));
^发布于 2014-08-04 10:38:02
您需要#include <QWebFrame>,这里缺少QWebFrame的定义。
https://stackoverflow.com/questions/25116761
复制相似问题