本文整理汇总了C++中QWebPageClient::ownerWidget方法的典型用法代码示例。如果您正苦于以下问题:C++ QWebPageClient::ownerWidget方法的具体用法?C++ QWebPageClient::ownerWidget怎么用?C++ QWebPageClient::ownerWidget使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QWebPageClient
的用法示例。
在下文中一共展示了QWebPageClient::ownerWidget方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
}
示例2: platformGetValue
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;
}
}
示例3: initXEvent
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);
}
示例4: screenToRootView
IntPoint ChromeClientQt::screenToRootView(const IntPoint& point) const
{
QWebPageClient* pageClient = platformPageClient();
if (!pageClient)
return point;
QWidget* ownerWidget = pageClient->ownerWidget();
if (!ownerWidget)
return point;
return ownerWidget->mapFromGlobal(point);
}
示例5: 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();
}
示例6: 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();
}
示例7: rootViewToScreen
IntRect ChromeClientQt::rootViewToScreen(const IntRect& rect) const
{
QWebPageClient* pageClient = platformPageClient();
if (!pageClient)
return rect;
QWidget* ownerWidget = pageClient->ownerWidget();
if (!ownerWidget)
return rect;
QRect screenRect(rect);
screenRect.translate(ownerWidget->mapToGlobal(QPoint(0, 0)));
return screenRect;
}
示例8: windowResizerRect
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
}
示例9: platformStart
bool PluginView::platformStart()
{
ASSERT(m_isStarted);
ASSERT(m_status == PluginStatusLoadedSuccessfully);
if (m_plugin->pluginFuncs()->getvalue) {
PluginView::setCurrentPluginView(this);
JSC::JSLock::DropAllLocks dropAllLocks(JSC::SilenceAssertionsOnly);
setCallingPlugin(true);
m_plugin->pluginFuncs()->getvalue(m_instance, NPPVpluginNeedsXEmbed, &m_needsXEmbed);
setCallingPlugin(false);
PluginView::setCurrentPluginView(0);
}
if (m_isWindowed) {
QWebPageClient* client = m_parentFrame->view()->hostWindow()->platformPageClient();
if (m_needsXEmbed && client) {
setPlatformWidget(new PluginContainerQt(this, client->ownerWidget()));
// sync our XEmbed container window creation before sending the xid to plugins.
QApplication::syncX();
} else {
notImplemented();
m_status = PluginStatusCanNotLoadPlugin;
return false;
}
} else {
setPlatformWidget(0);
m_pluginDisplay = getPluginDisplay();
}
show();
NPSetWindowCallbackStruct* wsi = new NPSetWindowCallbackStruct();
wsi->type = 0;
if (m_isWindowed) {
const QX11Info* x11Info = &platformPluginWidget()->x11Info();
wsi->display = x11Info->display();
wsi->visual = (Visual*)x11Info->visual();
wsi->depth = x11Info->depth();
wsi->colormap = x11Info->colormap();
m_npWindow.type = NPWindowTypeWindow;
m_npWindow.window = (void*)platformPluginWidget()->winId();
m_npWindow.width = -1;
m_npWindow.height = -1;
} else {
const QX11Info* x11Info = &QApplication::desktop()->x11Info();
if (x11Info->depth() == 32 || !m_plugin->quirks().contains(PluginQuirkRequiresDefaultScreenDepth)) {
getVisualAndColormap(32, &m_visual, &m_colormap);
wsi->depth = 32;
}
if (!m_visual) {
getVisualAndColormap(x11Info->depth(), &m_visual, &m_colormap);
wsi->depth = x11Info->depth();
}
wsi->display = x11Info->display();
wsi->visual = m_visual;
wsi->colormap = m_colormap;
m_npWindow.type = NPWindowTypeDrawable;
m_npWindow.window = 0; // Not used?
m_npWindow.x = 0;
m_npWindow.y = 0;
m_npWindow.width = -1;
m_npWindow.height = -1;
}
m_npWindow.ws_info = wsi;
if (!(m_plugin->quirks().contains(PluginQuirkDeferFirstSetWindowCall))) {
updatePluginWidget();
setNPWindowIfNeeded();
}
return true;
}
示例10: getValue
NPError PluginView::getValue(NPNVariable variable, void* value)
{
LOG(Plugins, "PluginView::getValue(%s)", prettyNameForNPNVariable(variable).data());
switch (variable) {
case NPNVxDisplay:
*(void **)value = QX11Info::display();
return NPERR_NO_ERROR;
case NPNVxtAppContext:
return NPERR_GENERIC_ERROR;
#if ENABLE(NETSCAPE_PLUGIN_API)
case NPNVWindowNPObject: {
if (m_isJavaScriptPaused)
return NPERR_GENERIC_ERROR;
NPObject* windowScriptObject = m_parentFrame->script()->windowScriptNPObject();
// Return value is expected to be retained, as described here: <http://www.mozilla.org/projects/plugin/npruntime.html>
if (windowScriptObject)
_NPN_RetainObject(windowScriptObject);
void** v = (void**)value;
*v = windowScriptObject;
return NPERR_NO_ERROR;
}
case NPNVPluginElementNPObject: {
if (m_isJavaScriptPaused)
return NPERR_GENERIC_ERROR;
NPObject* pluginScriptObject = 0;
if (m_element->hasTagName(appletTag) || m_element->hasTagName(embedTag) || m_element->hasTagName(objectTag))
pluginScriptObject = static_cast<HTMLPlugInElement*>(m_element)->getNPObject();
// Return value is expected to be retained, as described here: <http://www.mozilla.org/projects/plugin/npruntime.html>
if (pluginScriptObject)
_NPN_RetainObject(pluginScriptObject);
void** v = (void**)value;
*v = pluginScriptObject;
return NPERR_NO_ERROR;
}
#endif
case NPNVnetscapeWindow: {
void* w = reinterpret_cast<void*>(value);
QWebPageClient* client = m_parentFrame->view()->hostWindow()->platformPageClient();
*((XID *)w) = client ? client->ownerWidget()->window()->winId() : 0;
return NPERR_NO_ERROR;
}
case NPNVToolkit:
if (m_plugin->quirks().contains(PluginQuirkRequiresGtkToolKit)) {
*((uint32 *)value) = 2;
return NPERR_NO_ERROR;
}
// fall through
default:
return getValueStatic(variable, value);
}
}
示例11: platformStart
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;
}
示例12: platformStart
bool PluginView::platformStart()
{
ASSERT(m_isStarted);
ASSERT(m_status == PluginStatusLoadedSuccessfully);
if (m_plugin->pluginFuncs()->getvalue) {
PluginView::setCurrentPluginView(this);
#if USE(JSC)
JSC::JSLock::DropAllLocks dropAllLocks(JSC::SilenceAssertionsOnly);
#endif
setCallingPlugin(true);
m_plugin->pluginFuncs()->getvalue(m_instance, NPPVpluginNeedsXEmbed, &m_needsXEmbed);
setCallingPlugin(false);
PluginView::setCurrentPluginView(0);
}
if (m_isWindowed) {
QWebPageClient* client = m_parentFrame->view()->hostWindow()->platformPageClient();
if (m_needsXEmbed && client) {
setPlatformWidget(new PluginContainerQt(this, client->ownerWidget()));
// sync our XEmbed container window creation before sending the xid to plugins.
QApplication::syncX();
} else {
notImplemented();
m_status = PluginStatusCanNotLoadPlugin;
return false;
}
} else {
setPlatformWidget(0);
m_pluginDisplay = getPluginDisplay();
#if USE(ACCELERATED_COMPOSITING) && !USE(TEXTURE_MAPPER)
if (shouldUseAcceleratedCompositing()) {
m_platformLayer = adoptPtr(new PluginGraphicsLayerQt(this));
// Trigger layer computation in RenderLayerCompositor
m_element->setNeedsStyleRecalc(SyntheticStyleChange);
}
#endif
}
// If the width and the height are not zero we show the PluginView.
if (!frameRect().isEmpty())
show();
NPSetWindowCallbackStruct* wsi = new NPSetWindowCallbackStruct();
wsi->type = 0;
if (m_isWindowed) {
const QX11Info* x11Info = &static_cast<QWidget*>(platformPluginWidget())->x11Info();
wsi->display = x11Info->display();
wsi->visual = (Visual*)x11Info->visual();
wsi->depth = x11Info->depth();
wsi->colormap = x11Info->colormap();
m_npWindow.type = NPWindowTypeWindow;
m_npWindow.window = (void*)static_cast<QWidget*>(platformPluginWidget())->winId();
m_npWindow.width = -1;
m_npWindow.height = -1;
} else {
const QX11Info* x11Info = &QApplication::desktop()->x11Info();
if (x11Info->depth() == 32 || !m_plugin->quirks().contains(PluginQuirkRequiresDefaultScreenDepth)) {
getVisualAndColormap(32, &m_visual, &m_colormap);
wsi->depth = 32;
}
if (!m_visual) {
getVisualAndColormap(x11Info->depth(), &m_visual, &m_colormap);
wsi->depth = x11Info->depth();
}
wsi->display = x11Info->display();
wsi->visual = m_visual;
wsi->colormap = m_colormap;
m_npWindow.type = NPWindowTypeDrawable;
m_npWindow.window = 0; // Not used?
m_npWindow.x = 0;
m_npWindow.y = 0;
m_npWindow.width = -1;
m_npWindow.height = -1;
}
m_npWindow.ws_info = wsi;
if (!(m_plugin->quirks().contains(PluginQuirkDeferFirstSetWindowCall))) {
updatePluginWidget();
setNPWindowIfNeeded();
}
return true;
}