1 #include "webpage.h" 2 #include <QDesktopServices> 3 #include <QWebFrame> 4 #include <QNetworkRequest> 5 WebPage(QObject * parent)6WebPage::WebPage(QObject *parent) : QWebPage(parent) 7 { 8 } 9 ~WebPage()10WebPage::~WebPage() 11 { 12 } 13 acceptNavigationRequest(QWebFrame * frame,const QNetworkRequest & request,QWebPage::NavigationType type)14bool WebPage::acceptNavigationRequest(QWebFrame *frame, const QNetworkRequest &request, QWebPage::NavigationType type) 15 { 16 if (!frame) 17 { 18 QDesktopServices::openUrl(request.url()); 19 return false; 20 } 21 else 22 { 23 return QWebPage::acceptNavigationRequest(frame, request, type); 24 } 25 } 26 27