Skip to content

Instantly share code, notes, and snippets.

@speakman
Created August 30, 2012 13:50
Show Gist options
  • Save speakman/3528936 to your computer and use it in GitHub Desktop.
Save speakman/3528936 to your computer and use it in GitHub Desktop.
#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