Пример #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
void TestRunner::setTextDirection(JSStringRef directionName)
{
    QWebPage* webPage = DumpRenderTree::instance()->webPage();
    if (JSStringIsEqualToUTF8CString(directionName, "auto"))
        webPage->triggerAction(QWebPage::SetTextDirectionDefault);
    else if (JSStringIsEqualToUTF8CString(directionName, "rtl"))
        webPage->triggerAction(QWebPage::SetTextDirectionRightToLeft);
    else if (JSStringIsEqualToUTF8CString(directionName, "ltr"))
        webPage->triggerAction(QWebPage::SetTextDirectionLeftToRight);
}
Пример #3
0
void QWebPageProto::triggerAction(QWebPage::WebAction action, bool checked)
{
  QWebPage *item = qscriptvalue_cast<QWebPage*>(thisObject());
  if (item)
    item->triggerAction(action, checked);
}