2010年12月24日 星期五

Qt Webkit demo

#include
#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

2010年12月9日 星期四

google好手氣

原來google好手氣可以這樣用
在支援網址列搜尋的瀏覽器(如sleipnir、opera、lunascape...等)中設定以
http://www.google.com.tw/search?btnI=I%27m+Feeling+Lucky&ie=UTF-8&oe=UTF-8&q=
當作搜尋引擎
只要在網址列打上要打開網站的關鍵字(如yahoo、mobile01)
就可以直接進入該網站了
對我這樣的懶人來說超方便的^^b