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


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

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


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

示例1: setTopLevelObjects

void QuickInterpreter::setTopLevelObjects(QObjectList *l)
{
    QSEngine::init();
    if(toplevel)
        for (int i=0; i<toplevel->size(); ++i) {
            QObject *o = toplevel->at(i);
	    disconnect(o, SIGNAL(destroyed(QObject*)),
			this, SLOT(topLevelDestroyed(QObject*)));
        }
    delete toplevel;
    toplevel = new QObjectList;

    kids.clear();
    if (!l) {
	toplevel->clear();
	return;
    }
    QSObject global(env()->globalObject());

    for (int i=0; i<toplevel->size(); ++i) {
        QObject *o = toplevel->at(i);
	if (hasTopLevelParent(o)) {
	    continue;
	}
	kids.append(o->objectName());
	connect(o, SIGNAL(destroyed(QObject *)),
		 this, SLOT(topLevelDestroyed(QObject *)));
	global.put(o->objectName(), wrap(o));
	staticGlobals << o->objectName();
	toplevel->append(o);
    }
    delete l;
}
开发者ID:aschet,项目名称:qsaqt5,代码行数:33,代码来源:quickinterpreter.cpp

示例2: 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

示例3: setAttribute

void Object::setAttribute()
{
    IObject::setAttribute();
    QObject* widget = sender();
    if(widget->objectName() == "experience")
        _experience = ((QSpinBox*)widget)->value();
    else if(widget->objectName() == "cooldown")
        _cooldown = ((QSpinBox*)widget)->value();
}
开发者ID:patadejaguar,项目名称:GuerraDeTanques,代码行数:9,代码来源:object.cpp

示例4: callQTModule

void WinControl::callQTModule( )
{
    QObject *obj = (QObject *)sender();
    if(string("*exit*") == obj->objectName().toAscii().data())	SYS->stop();
    else
    {
	try{ callQTModule(obj->objectName().toAscii().data()); }
	catch(TError err) {  }
    }
}
开发者ID:careychow,项目名称:openscada,代码行数:10,代码来源:tuimod.cpp

示例5: callClient

void ClientBackgroundManager::callClient() {
    QObject* sendedFrom = sender();
    qDebug() << "Called callClient" << sendedFrom->objectName();
    //send message to server
    MessageEnvelop call(REQUEST_CALL_TO_CLIENT_FROM_SERVER);
    call.setName(sendedFrom->objectName());
    emit sendDataToServer(call);
    //myClient2ServerThread.sendMessageToServer(call);
    //GUI

}
开发者ID:mijaros,项目名称:PB173_tucnaci,代码行数:11,代码来源:clientbackgroundmanager.cpp

示例6: setForwardRescheduleSignal

void Courier::setForwardRescheduleSignal(QObject &ob, bool fwd)
{
	if(fwd) {
		if(!connect(&ob,SIGNAL(reschedule(quint64)),this,SIGNAL(reschedule(quint64)),OC_CONTYPE)) {
			qWarning()<<"ERROR: Could not connect "<<ob.objectName();
		}
	} else {
		if(!disconnect(&ob,SIGNAL(reschedule(quint64)),this,SIGNAL(reschedule(quint64)))) {
			qWarning()<<"ERROR: Could not disconnect "<<ob.objectName();
		}
	}
}
开发者ID:mrdeveloperdude,项目名称:OctoMY,代码行数:12,代码来源:Courier.cpp

示例7: init

void qt_object_node::init(QObject& obj)
{
  auto name = obj.objectName();

  if (!name.isEmpty())
    set_name(obj.objectName().toStdString());
  else
  {
    std::string str;
    const QMetaObject* mo = obj.metaObject();
    while (str.empty())
    {
      str = mo->className();
      mo = mo->superClass();
      if (!mo)
        break;
    }

    if (!str.empty())
    {
      set_name(std::move(str));
    }
    else
    {
      set_name("Object");
    }
  }

  // Note : we create the childrens, and then lock the vector
  // because the children creation operation calls node_base::children() which
  // causes
  // double locking.
  decltype(m_children) children_vect;
  for (auto c : obj.children())
  {
    children_vect.push_back(
        std::make_unique<qt_object_node>(*c, m_device, *this));
  }

  for (int i = 0; i < obj.metaObject()->propertyCount(); i++)
  {
    children_vect.push_back(std::make_unique<qt_property_node>(
        obj, obj.metaObject()->property(i), m_device, *this));
  }

  {
    write_lock_t lock{m_mutex};
    std::move(
        children_vect.begin(), children_vect.end(),
        std::back_inserter(m_children));
  }
}
开发者ID:OSSIA,项目名称:API,代码行数:52,代码来源:qt_object_node.cpp

示例8: sender

void            GUI::EverywhereWindow::switchView() {
    QObject* senderObj = sender();
    ui->globalWidget->setStyleSheet("QWidget#globalWidget { background : url(C:/everywhere/images/"
                                    + _menuWidgets[senderObj->objectName()].first + "Background.png); }");
    ui->globalWidget->style()->unpolish(ui->globalWidget);
    ui->globalWidget->style()->polish(ui->globalWidget);
    ui->globalWidget->update();

    _current = _menuWidgets[senderObj->objectName()];
    manageMenu();
    _current.second->initialize();
    QTimer::singleShot(400, this, SLOT(updateView()));
}
开发者ID:mistrale,项目名称:hub,代码行数:13,代码来源:everywherewindow.cpp

示例9: buttonClickedSlot

void Combat::buttonClickedSlot()
{
    if(!rollDice)
    {
        //we can apply the hit now
        for(int i = 0; i < playerCount.size(); i++)
        {
            if(getPlayerTurn() == playerCount.at(i))
            {
                int hitPoint = playerHitPoint.at(i)->objectName().toInt();
                //get the button
                QObject *button = sender();
                QWidget *widget = qobject_cast<QWidget *>(button);
                //get the player rack
                QObject *PlayerRack = button->parent();
                int playerWidgetID = PlayerRack->objectName().toInt();
                if(playerWidgetID == getPlayerTurn())
                {
                    Message("Warning", "You can't remove your things");
                } else {
                    //remove the thing and button
                    if(hitPoint == 0)
                    {
                        //not enough hitpoint,change to next player
                        popMessageBox();
                        Message("Warning", "Don't have hitpoint!");
                        break;
                    } else {
                        //remove the things
                        int ThingID = button->objectName().toInt();
                        removePlayerThingFromID(ThingID);
                        //delete the button
                        delete widget;
                        //refresh the playerhitpoint label
                        playerHitPoint.at(i)->setObjectName(QString::number(hitPoint-1));
                        QString temp ="Player " + QString::number(playerCount.at(i)) +  " HitPoint : " + playerHitPoint.at(i)->objectName();
                        playerHitPoint.at(i)->setText(temp);
                        //check if the hitPoint become to 0
                        if(!checkAllPlayerRack()&&(hitPoint == 1))
                        {
                            popMessageBox();
                            break;
                        }
                    }
                }
            }
        }

    }

}
开发者ID:xinhaowang,项目名称:King-new,代码行数:51,代码来源:combat.cpp

示例10: format_arg

void format_arg(fmt::BasicFormatter<char>& f, const char*&, const QObject& qobj)
{
    auto& w = f.writer();

    w.write("{}<{:#x}", qobj.metaObject()->className(), reinterpret_cast<uintptr_t>(&qobj));

    if (!qobj.objectName().isEmpty())
    {
        w.write(" ");
        w.write(qobj.objectName().toStdString());
    }

    w.write(">");
}
开发者ID:denesb,项目名称:warmonger,代码行数:14,代码来源:Format.cpp

示例11: 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

示例12: 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

示例13: itemSelected

void RibbonWidget::itemSelected()
{
	QObject *source = this->sender();
	QString name = source->objectName();

	emit itemSelected(name);
}
开发者ID:afwild,项目名称:jasp-desktop,代码行数:7,代码来源:ribbonwidget.cpp

示例14: componentComplete

void MyMenu::componentComplete()
{
    QObjectList temp_list = children ();
    for (int i=0; i<temp_list.count (); ++i) {
        QObject *obj = temp_list.at (i);
        if( obj->objectName ()=="MyMenuItem"){
            MyMenuItem *item = qobject_cast<MyMenuItem*>(obj);
            menu->addAction(item);
        }else if(obj->objectName ()=="MenuSeparator"){
            menu->addSeparator ();
        }else if(obj->objectName ()=="MyMenu"){
            MyMenu *item = qobject_cast<MyMenu*>(obj);
            menu->addMenu (item->menu);
        }
    }
}
开发者ID:151706061,项目名称:QQStars,代码行数:16,代码来源:systemtrayicon.cpp

示例15: contactClick

void Home::contactClick()
{
	QObject *senderObj = sender();
	QString senderObjName = senderObj->objectName();
	QPushButton *tmp = (QPushButton *)senderObj;
	if (_pushtmp != NULL)
	{
		_pushtmp->setEnabled(true);
		//_pushtmp->setStyleSheet("QPushButton{color: rgb(0, 0, 0);}");
	}
	tmp->setEnabled(false);
	_pushtmp = tmp;
	_activeUser = senderObjName.toInt();
	if (_activeUser == _myid)
	{
		ui->_lineContactName->setReadOnly(false);
		ui->_lineSurnameEdit->setReadOnly(false);
		ui->_lineBirthday->setReadOnly(false);
		ui->_lineLocalisation->setReadOnly(false);
		ui->_linePhoneNumber->setReadOnly(false);
	}
	else
	{
		ui->_lineContactName->setReadOnly(true);
		ui->_lineSurnameEdit->setReadOnly(true);
		ui->_lineBirthday->setReadOnly(true);
		ui->_lineLocalisation->setReadOnly(true);
		ui->_linePhoneNumber->setReadOnly(true);
	}
	ui->_lineContactName->setText(_musers[_activeUser]->get_name().c_str());
	ui->_lineSurnameEdit->setText(_musers[_activeUser]->get_surname().c_str());
	ui->_lineBirthday->setText(_musers[_activeUser]->get_birth().c_str());
	ui->_lineLocalisation->setText(_musers[_activeUser]->get_address().c_str());
	ui->_linePhoneNumber->setText(_musers[_activeUser]->get_phone().c_str());
}
开发者ID:ekersale,项目名称:Babel,代码行数:35,代码来源:Home.cpp


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