返回介绍

QNPWidget Class

发布于 2019-10-04 15:01:48 字数 2731 浏览 964 评论 0 收藏 0

The QNPWidget class provides a QWidget that is a Web-browser plugin window.

This class is part of the Qt NSPlugin Extension. More...

#include <qnp.h>

Inherits QWidget.

List of all member functions.

Public Members

  • QNPWidget ()
  • ~QNPWidget ()
  • virtual void enterInstance ()
  • virtual void leaveInstance ()
  • QNPInstance * instance ()

Detailed Description

This class is defined in the Qt NSPlugin Extension, which can be found in the qt/extensions directory. It is not included in the main Qt API.

The QNPWidget class provides a QWidget that is a Web-browser plugin window.

Derive from QNPWidget to create a widget that can be used as a Browser plugin window, or create one and add child widgets. Instances of QNPWidget may only be created when QNPInstance::newWindow() is called by the browser.

A common way to develop a plugin widget is to develop it as a stand-alone application window, then make it a child of a plugin widget to use it as a browser plugin. The technique is:

class MyPluginWindow : public QNPWidget
{
    QWidget* child;
public:
    MyPluginWindow()
    {
        // Some widget that is normally used as a top-level widget
        child = new MyIndependentlyDevelopedWidget();

        // Use the background color of the web page
        child->setBackgroundColor( backgroundColor() );

        // Fill the plugin widget
        child->setGeometry( 0, 0, width(), height() );
    }

    void resizeEvent(QResizeEvent*)
    {
        // Fill the plugin widget
        child->resize(size());
    }
};

The default implementation is an empty window.


Member Function Documentation

QNPWidget::QNPWidget ()

Creates a QNPWidget.

QNPWidget::~QNPWidget ()

Destroys the window. This will be called by the plugin binding code when the window is no longer required. The Web-browser will delete windows when they leave the page. The bindings will change the QWidget::winId() of the window when the window is resized, but this should not affect normal widget behavior.

void QNPWidget::enterInstance () [virtual]

Called when the mouse enters the plugin window. Does nothing by default.

Example: grapher/grapher.cpp.

QNPInstance* QNPWidget::instance ()

Returns the instance for which this widget is the window.

void QNPWidget::leaveInstance () [virtual]

Called when the mouse leaves the plugin window. Does nothing by default.

Example: grapher/grapher.cpp.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文