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


C++ QStatusBar::metaObject方法代码示例

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


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

示例1: qtns_setGeometry

extern "C" NPError
NPP_SetWindow(NPP instance, NPWindow* window)
{
    if (!instance)
	return NPERR_INVALID_INSTANCE_ERROR;

    QtNPInstance* This = (QtNPInstance*) instance->pdata;
    extern void qtns_setGeometry(QtNPInstance*, const QRect &, const QRect &);

    const QRect clipRect(window->clipRect.left, window->clipRect.top,
                         window->clipRect.right - window->clipRect.left,
                         window->clipRect.bottom - window->clipRect.top);
    if (window)
        This->geometry = QRect(window->x, window->y, window->width, window->height);

    // take a shortcut if all that was changed is the geometry
    if (qobject_cast<QWidget*>(This->qt.object) && window && This->window == (QtNPInstance::Widget)window->window) {
        qtns_setGeometry(This, This->geometry, clipRect);
	return NPERR_NO_ERROR;
    }

	delete This->qt.object;
	This->qt.object = 0;
	extern void qtns_destroy(QtNPInstance *This);
	qtns_destroy(This);

    if (!window) {
        This->window = 0;
	return NPERR_NO_ERROR;
    }

    This->window = (QtNPInstance::Widget)window->window;
#ifdef Q_WS_X11
    //This->display = ((NPSetWindowCallbackStruct *)window->ws_info)->display;
#endif

    extern void qtns_initialize(QtNPInstance*);
    qtns_initialize(This);

    next_pi = This;
    This->qt.object = qtNPFactory()->createObject(This->mimetype);
    next_pi = 0;

    if (!This->qt.object)
        return NPERR_NO_ERROR;

    if (!This->htmlID.isEmpty())
        This->qt.object->setObjectName(QLatin1String(This->htmlID));

    This->filter = new QtSignalForwarder(This);
    QStatusBar *statusbar = qFindChild<QStatusBar*>(This->qt.object);
    if (statusbar) {
        int statusSignal = statusbar->metaObject()->indexOfSignal("messageChanged(QString)");
        if (statusSignal != -1) {
            QMetaObject::connect(statusbar, statusSignal, This->filter, -1);
            statusbar->hide();
        }
    }

    const QMetaObject *mo = This->qt.object->metaObject();
    for (int p = 0; p < mo->propertyCount(); ++p) {
        const QMetaProperty property = mo->property(p);
        QByteArray name(property.name());
        QVariant value = This->parameters.value(name.toLower());
        if (value.isValid())
            property.write(This->qt.object, value);
    }
    for (int methodIndex = 0; methodIndex < mo->methodCount(); ++methodIndex) {
        const QMetaMethod method = mo->method(methodIndex);
        if (method.methodType() == QMetaMethod::Signal)
            QMetaObject::connect(This->qt.object, methodIndex, This->filter, methodIndex);
    }

    if (This->pendingStream) {
        This->pendingStream->finish(This->bindable);
        This->pendingStream = 0;
    }

    if (!qobject_cast<QWidget*>(This->qt.object))
	return NPERR_NO_ERROR;

    extern void qtns_embed(QtNPInstance*);
    qtns_embed(This);

    QEvent e(QEvent::EmbeddingControl);
    QApplication::sendEvent(This->qt.widget, &e);

    if (!This->qt.widget->testAttribute(Qt::WA_PaintOnScreen))
        This->qt.widget->setAutoFillBackground(true);
    This->qt.widget->raise();
    qtns_setGeometry(This, This->geometry, clipRect);
    This->qt.widget->show();

    return NPERR_NO_ERROR;
}
开发者ID:Jtalk,项目名称:kopete-fork-xep0136,代码行数:95,代码来源:qtbrowserplugin.cpp


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