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


C++ QObject::inherits方法代码示例

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


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

示例1: createWidgetsContainer

void SkinStyle::createWidgetsContainer(QWidget * widget, const QString & objectName) {
    QWidget * container = new QWidget(widget->parentWidget());
    container->setObjectName(objectName);

    QHBoxLayout * layout = new QHBoxLayout();
    container->setLayout(layout);

    QObjectList objects = widget->children();
    for (int i = 0; i < objects.size(); i++) {
        QObject * object = objects.at(i);

        if (object->isWidgetType()) {
            if (!object->inherits("QToolBarHandle") && !object->inherits("QToolBarExtension")) {
                QWidget * w = qobject_cast < QWidget * > (object);
                addWidgetToLayout(w, layout);
                w->show();
            }
        }

        else if (object->inherits("QAction")) {
            QAction * a = qobject_cast < QAction * > (object);
            QWidget * w = new QWidget(container);
            w->addAction(a);
            addWidgetToLayout(w, layout);
        }

        else if (object->inherits("QLayout")) {
            QLayout * l = qobject_cast < QLayout * > (object);
            layout->addLayout(l);
        }
    }

    container->show();
}
开发者ID:,项目名称:,代码行数:34,代码来源:

示例2: activePickers

static QwtArray<QwtPicker *> activePickers(QWidget *w)
{
    QwtArray<QwtPicker *> pickers;

#if QT_VERSION >= 0x040000
    QObjectList children = w->children();
    for ( int i = 0; i < children.size(); i++ ) {
        QObject *obj = children[i];
        if ( obj->inherits("QwtPicker") ) {
            QwtPicker *picker = (QwtPicker *)obj;
            if ( picker->isEnabled() )
                pickers += picker;
        }
    }
#else
    QObjectList *children = (QObjectList *)w->children();
    if ( children ) {
        for ( QObjectListIterator it(*children); it.current(); ++it ) {
            QObject *obj = (QObject *)it.current();
            if ( obj->inherits("QwtPicker") ) {
                QwtPicker *picker = (QwtPicker *)obj;
                if ( picker->isEnabled() ) {
                    pickers.resize(pickers.size() + 1);
                    pickers[int(pickers.size()) - 1] = picker;
                }
            }
        }
    }
#endif

    return pickers;
}
开发者ID:9DSmart,项目名称:apm_planner,代码行数:32,代码来源:qwt_panner.cpp

示例3: traversalControl

///
/// \brief Form_PlatformConfiguration::traversalControl
/// \param q
/// save
///
void Form_PlatformConfiguration::traversalControl(const QObjectList& q)
{
    for(int i=0;i<q.length();i++)
    {

        if(!q.at(i)->children().empty())
        {
            traversalControl(q.at(i)->children());
        }

        QObject* o = q.at(i);
        if (o->inherits("QLineEdit"))
        {
            QLineEdit* b = qobject_cast<QLineEdit*>(o);
            QDomElement qe= doc_config.createElement(b->objectName());
            qe.setAttribute("Value",b->text());
            qe.setAttribute("Type","QLineEdit");
            doc_config.firstChildElement("root").appendChild(qe);
        }
        else if (o->inherits("QGroupBox"))
        {
            QGroupBox* b = qobject_cast<QGroupBox*>(o);
            QDomElement qe= doc_config.createElement(b->objectName());
            qe.setAttribute("Value",b->isChecked());
            qe.setAttribute("Type","QGroupBox");
            doc_config.firstChildElement("root").appendChild(qe);
        }
        else if (o->inherits("QTableWidget"))
        {
            QTableWidget * b = qobject_cast<QTableWidget*>(o);
            int col_rate = b->objectName() == "table_labels" ? 1:0;
            QDomElement qe= doc_config.createElement(b->objectName());
            qe.setAttribute("Value_R",b->rowCount());
            qe.setAttribute("Value_C",b->columnCount());
            qe.setAttribute("Type","QTableWidget");
            for(int i =0 ; i<b->rowCount() ;i++)
            {
                QDomElement item= doc_config.createElement("R"+QString::number(i));
                for(int j=0 ;j <b->columnCount()  - col_rate; j++)
                {
                    item.setAttribute("C"+QString::number(j), b->item(i,j)->text());
                }
                qe.appendChild(item);
            }
            doc_config.firstChildElement("root").appendChild(qe);
        }
    }

}
开发者ID:freegodly,项目名称:STT,代码行数:54,代码来源:form_platformconfiguration.cpp

示例4: LoadConfig

void Form_PlatformConfiguration::LoadConfig(const QObjectList &q)
{
    for(int i=0;i<q.length();i++)
    {

        if(!q.at(i)->children().empty())
        {
            LoadConfig(q.at(i)->children());
        }

        QObject* obj = q.at(i);

        if (obj->inherits("QLineEdit"))
        {
            QLineEdit *b = qobject_cast<QLineEdit*>(obj);
            QString Name = obj->objectName();
            QDomNode node = STT_Global::FindXml(doc_config,Name);
            if(!node.isNull() ) b->setText(node.attributes().namedItem("Value").nodeValue() );

        }
        else if (obj->inherits("QGroupBox"))
        {
            QGroupBox* b = qobject_cast<QGroupBox*>(obj);
            QDomNode node = STT_Global::FindXml(doc_config,b->objectName());
            if(!node.isNull() ) b->setChecked( node.attributes().namedItem("Value").nodeValue() == "1" ? true:false);
        }
        else if (obj->inherits("QTableWidget"))
        {
            QTableWidget* b = qobject_cast<QTableWidget*>(obj);
            QDomNode node = STT_Global::FindXml(doc_config,b->objectName());
            if( !node.isNull() )
            {
              int Value_R =  node.attributes().namedItem("Value_R").nodeValue().toInt();
              int Value_C =  node.attributes().namedItem("Value_C").nodeValue().toInt();
              b->setRowCount(Value_R);

              for(int i =0 ; i<Value_R ;i++)
              {
                  QDomNode item= node.childNodes().at(i);
                  for(int j=0 ;j < Value_C ; j++)
                  {
                      b->setItem(i, j, new QTableWidgetItem(item.attributes().namedItem("C"+QString::number(j)).nodeValue()));
                  }
              }
            }
        }
    }
}
开发者ID:freegodly,项目名称:STT,代码行数:48,代码来源:form_platformconfiguration.cpp

示例5: findChild

QObject* PythonQtStdDecorators::findChild(QObject* parent, const char* typeName, const QMetaObject* meta, const QString& name)
{
  const QObjectList &children = parent->children();

  int i;
  for (i = 0; i < children.size(); ++i) {
    QObject* obj = children.at(i);

    if (!obj)
      return NULL;

    // Skip if the name doesn't match.
    if (!name.isNull() && obj->objectName() != name)
      continue;

    if ((typeName && obj->inherits(typeName)) ||
      (meta && meta->cast(obj)))
      return obj;
  }

  for (i = 0; i < children.size(); ++i) {
    QObject* obj = findChild(children.at(i), typeName, meta, name);

    if (obj != NULL)
      return obj;
  }

  return NULL;
}
开发者ID:Tasssadar,项目名称:Lorris,代码行数:29,代码来源:PythonQtStdDecorators.cpp

示例6: if

static QObject *qChildHelper(const char *objName, const char *inheritsClass,
                             bool recursiveSearch, const QObjectList &children)
{
    if (children.isEmpty())
        return 0;

    bool onlyWidgets = (inheritsClass
                        && qstrcmp(inheritsClass, "QWidget") == 0);
    const QLatin1String oName(objName);

    for (int i = 0; i < children.size(); ++i)
    {
        QObject *obj = children.at(i);

        if (onlyWidgets)
        {
            if (obj->isWidgetType() && (!objName || obj->objectName() == oName))
                return obj;
        }
        else if ((!inheritsClass || obj->inherits(inheritsClass))
                 && (!objName || obj->objectName() == oName))
            return obj;

        if (recursiveSearch && (dynamic_cast<MythUIGroup *>(obj) != NULL)
            && (obj = qChildHelper(objName, inheritsClass,
                                   recursiveSearch,
                                   obj->children())))
            return obj;
    }

    return 0;
}
开发者ID:masjerang,项目名称:mythtv,代码行数:32,代码来源:mythuitype.cpp

示例7: OSDConfigBase

OSDConfig::OSDConfig(QWidget *parent, void *d, OSDPlugin *plugin)
        : OSDConfigBase(parent)
{
    m_plugin = plugin;
    OSDUserData *data = (OSDUserData*)d;
    chkMessage->setChecked(data->EnableMessage.bValue);
    chkMessageContent->setChecked(data->EnableMessageShowContent.bValue);
    chkStatus->setChecked(data->EnableAlert.bValue);
    chkStatusOnline->setChecked(data->EnableAlertOnline.bValue);
    chkStatusAway->setChecked(data->EnableAlertAway.bValue);
    chkStatusNA->setChecked(data->EnableAlertNA.bValue);
    chkStatusDND->setChecked(data->EnableAlertDND.bValue);
    chkStatusOccupied->setChecked(data->EnableAlertOccupied.bValue);
    chkStatusFFC->setChecked(data->EnableAlertFFC.bValue);
    chkStatusOffline->setChecked(data->EnableAlertOffline.bValue);
    chkTyping->setChecked(data->EnableTyping.bValue);
    for (QObject *p = parent; p != NULL; p = p->parent()){
        if (!p->inherits("QTabWidget"))
            continue;
        QTabWidget *tab = static_cast<QTabWidget*>(p);
        void *data = getContacts()->getUserData(plugin->user_data_id);
        m_iface = new OSDIface(tab, data, plugin);
        tab->addTab(m_iface, i18n("&Interface"));
        break;
    }
    edtLines->setValue(data->ContentLines.value);
    connect(chkStatus, SIGNAL(toggled(bool)), this, SLOT(statusToggled(bool)));
    connect(chkMessage, SIGNAL(toggled(bool)), this, SLOT(showMessageToggled(bool)));
    connect(chkMessageContent, SIGNAL(toggled(bool)), this, SLOT(contentToggled(bool)));
    showMessageToggled(chkMessage->isChecked());
    contentToggled(chkMessageContent->isChecked());
    statusToggled(data->EnableAlert.bValue);
}
开发者ID:BackupTheBerlios,项目名称:sim-im-svn,代码行数:33,代码来源:osdconfig.cpp

示例8: MessageConfigBase

MessageConfig::MessageConfig(QWidget *parent, void *_data)
        : MessageConfigBase(parent)
{
	m_file = NULL;
    for (QObject *p = parent; p != NULL; p = p->parent()){
        if (!p->inherits("QTabWidget"))
            continue;
        QTabWidget *tab = static_cast<QTabWidget*>(p);
        m_file = new FileConfig(tab, _data);
        tab->addTab(m_file, i18n("File"));
        tab->adjustSize();
        break;
    }

    CoreUserData *data = (CoreUserData*)_data;
    chkOnline->setChecked((data->OpenOnOnline) != 0);
    chkStatus->setChecked((data->LogStatus) != 0);
    switch (data->OpenNewMessage){
    case NEW_MSG_NOOPEN:
        btnNoOpen->setChecked(true);
        break;
    case NEW_MSG_MINIMIZE:
        btnMinimize->setChecked(true);
        break;
    case NEW_MSG_RAISE:
        btnRaise->setChecked(true);
        break;
    }
}
开发者ID:,项目名称:,代码行数:29,代码来源:

示例9: loader

MApplicationExtensionInterface *MApplicationExtensionLoader::loadExtension(const MApplicationExtensionMetaData &metadata)
{
    QPluginLoader loader(metadata.extensionBinary());
    loader.setLoadHints(QLibrary::ResolveAllSymbolsHint | QLibrary::ExportExternalSymbolsHint);
    QObject *object = loader.instance();

    if (object != NULL) {
        if (object->inherits(metadata.interface().toUtf8().constData())) {
            MApplicationExtensionInterface *extension = qobject_cast<MApplicationExtensionInterface *>(object);
            if (extension != NULL) {
                if (extension->initialize(metadata.interface())) {
                    return extension;
                } else {
                    mWarning("MApplicationExtensionLoader") << "Application extension" << metadata.fileName() << "could not be initialized.";
                }
            } else {
                mWarning("MApplicationExtensionLoader") << "Application extension" << metadata.fileName() << "could not be instantiated. The extension does not implement MApplicationExtensionInterface.";
            }
        } else {
            mWarning("MApplicationExtensionLoader") << "Application extension" << metadata.fileName() << "could not be instantiated. The extension does not inherit" << metadata.interface();
        }
        delete object;
    } else {
        mWarning("MApplicationExtensionLoader") << "Application extension" << metadata.fileName() << "could not be loaded." << loader.errorString();
    }

    return false;
}
开发者ID:arcean,项目名称:libmeegotouch-framework,代码行数:28,代码来源:mapplicationextensionloader.cpp

示例10: WeatherCfgBase

WeatherCfg::WeatherCfg(QWidget *parent, WeatherPlugin *plugin)
        : WeatherCfgBase(parent)
{
    m_plugin = plugin;
    lblLnk->setUrl("http://www.weather.com/?prod=xoap&par=1004517364");
    lblLnk->setText(QString("Weather data provided by weather.com") + QChar((unsigned short)174));
    connect(btnSearch, SIGNAL(clicked()), this, SLOT(search()));
    connect(cmbLocation->lineEdit(), SIGNAL(textChanged(const QString&)), this, SLOT(textChanged(const QString&)));
    connect(cmbLocation, SIGNAL(activated(int)), this, SLOT(activated(int)));
    textChanged("");
    fill();
    memset(&m_handler, 0, sizeof(m_handler));
    m_handler.startElement = p_element_start;
    m_handler.endElement   = p_element_end;
    m_handler.characters   = p_char_data;
    for (QObject *p = parent; p != NULL; p = p->parent()){
        if (!p->inherits("QTabWidget"))
            continue;
        QTabWidget *tab = static_cast<QTabWidget*>(p);
        m_iface = new WIfaceCfg(tab, plugin);
        tab->addTab(m_iface, i18n("Interface"));
        tab->adjustSize();
        break;
    }
}
开发者ID:,项目名称:,代码行数:25,代码来源:

示例11:

    Q_FOREACH(QPluginLoader *loader, list) {
        QJsonObject json = loader->metaData().value("MetaData").toObject();
        QStringList mimetypes = json.value("X-KDE-Export").toString().split(",");
        Q_FOREACH(const QString &mime, mimetypes) {

            KLibFactory *factory = qobject_cast<KLibFactory *>(loader->instance());
            if (!factory) {
                warnUI << loader->errorString();
                continue;
            }

            QObject* obj = factory->create<KisImportExportFilter>(0);
            if (!obj || !obj->inherits("KisImportExportFilter")) {
                delete obj;
                continue;
            }

            QSharedPointer<KisImportExportFilter>filter(static_cast<KisImportExportFilter*>(obj));
            if (!filter) {
                delete obj;
                continue;
            }

            m_renderFilters.append(filter);

            QString description = KisMimeDatabase::descriptionForMimeType(mime);
            if (description.isEmpty()) {
                description = mime;
            }
            m_page->cmbRenderType->addItem(description, mime);

        }
开发者ID:KDE,项目名称:krita,代码行数:32,代码来源:DlgAnimationRenderer.cpp

示例12: findChildren

int PythonQtStdDecorators::findChildren(QObject* parent, const char* typeName, const QMetaObject* meta, const QRegExp& regExp, QList<QObject*>& list)
{
  const QObjectList& children = parent->children();
  int i;

  for (i = 0; i < children.size(); ++i) {
    QObject* obj = children.at(i);

    if (!obj)
      return -1;

    // Skip if the name doesn't match.
    if (regExp.indexIn(obj->objectName()) == -1)
      continue;

    if ((typeName && obj->inherits(typeName)) ||
      (meta && meta->cast(obj))) {
        list += obj;
    }

    if (findChildren(obj, typeName, meta, regExp, list) < 0)
      return -1;
  }

  return 0;
}
开发者ID:Tasssadar,项目名称:Lorris,代码行数:26,代码来源:PythonQtStdDecorators.cpp

示例13: editor_module_cleanup

static bool editor_module_cleanup(KviModule *)
{
	/*
	 * This causes 2 crashes: one in KviApplication destructor (closing windows needs
	 * g_pMainWindow, that is deleted before this unloading routine) and the second in
	 * the codetester window (it deletes us in its denstructor, and we tries to back-delete it)
	 * So it's commented out by now..
	 */

	while(g_pScriptEditorWindowList->first())
	{
		QObject * w = g_pScriptEditorWindowList->first()->parent();
		while(w)
		{
			//qDebug("%s %s %i %s",__FILE__,__FUNCTION__,__LINE__,w->className());
			if(w->inherits("KviWindow"))
			{
			//	qDebug("%s %s %i",__FILE__,__FUNCTION__,__LINE__);
				//((KviWindow *)w)->close();
			//	qDebug("%s %s %i",__FILE__,__FUNCTION__,__LINE__);
				break;
			}
		w = w->parent();
		}
		delete g_pScriptEditorWindowList->first();
	}

	delete g_pScriptEditorWindowList;
	g_pScriptEditorWindowList = 0;

	return true;
}
开发者ID:kartagis,项目名称:KVIrc,代码行数:32,代码来源:libkvieditor.cpp

示例14: parent

//! \return plot canvas
QwtPlotCanvas *QwtPlotRescaler::canvas()
{
    QObject *o = parent();
    if ( o && o->inherits("QwtPlotCanvas") )
        return (QwtPlotCanvas *)o;

    return NULL;
}
开发者ID:AlexKraemer,项目名称:RFID_ME_HW_GUI,代码行数:9,代码来源:qwt_plot_rescaler.cpp

示例15: parent

//! Return observed plot canvas
QwtPlotCanvas *QwtPlotMagnifier::canvas()
{
    QObject *w = parent();
    if ( w && w->inherits("QwtPlotCanvas") )
        return (QwtPlotCanvas *)w;

    return NULL;
}
开发者ID:AlexKraemer,项目名称:RFID_ME_HW_GUI,代码行数:9,代码来源:qwt_plot_magnifier.cpp


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