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


C++ const_iterator::value方法代码示例

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


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

示例1: updateGameStatsFromJsonResponse

void dialogGameStats::updateGameStatsFromJsonResponse(const QJsonObject &jsonObject) {

    if (!jsonObject["top"].isNull()) {



            for(QJsonObject::const_iterator iter = jsonObject.begin(); iter != jsonObject.end(); ++iter) {
                if (iter.key() == "top")
                {

                   // while (this->ui->tableWidgetGameStats->rowCount() > 0)
                   // {
                   //     this->ui->tableWidgetGameStats->removeRow(0);
                   // }

                    this->ui->treeWidgetGameStats->clear();

                    //this->ui->tableWidgetGameStats->setColumnCount(2);
                   // this->ui->tableWidgetGameStats->horizontalHeaderItem(0)->setText("Viewers");
                   // this->ui->tableWidgetGameStats->horizontalHeaderItem(1)->setText("Game");


                    for (int i = 0; i <= iter.value().toArray().size(); i++)
                    {
                   // qDebug() << iter.value().toArray().at(i).toObject()["game"].toObject()["name"].toString();
                   // qDebug() <<  iter.value().toArray().at(i).toObject()["viewers"].toDouble();


                    if (iter.value().toArray().at(i).toObject()["game"].toObject()["name"].toString() != "") {
                        QTreeWidgetItem * item = new QTreeWidgetItem();
                        item->setText(0,QString::number(i+1));
                        item->setText(1,QString::number(iter.value().toArray().at(i).toObject()["viewers"].toDouble()));
                        item->setText(2,iter.value().toArray().at(i).toObject()["game"].toObject()["name"].toString());
                        item->setTextColor(1,  QColor(85,85,255));


                        this->ui->treeWidgetGameStats->addTopLevelItem(item);

                    }





                    }







                }
            }



        }

}
开发者ID:Galbi3000,项目名称:twitcher,代码行数:60,代码来源:dialoggamestats.cpp

示例2: createPropertyObject

void XSAppBuilder::createPropertyObject(const QString &proName, const QString &proData, xsObject *proObject)
{
    if(proObject == NULL)
    {
        return;
    }

    if(root.contains(proName))
    {
        QStringList list = proData.split(";", QString::SkipEmptyParts);
        QJsonObject obj = root.value(proName).toObject();
        QJsonObject::const_iterator it = obj.constBegin();

        while(it != obj.constEnd())
        {
            if(it.key() == "prototype" || it.key() == "@prototype")
            {
                it++;
                continue;
            }
            for(int i = 0; i < list.size(); i++)
            {
                if(list.at(i).contains(it.key()))
                {
                    if(it.key() == "@inherit")
                    {
                        createPropertyObject(it.value().toString(), proData, proObject);
                    }
                    else
                    {
                        QJsonObject subObj = it.value().toObject();
                        QStringList dataList = list.at(i).split(":",QString::SkipEmptyParts);
                        if(dataList.size() == 2)
                        {
                            xsValue property;
                            transformValue(subObj, &property, dataList.at(1), it.key());
                            proObject->setProperty(it.key().toStdString().c_str(), &property);
                        }
                    }
                }
            }

            it++;
        }
    }

    return;
}
开发者ID:mixtile,项目名称:xskit,代码行数:48,代码来源:xsappbuilder.cpp

示例3: isModified

bool QEnginioObjectShared::isModified() const
{
    QJsonObject::const_iterator i;

    for (i = iJsonObject.begin(); i != iJsonObject.end(); ++i) {
        if (i.key() == QtCloudServicesConstants::id ||
                i.key() == QtCloudServicesConstants::objectType) {
            continue;
        }

        if (!iPersistentJsonObject.contains(i.key())) {
            return true; // field added
        }

        if (iPersistentJsonObject.value(i.key()) != i.value()) {
            return true; // field changed
        }
    }

    for (i = iPersistentJsonObject.begin(); i != iPersistentJsonObject.end(); ++i) {
        if (!iPersistentJsonObject.contains(i.key())) {
            return true; // field removed
        }
    }

    return false;
}
开发者ID:jotahtin,项目名称:qtc-sdk-qt,代码行数:27,代码来源:qenginioobjectshared.cpp

示例4: fromJsonValue

v8::Local<v8::Object> QV8JsonWrapper::fromJsonObject(const QJsonObject &object)
{
    v8::Local<v8::Object> v8object = v8::Object::New();
    for (QJsonObject::const_iterator it = object.begin(); it != object.end(); ++it)
        v8object->Set(QJSConverter::toString(it.key()), fromJsonValue(it.value()));
    return v8object;
}
开发者ID:SamuelNevala,项目名称:qtdeclarative,代码行数:7,代码来源:qv8jsonwrapper.cpp

示例5: json

QMap<QString, QMap<QString, QString>> Info::getServiceServerAddressMeta()
{
   QString filename = getAddressMetaFilename();
   QByteArray json("[]");
   if(Filesystem::fileExist(filename)){
      json = Filesystem::fileGetContents(filename);
   }
   QJsonParseError parserError;
   QJsonDocument doc = QJsonDocument::fromJson(json, &parserError);
   QMap<QString, QMap<QString, QString>> ret;
   if(parserError.error == QJsonParseError::NoError){
      QJsonArray array = doc.array();
      QJsonArray::const_iterator ait = array.constBegin();
      QJsonArray::const_iterator aendmarker = array.constEnd();
      while(ait != aendmarker){
         QJsonValue v = *ait;
         if(v.isObject()){
            QJsonObject item = v.toObject();
            QJsonObject::const_iterator oit = item.constBegin();
            QJsonObject::const_iterator oendmarker = item.constEnd();
            QMap<QString, QString> dataItem;
            while(oit != oendmarker){
               dataItem.insert(oit.key(), oit.value().toString());
               oit++;
            }
            ret.insert(dataItem.value("key"), dataItem);
         }
         ait++;
      }
   }
   return ret;
}
开发者ID:asdf20122012,项目名称:upgrademgr_master,代码行数:32,代码来源:server_info.cpp

示例6: while

static PyObject *convertFrom_QJsonObject(void *sipCppV, PyObject *sipTransferObj)
{
    QJsonObject *sipCpp = reinterpret_cast<QJsonObject *>(sipCppV);

#line 28 "C:\\Users\\marcus\\Downloads\\PyQt-gpl-5.4\\PyQt-gpl-5.4\\sip/QtCore/qjsonobject.sip"
    PyObject *d = PyDict_New();

    if (!d)
        return 0;

    QJsonObject::const_iterator it = sipCpp->constBegin();
    QJsonObject::const_iterator end = sipCpp->constEnd();

    while (it != end)
    {
        QString *k = new QString(it.key());
        PyObject *kobj = sipConvertFromNewType(k, sipType_QString,
                                               sipTransferObj);

        if (!kobj)
        {
            delete k;
            Py_DECREF(d);

            return 0;
        }

        QJsonValue *v = new QJsonValue(it.value());
        PyObject *vobj = sipConvertFromNewType(v, sipType_QJsonValue,
                                               sipTransferObj);

        if (!vobj)
        {
            delete v;
            Py_DECREF(kobj);
            Py_DECREF(d);

            return 0;
        }

        int rc = PyDict_SetItem(d, kobj, vobj);

        Py_DECREF(vobj);
        Py_DECREF(kobj);

        if (rc < 0)
        {
            Py_DECREF(d);

            return 0;
        }

        ++it;
    }

    return d;
#line 182 "C:\\Users\\marcus\\Downloads\\PyQt-gpl-5.4\\PyQt-gpl-5.4\\QtCore/sipQtCoreQJsonObject.cpp"
}
开发者ID:rff255,项目名称:python-qt5,代码行数:58,代码来源:sipQtCoreQJsonObject.cpp

示例7: testFaces

void GetFaceResourceTest::testFaces(const QString& fileName) {
    QString base = testResources + QDir::separator() + fileName;
    QFile file(base + ".jpg");
    QJsonDocument current;
    int status = faceResource->getJSONFaces(&file, current);
    file.close();
    QCOMPARE(HttpHeaders::STATUS_SUCCESS, status);

    QFile jsonFile(base + ".json");

    QVERIFY(jsonFile.exists());

    jsonFile.open(QIODevice::ReadOnly | QIODevice::Text);
    QJsonDocument expected = QJsonDocument().fromJson(jsonFile.readAll());
    jsonFile.close();

    QJsonArray currentArray = current.array();
    QJsonArray expectedArray = expected.array();

    // Make sure we're not comparing zero to zero
    QVERIFY(expectedArray.size() > 0);
    QCOMPARE(currentArray.size(), expectedArray.size());

    for (int i=0; i<currentArray.size(); ++i) {
        QJsonObject cFaceParts = currentArray[i].toObject();
        QJsonObject eFaceParts = expectedArray[i].toObject();

        QJsonObject cFace = eFaceParts["face"].toObject();
        QJsonObject eFace = eFaceParts["face"].toObject();
        compareDoubles(cFace["x1"].toDouble(), eFace["x1"].toDouble(), 0.0001);
        compareDoubles(cFace["x2"].toDouble(), eFace["x2"].toDouble(), 0.0001);
        compareDoubles(cFace["y1"].toDouble(), eFace["y1"].toDouble(), 0.0001);
        compareDoubles(cFace["y2"].toDouble(), eFace["y2"].toDouble(), 0.0001);

        QCOMPARE(cFaceParts["pose"], eFaceParts["pose"]);
        QCOMPARE(cFaceParts["model"], eFaceParts["model"]);

        QJsonObject cParts = cFaceParts["parts"].toObject();
        QJsonObject eParts = eFaceParts["parts"].toObject();

        QCOMPARE(cParts.size(), eParts.size());

        for (QJsonObject::const_iterator cIter = cParts.constBegin(); cIter != cParts.constEnd(); ++cIter) {
            QJsonArray cSubpart = cIter.value().toArray();
            QJsonArray eSubpart = cParts[cIter.key()].toArray();

            QCOMPARE(cSubpart.size(), eSubpart.size());

            for (int i=0; i<cSubpart.size(); ++i) {
                QJsonObject cPart = cSubpart[i].toObject();
                QJsonObject ePart = eSubpart[i].toObject();
                compareDoubles(cPart["x"].toDouble(), ePart["x"].toDouble(), 0.0001);
                compareDoubles(cPart["y"].toDouble(), ePart["y"].toDouble(), 0.0001);
                QCOMPARE(cPart["num"], ePart["num"]);
            }
        }
    }
}
开发者ID:davidgev,项目名称:face-parts-service,代码行数:58,代码来源:tst_getfaceresource.cpp

示例8: compileObjectProperty

void XSAppBuilder::compileObjectProperty(const QString &qName, const QXmlAttributes &atts, xsObject *object)
{
    if(root.contains(qName))
    {
        QJsonObject obj = root.value(qName).toObject();
        QJsonObject::const_iterator it = obj.constBegin();
        while(it != obj.constEnd())
        {
            if(it.key() == "prototype")
            {
                it++;
                continue;
            }

            if(it.key() == "@inherit")
            {
                compileObjectProperty(it.value().toString().toLower(), atts, object);
            }
           else if(it.value().isObject())
            {
                if(atts.value(it.key()).isEmpty())
                {
                    it++;
                    continue;
                }

                QJsonObject subObj = it.value().toObject();
                if(subObj.contains("type"))
                {
                    xsValue property;
                    transformValue(subObj, &property, atts.value(it.key()).remove(" "), it.key());
                    object->setProperty(it.key().toStdString().c_str(), &property);
                    if(it.key() == "position")
                    {
                        qDebug()<<it.key().toStdString().c_str();
                        qDebug()<<property.type;
                        qDebug()<<property.data.n;
                    }
                }
            }

            it ++;
        }
    }
}
开发者ID:mixtile,项目名称:xskit,代码行数:45,代码来源:xsappbuilder.cpp

示例9: buildObject

void QJsonView::buildObject(const QString& name, const QJsonObject &obj, QTreeWidgetItem *parent)
{
   QTreeWidgetItem *item = createItem(name + (!name.isEmpty()? " " : "") + "{...}", parent, TYPE_ITEM_OBJECT);
   QJsonObject::const_iterator iterator = obj.begin();
   while( iterator != obj.end() ) {
       addItem(iterator.key(), iterator.value(), item);
       ++iterator;
   }
}
开发者ID:ScotterC,项目名称:qrestclient,代码行数:9,代码来源:qjsonview.cpp

示例10: type

QString DBSchema::type(QString tableName, QString fieldName) const
{
    QJsonArray table = jsondoc.object().value(tableName).toArray();
    for (int i = 0; i < table.size(); ++i){
        QJsonObject field = table.at(i).toObject();
        QJsonObject::const_iterator it = field.constBegin();
        if (it.key() == fieldName ){
            return it.value().toString();
        }
    }
    return QString();
}
开发者ID:theme,项目名称:MangaLib,代码行数:12,代码来源:dbschema.cpp

示例11: fromJsonObject

QV4::ReturnedValue JsonObject::fromJsonObject(ExecutionEngine *engine, const QJsonObject &object)
{
    Scope scope(engine);
    Scoped<Object> o(scope, engine->newObject());
    ScopedString s(scope);
    ScopedValue v(scope);
    for (QJsonObject::const_iterator it = object.begin(); it != object.end(); ++it) {
        v = fromJsonValue(engine, it.value());
        o->put((s = engine->newString(it.key())).getPointer(), v);
    }
    return o.asReturnedValue();
}
开发者ID:Drakey83,项目名称:steamlink-sdk,代码行数:12,代码来源:qv4jsonobject.cpp

示例12: dealLogIn

void NetWork::dealLogIn(QNetworkReply *reply)
{
	QJsonObject obj = getObject(*reply);
	if (obj.isEmpty())
		return;
	int code = obj.find("code").value().toInt();
	if (code != 200)
	{
		emit logInStatus(code, "");
		return;
	}
	QJsonObject::const_iterator it = obj.find("profile");
	if (it != obj.constEnd())
	{
		QJsonObject profileObj = it.value().toObject();
		m_userId = profileObj.find("userId").value().toInt();
		m_nickName = profileObj.find("nickname").value().toString();
		//	头像....
		logInStatus(code, m_nickName);
	}
}
开发者ID:Unymicle,项目名称:NetEase,代码行数:21,代码来源:network.cpp

示例13: dealGetMusicList

void NetWork::dealGetMusicList(QNetworkReply *reply)
{
	QJsonObject obj = getObject(*reply);
	if (obj.isEmpty())
		return;
	QStringList list;
	QVector<int> vector;
	//		获取歌单...
	QJsonObject::const_iterator it = obj.find("playlist");
	if (it != obj.constEnd())
	{
		QJsonArray array = it.value().toArray();
		for (int j = 0; j < array.count(); j++)
		{
			QJsonObject mObj = array.at(j).toObject();
			QString name = mObj.find("name").value().toString();
			int id = mObj.find("id").value().toInt();

			list.append(name);
			vector.append(id);
		}
	}
	emit musicList(list, vector);
}
开发者ID:Unymicle,项目名称:NetEase,代码行数:24,代码来源:network.cpp

示例14: transformValue

void XSAppBuilder::transformValue(const QJsonObject &subObj, xsValue *property, const QString &data, const QString &name)
{
    if(subObj.value("type").toString() == "int")
    {
        property->type = XS_VALUE_INT32;
        property->data.n = data.toInt();
    }
    else if(subObj.value("type").toString() == "boolean")
    {
        property->type = XS_VALUE_BOOL;
        if(data == "true")
            property->data.n = true;
        else
            property->data.n = false;
    }
    else if(subObj.value("type").toString() == "hashcode")
    {
        property->type = XS_VALUE_UINT32;
        property->data.n = data.toInt();
    }
    else if(subObj.value("type").toString() == "string")
    {
        property->type = XS_VALUE_STRING;
        property->data.s = const_cast<char *>(data.toStdString().c_str());
    }
    else if(subObj.value("type").toString() == "text")
    {
        property->type = XS_VALUE_TEXT;
#ifdef XS_UNICODE
        property->data.t = const_cast<xsTChar *>(data.toStdWString().c_str());
#else
        property->data.s = const_cast<char *>(data.toStdString().c_str());
#endif
    }
    else if(subObj.value("type").toString() == "array")//功能可能有问题
    {
        QString regex = subObj.value(("regex")).toString();
        QString subStringType = subObj.value("stringType").toString();
        bool toText = false;
        if(!subStringType.isEmpty() && subStringType == "text")
        {
            toText = true;
        }
        if(regex.isEmpty())
        {
            if(toText)
            {
                property->type = XS_VALUE_TEXT;
#ifdef XS_UNICODE
                property->data.t = const_cast<xsTChar *>(data.toStdWString().c_str());
#else
                property->data.s = const_cast<char *>(data.toStdString().c_str());
#endif
            }
            else
            {
                property->type = XS_VALUE_STRING;
                property->data.s = const_cast<char *>(data.toStdString().c_str());
            }
            return;
        }

         xsArray *ar = xsArrayCreate(2);
        property->type = XS_VALUE_ARRAY;
        property->data.array = ar;
        if(regex.length() == 0)
        {
            xsValue str;
            str.type = XS_VALUE_STRING;
            str.data.s = const_cast<char *>(data.toStdString().c_str());
            xsArrayAdd(ar, &str);
        }
        else
        {
            QStringList strs = data.split(regex);
            for(int i = 0; i < strs.size(); i++)
            {
                if(toText)
                {
                    xsValue str;
                    str.type = XS_VALUE_TEXT;
#ifdef XS_UNICODE
                    str.data.t = const_cast<xsTChar *>(strs.at(i).toStdWString().c_str());
#else
                    str.data.s = const_cast<char *>(strs.at(i).toStdString().c_str());
#endif
                }
                else
                {
                    xsValue str;
                    str.type = XS_VALUE_STRING;
                    str.data.s = const_cast<char *>(strs.at(i).toStdString().c_str());
                    xsArrayAdd(ar, &str);
                }
            }
        }
    }
    else if(subObj.value("type").toString() == "enum")
    {
        property->type = XS_VALUE_INT32;
//.........这里部分代码省略.........
开发者ID:mixtile,项目名称:xskit,代码行数:101,代码来源:xsappbuilder.cpp

示例15: read

void LangsTranslation::read(const QJsonObject &json){
    QJsonObject::const_iterator i;
    for (i = json.begin(); i != json.end(); i++){
        m_names[i.key().toInt()] = i.value().toString();
    }
}
开发者ID:Wano-k,项目名称:RPG-Paper-Maker,代码行数:6,代码来源:langstranslation.cpp


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