当前位置: 首页>>代码示例>>C++>>正文


C++ QWebPageClient类代码示例

本文整理汇总了C++中QWebPageClient的典型用法代码示例。如果您正苦于以下问题:C++ QWebPageClient类的具体用法?C++ QWebPageClient怎么用?C++ QWebPageClient使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了QWebPageClient类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: screenDepthPerComponent

int screenDepthPerComponent(Widget* w)
{
#if HAVE(QT5)
    int depth = QGuiApplication::primaryScreen()->depth();
    // FIXME: Use widget's screen
    Q_UNUSED(w);
#else
    int depth = QApplication::desktop()->screen(0)->depth();
    if (w) {
        QWebPageClient* client = w->root()->hostWindow()->platformPageClient();

        if (client) {
            QWidget* view = client->ownerWidget();
            if (view)
                depth = view->depth();
        }
    }
#endif
    // An interface to establish the actual number of bits per color
    // doesn't exist in Qt, or probably at all, so use common-sense
    // values for each screen depth and assume RGB/RGBA where appropriate.
    // Per http://www.w3.org/TR/css3-mediaqueries/#color, 'If different color
    // components are represented by different number of bits, the smallest
    // number is used.'
    switch (depth) {
    case 8:
        return 2;
    case 32:
        return 8;
    default:
        return depth / 3;
    }
}
开发者ID:,项目名称:,代码行数:33,代码来源:

示例2: ASSERT

bool PluginView::platformStart()
{
    ASSERT(m_isStarted);
    ASSERT(m_status == PluginStatusLoadedSuccessfully);
    
    show();

    if (m_isWindowed) {
        QWebPageClient* client = m_parentFrame->view()->hostWindow()->platformPageClient();
        // FIXME this will not work for QGraphicsView.
        // But we cannot use winId because it will create a window and on S60,
        // QWidgets should not create a window. 
        Q_ASSERT(qobject_cast<QWidget*>(client->pluginParent()));
        setPlatformWidget(new PluginContainerSymbian(this, 
            qobject_cast<QWidget*>(client->pluginParent())));
        m_npWindow.type = NPWindowTypeWindow;
        m_npWindow.window = (void*)platformPluginWidget();

    } else {
        setPlatformWidget(0);
        m_npWindow.type = NPWindowTypeDrawable;
        m_npWindow.window = 0; // Not used?
    }    
    setNPWindowIfNeeded();
    
    return true;
}
开发者ID:Nacto1,项目名称:qt-everywhere-opensource-src-4.6.2,代码行数:27,代码来源:PluginViewSymbian.cpp

示例3: switch

bool PluginView::platformGetValue(NPNVariable variable, void* value, NPError* result)
{
    switch (variable) {
    case NPNVxDisplay:
        *(void **)value = QX11Info::display();
        *result = NPERR_NO_ERROR;
        return true;

    case NPNVxtAppContext:
        *result = NPERR_GENERIC_ERROR;
        return true;

    case NPNVnetscapeWindow: {
        void* w = reinterpret_cast<void*>(value);
        QWebPageClient* client = m_parentFrame->view()->hostWindow()->platformPageClient();
        *((XID *)w) = client ? client->ownerWidget()->window()->winId() : 0;
        *result = NPERR_NO_ERROR;
        return true;
    }

    case NPNVToolkit:
        if (m_plugin->quirks().contains(PluginQuirkRequiresGtkToolKit)) {
            *((uint32_t *)value) = 2;
            *result = NPERR_NO_ERROR;
            return true;
        }
        return false;

    default:
        return false;
    }
}
开发者ID:Moondee,项目名称:Artemis,代码行数:32,代码来源:PluginViewQt.cpp

示例4: switch

bool PluginView::platformGetValue(NPNVariable variable, void* value, NPError* result)
{
    switch (variable) {
    case NPNVxDisplay:
        *reinterpret_cast<void**>(value) = x11Display();
        *result = NPERR_NO_ERROR;
        return true;

    case NPNVxtAppContext:
        *result = NPERR_GENERIC_ERROR;
        return true;

    case NPNVnetscapeWindow: {
        QWebPageClient* client = platformPageClient();
        QWindow* window = client ? client->ownerWindow() : 0;
        *reinterpret_cast<XID*>(value) = window ? window->winId() : 0;
        *result = NPERR_NO_ERROR;
        return true;
    }

    case NPNVToolkit:
        if (m_plugin->quirks().contains(PluginQuirkRequiresGtkToolKit)) {
            *((uint32_t *)value) = 2;
            *result = NPERR_NO_ERROR;
            return true;
        }
        return false;

    default:
        return false;
    }
}
开发者ID:webOS-ports,项目名称:webkit,代码行数:32,代码来源:PluginViewQt.cpp

示例5: ASSERT

bool PluginView::platformStart()
{
    ASSERT(m_isStarted);
    ASSERT(m_status == PluginStatusLoadedSuccessfully);
    
    show();

    if (m_isWindowed) {
        QWebPageClient* client = m_parentFrame->view()->hostWindow()->platformPageClient();
        QGraphicsProxyWidget* proxy = 0;
        if (QGraphicsWebView *webView = qobject_cast<QGraphicsWebView*>(client->pluginParent()))
            proxy = new QGraphicsProxyWidget(webView);

        PluginContainerSymbian* container = new PluginContainerSymbian(this, proxy ? 0 : client->ownerWidget(), proxy);
        setPlatformWidget(container);
        if (proxy)
            proxy->setWidget(container);
        
        m_npWindow.type = NPWindowTypeWindow;
        m_npWindow.window = (void*)platformPluginWidget();

    } else {
        setPlatformWidget(0);
        m_npWindow.type = NPWindowTypeDrawable;
        m_npWindow.window = 0; // Not used?
    }    
    updatePluginWidget();
    setNPWindowIfNeeded();

    if (qtwebkit_page_plugin_created)
        qtwebkit_page_plugin_created(QWebFramePrivate::kit(m_parentFrame.get()), m_instance, (void*)(m_plugin->pluginFuncs()));

    return true;
}
开发者ID:0omega,项目名称:platform_external_webkit,代码行数:34,代码来源:PluginViewSymbian.cpp

示例6: memset

void PluginView::initXEvent(XEvent* xEvent)
{
    memset(xEvent, 0, sizeof(XEvent));

    QWebPageClient* client = m_parentFrame->view()->hostWindow()->platformPageClient();
    QWidget* ownerWidget = client ? client->ownerWidget() : 0;
    setSharedXEventFields(xEvent, ownerWidget);
}
开发者ID:Mr-Kumar-Abhishek,项目名称:qt,代码行数:8,代码来源:PluginViewQt.cpp

示例7: screenNumber

static int screenNumber(Widget* w)
{
    if (!w)
        return 0;

    QWebPageClient* client = w->root()->hostWindow()->platformPageClient();
    return client ? client->screenNumber() : 0;
}
开发者ID:,项目名称:,代码行数:8,代码来源:

示例8: platformPageClient

void ChromeClientQt::setCursor(const Cursor& cursor)
{
#ifndef QT_NO_CURSOR
    QWebPageClient* pageClient = platformPageClient();
    if (!pageClient)
        return;
    pageClient->setCursor(*cursor.platformCursor());
#else
    UNUSED_PARAM(cursor);
#endif
}
开发者ID:,项目名称:,代码行数:11,代码来源:

示例9: qStyle

QStyle* RenderThemeQStyle::qStyle() const
{
    if (m_page) {
        QWebPageClient* pageClient = m_page->chrome()->client()->platformPageClient();

        if (pageClient)
            return pageClient->style();
    }

    return QApplication::style();
}
开发者ID:,项目名称:,代码行数:11,代码来源:

示例10: screenDepthPerComponent

int screenDepthPerComponent(Widget* w)
{
    if (w) {
        QWebPageClient* client = w->root()->hostWindow()->platformPageClient();

        if (client) {
            QWidget* view = client->ownerWidget();
            if (view)
                return view->depth();
        }
    }
    return QApplication::desktop()->screen(0)->depth();
}
开发者ID:azrul2202,项目名称:WebKit-Smartphone,代码行数:13,代码来源:PlatformScreenQt.cpp

示例11: USE

QStyle* RenderThemeQt::qStyle() const
{
#if USE(QT_MOBILE_THEME)
    return fallbackStyle();
#endif

    if (m_page) {
        QWebPageClient* pageClient = m_page->chrome()->client()->platformPageClient();

        if (pageClient)
            return pageClient->style();
    }

    return QApplication::style();
}
开发者ID:sanyaade-mobiledev,项目名称:Webkit-Projects,代码行数:15,代码来源:RenderThemeQt.cpp

示例12: setPaletteFromPageClientIfExists

void RenderThemeQt::setPaletteFromPageClientIfExists(QPalette& palette) const
{
    // If the webview has a custom palette, use it
    if (!m_page)
        return;
    Chrome* chrome = m_page->chrome();
    if (!chrome)
        return;
    ChromeClient* chromeClient = chrome->client();
    if (!chromeClient)
        return;
    QWebPageClient* pageClient = chromeClient->platformPageClient();
    if (!pageClient)
        return;
    palette = pageClient->palette();
}
开发者ID:,项目名称:,代码行数:16,代码来源:

示例13: setInputMethodState

void EditorClientQt::setInputMethodState(bool active)
{
    QWebPageClient* webPageClient = m_page->d->client.get();
    if (webPageClient) {
        Qt::InputMethodHints hints;

        HTMLInputElement* inputElement = 0;
        Frame* frame = m_page->d->page->focusController()->focusedOrMainFrame();
        if (frame && frame->document() && frame->document()->focusedNode())
            if (frame->document()->focusedNode()->hasTagName(HTMLNames::inputTag))
                inputElement = static_cast<HTMLInputElement*>(frame->document()->focusedNode());

        if (inputElement) {
            // Set input method hints for "number", "tel", "email", "url" and "password" input elements.
            if (inputElement->isTelephoneField())
                hints |= Qt::ImhDialableCharactersOnly;
            if (inputElement->isNumberField())
                hints |= Qt::ImhDigitsOnly;
            if (inputElement->isEmailField())
                hints |= Qt::ImhEmailCharactersOnly;
            if (inputElement->isURLField())
                hints |= Qt::ImhUrlCharactersOnly;
            // Setting the Qt::WA_InputMethodEnabled attribute true and Qt::ImhHiddenText flag
            // for password fields. The Qt platform is responsible for determining which widget
            // will receive input method events for password fields.
            if (inputElement->isPasswordField()) {
                active = true;
                hints |= Qt::ImhHiddenText;
            }
        }

#if defined(Q_WS_MAEMO_5) || defined(Q_WS_MAEMO_6) || defined(Q_OS_SYMBIAN)
        // disables auto-uppercase and predictive text for mobile devices
        hints |= Qt::ImhNoAutoUppercase;
        hints |= Qt::ImhNoPredictiveText;
#endif // Q_WS_MAEMO_5 || Q_WS_MAEMO_6 || Q_OS_SYMBIAN
        webPageClient->setInputMethodHints(hints);
        webPageClient->setInputMethodEnabled(active);
    }
    emit m_page->microFocusChanged();
}
开发者ID:minxy55,项目名称:webkit4ezport,代码行数:41,代码来源:EditorClientQt.cpp

示例14: show

void PopupMenu::show(const IntRect& r, FrameView* v, int index)
{
    QWebPageClient* client = v->hostWindow()->platformPageClient();
    populate(r);
    QRect rect = r;
    rect.moveTopLeft(v->contentsToWindow(r.topLeft()));
    rect.setHeight(m_popup->sizeHint().height());

    if (QGraphicsView* view = qobject_cast<QGraphicsView*>(client->ownerWidget())) {
        if (!m_proxy) {
            m_proxy = new QGraphicsProxyWidget(qobject_cast<QGraphicsWebView*>(client->pluginParent()));
            m_proxy->setWidget(m_popup);
        } else
            m_proxy->setVisible(true);
        m_proxy->setGeometry(rect);
    } else {
        m_popup->setParent(client->ownerWidget());
        m_popup->setGeometry(rect);
    }

    m_popup->setCurrentIndex(index);
    m_popup->exec();
}
开发者ID:Nacto1,项目名称:qt-everywhere-opensource-src-4.6.2,代码行数:23,代码来源:PopupMenuQt.cpp

示例15: defined

IntRect ChromeClientQt::windowResizerRect() const
{
#if defined(Q_WS_MAC)
    if (!m_webPage)
        return IntRect();

    QWebPageClient* pageClient = platformPageClient();
    if (!pageClient)
        return IntRect();

    QWidget* ownerWidget = pageClient->ownerWidget();
    if (!ownerWidget)
        return IntRect();

    QWidget* topLevelWidget = ownerWidget->window();
    QRect topLevelGeometry(topLevelWidget->geometry());

    // There's no API in Qt to query for the size of the resizer, so we assume
    // it has the same width and height as the scrollbar thickness.
    int scollbarThickness = ScrollbarTheme::theme()->scrollbarThickness();

    // There's no API in Qt to query for the position of the resizer. Sometimes
    // it's drawn by the system, and sometimes it's a QSizeGrip. For RTL locales
    // it might even be on the lower left side of the window, but in WebKit we
    // always draw scrollbars on the right hand side, so we assume this to be the
    // location when computing the resize rect to reserve for WebKit.
    QPoint resizeCornerTopLeft = ownerWidget->mapFrom(topLevelWidget,
            QPoint(topLevelGeometry.width(), topLevelGeometry.height())
            - QPoint(scollbarThickness, scollbarThickness));

    QRect resizeCornerRect = QRect(resizeCornerTopLeft, QSize(scollbarThickness, scollbarThickness));
    return resizeCornerRect.intersected(pageClient->geometryRelativeToOwnerWidget());
#else
    return IntRect();
#endif
}
开发者ID:,项目名称:,代码行数:36,代码来源:


注:本文中的QWebPageClient类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。