Created
August 30, 2012 13:50
-
-
Save speakman/3528936 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <QApplication> | |
#include <QWebView> | |
#include <QWebPage> | |
#include <QUrl> | |
class WebView : public QWebView | |
{ | |
Q_OBJECT | |
public: | |
WebView(QWidget *parent = 0); | |
}; | |
class WebPage : public QWebPage | |
{ | |
Q_OBJECT | |
public: | |
WebPage(QObject *parent = 0) : QWebPage(parent) { | |
} | |
virtual QWebPage *createWindow(QWebPage::WebWindowType) | |
{ | |
QWebView *view = new WebView(); | |
return view->page(); | |
} | |
}; | |
WebView::WebView(QWidget *parent) : QWebView(parent) { | |
setPage(new WebPage(this)); | |
connect(this->page(), SIGNAL(windowCloseRequested()), this, SLOT(deleteLater())); | |
} | |
int main(int argc, char *argv[]) | |
{ | |
QApplication a(argc, argv); | |
WebView view; | |
QWebSettings::globalSettings()->setAttribute(QWebSettings::DeveloperExtrasEnabled, true); | |
view.load(QUrl("http://help.dottoro.com/external/examples/ljdlgxbu/showModalDialog_1.htm")); | |
view.show(); | |
return a.exec(); | |
} | |
#include "main.moc" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment