コード例 #1
0
void tst_QWebInspector::attachAndDestroy()
{
    {   // External inspector + manual destruction of page first
        QWebPage* page = new QWebPage();
        page->settings()->setAttribute(QWebSettings::DeveloperExtrasEnabled, true);
        QWebInspector* inspector = new QWebInspector();
        inspector->setPage(page);
        page->updatePositionDependentActions(QPoint(0, 0));
        page->triggerAction(QWebPage::InspectElement);

        delete page;
        delete inspector;
    }
    {   // External inspector + manual destruction of inspector first
        QWebPage* page = new QWebPage();
        page->settings()->setAttribute(QWebSettings::DeveloperExtrasEnabled, true);
        QWebInspector* inspector = new QWebInspector();
        inspector->setPage(page);
        page->updatePositionDependentActions(QPoint(0, 0));
        page->triggerAction(QWebPage::InspectElement);

        delete inspector;
        delete page;
    }
    {   // Internal inspector
        QWebPage page;
        page.settings()->setAttribute(QWebSettings::DeveloperExtrasEnabled, true);
        page.updatePositionDependentActions(QPoint(0, 0));
        page.triggerAction(QWebPage::InspectElement);
    }
}
コード例 #2
0
ファイル: qwebpageproto.cpp プロジェクト: dwatson78/qt-client
void QWebPageProto::updatePositionDependentActions(const QPoint & pos)
{
  QWebPage *item = qscriptvalue_cast<QWebPage*>(thisObject());
  if (item)
    item->updatePositionDependentActions(pos);
}