#include
#include
#include
int main(int argc, char *argv[]){
QApplication a(argc, argv);
QWebView *view = new QWebView(0);
view->page()->mainFrame()->setScrollBarPolicy(Qt::Horizontal,Qt::ScrollBarAlwaysOff);
view->page()->setLinkDelegationPolicy(QWebPage::DelegateAllLinks);
view->settings()->setAttribute(QWebSettings::PluginsEnabled, true);
view->settings()->setAttribute(QWebSettings::JavascriptEnabled, true);
view->settings()->setAttribute(QWebSettings::JavascriptCanOpenWindows, true);
view->load(QUrl("http://www.google.com.tw/"));
//view->load(QUrl("http://tw.yahoo.com/"));
view->setWindowTitle("hello QtWebKit");
view->show();
return a.exec();
}
修改.pro文件,加入:QT +=webkit