コード例 #1
0
ファイル: WebPage.cpp プロジェクト: GarPit/capybara-webkit
WebPage::WebPage(WebPageManager *manager, QObject *parent) : QWebPage(parent) {
  m_loading = false;
  m_manager = manager;
  m_uuid = QUuid::createUuid().toString();
  m_lastStatus = 0;

  setForwardUnsupportedContent(true);
  loadJavascript();
  setUserStylesheet();

  this->setCustomNetworkAccessManager();

  connect(this, SIGNAL(loadStarted()), this, SLOT(loadStarted()));
  connect(this, SIGNAL(loadFinished(bool)), this, SLOT(loadFinished(bool)));
  connect(this, SIGNAL(frameCreated(QWebFrame *)),
          this, SLOT(frameCreated(QWebFrame *)));
  connect(this, SIGNAL(unsupportedContent(QNetworkReply*)),
      this, SLOT(handleUnsupportedContent(QNetworkReply*)));
  connect(this, SIGNAL(pageFinished(bool)),
      m_manager, SLOT(emitPageFinished(bool)));
  connect(this, SIGNAL(loadStarted()),
      m_manager, SLOT(emitLoadStarted()));
  resetWindowSize();

  settings()->setAttribute(QWebSettings::JavascriptCanOpenWindows, true);
}
コード例 #2
0
WebPage *WebPageManager::createPage() {
  WebPage *page = new WebPage(this);
  connect(page, SIGNAL(loadStarted()),
          this, SLOT(emitLoadStarted()));
  connect(page, SIGNAL(pageFinished(bool)),
          this, SLOT(setPageStatus(bool)));
  connect(page, SIGNAL(requestCreated(QByteArray &, QNetworkReply *)),
          this, SLOT(requestCreated(QByteArray &, QNetworkReply *)));
  append(page);
  return page;
}