Beispiel #1
0
QWidget* QWebPageProto::view() const
{
  QWebPage *item = qscriptvalue_cast<QWebPage*>(thisObject());
  if (item)
    return item->view();
  return 0;
}
Beispiel #2
0
void BrowserDialog::unsupportedContent(QNetworkReply *reply)
{
    try {
        QWebPage *page = qobject_cast<QWebPage*>(sender());
        if (page == nullptr) {
            qCritical("sender not a page");
            return;
        }
        BrowserView *view = qobject_cast<BrowserView*>(page->view());
        if (view == nullptr) {
            qCritical("no view?");
            return;
        }

        emit requestDownload(view->url(), reply);
    } catch (const std::exception &e) {
        if (isVisible()) {
            MessageDialog::showMessage(tr("failed to start download"), this);
        }
        qCritical("exception downloading unsupported content: %s", e.what());
    }
}