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


C++ QVariantMap::constEnd方法代码示例

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


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

示例1: size

ApiTraceState::ApiTraceState(const QVariantMap &parsedJson)
{
    m_parameters = parsedJson[QLatin1String("parameters")].toMap();
    QVariantMap attachedShaders =
        parsedJson[QLatin1String("shaders")].toMap();
    QVariantMap::const_iterator itr;


    for (itr = attachedShaders.constBegin(); itr != attachedShaders.constEnd();
         ++itr) {
        QString type = itr.key();
        QString source = itr.value().toString();
        m_shaderSources[type] = source;
    }

    m_uniforms = parsedJson[QLatin1String("uniforms")].toMap();

    m_buffers = parsedJson[QLatin1String("buffers")].toMap();

    {
        QVariantMap textures =
            parsedJson[QLatin1String("textures")].toMap();
        for (itr = textures.constBegin(); itr != textures.constEnd(); ++itr) {
            m_textures.append(getTextureFrom(itr.value().toMap(), itr.key()));
        }
    }

    QVariantMap fbos =
        parsedJson[QLatin1String("framebuffer")].toMap();
    for (itr = fbos.constBegin(); itr != fbos.constEnd(); ++itr) {
        QVariantMap buffer = itr.value().toMap();
        QSize size(buffer[QLatin1String("__width__")].toInt(),
                   buffer[QLatin1String("__height__")].toInt());
        QString cls = buffer[QLatin1String("__class__")].toString();
        int depth = buffer[QLatin1String("__depth__")].toInt();
        QString formatName = buffer[QLatin1String("__format__")].toString();

        QByteArray dataArray =
            buffer[QLatin1String("__data__")].toByteArray();

        QString label = itr.key();
        QString userLabel =
            buffer[QLatin1String("__label__")].toString();
        if (!userLabel.isEmpty()) {
            label += QString(", \"%1\"").arg(userLabel);
        }

        ApiFramebuffer fbo;
        fbo.setSize(size);
        fbo.setDepth(depth);
        fbo.setFormatName(formatName);
        fbo.setType(label);
        fbo.setData(dataArray);
        m_framebuffers.append(fbo);
    }
}
开发者ID:Innovative-Ideas,项目名称:apitrace,代码行数:56,代码来源:apitracecall.cpp

示例2: testSetting

void VlanSettingTest::testSetting()
{
    QFETCH(QString, interfaceName);
    QFETCH(QString, parent);
    QFETCH(quint32, id);
    QFETCH(quint32, flags);
    QFETCH(QStringList, ingressPriorityMap);
    QFETCH(QStringList, egressPriorityMap);

    QVariantMap map;

#if NM_CHECK_VERSION(1, 0, 0)
    map.insert(QLatin1String("interface-name"), interfaceName);
#else
    map.insert(QLatin1String(NM_SETTING_VLAN_INTERFACE_NAME), interfaceName);
#endif
    map.insert(QLatin1String(NM_SETTING_VLAN_PARENT), parent);
    map.insert(QLatin1String(NM_SETTING_VLAN_ID), id);
    map.insert(QLatin1String(NM_SETTING_VLAN_FLAGS), flags);
    map.insert(QLatin1String(NM_SETTING_VLAN_INGRESS_PRIORITY_MAP), ingressPriorityMap);
    map.insert(QLatin1String(NM_SETTING_VLAN_EGRESS_PRIORITY_MAP), egressPriorityMap);

    NetworkManager::VlanSetting setting;
    setting.fromMap(map);

    QVariantMap map1 = setting.toMap();
    QVariantMap::const_iterator it = map.constBegin();
    while (it != map.constEnd()) {
        QCOMPARE(it.value(), map1.value(it.key()));
        ++it;
    }
}
开发者ID:KDE,项目名称:networkmanager-qt,代码行数:32,代码来源:vlansettingtest.cpp

示例3: addProfile

void QbsManager::addProfile(const QString &name, const QVariantMap &data)
{
    qbs::Profile profile(name, settings());
    const QVariantMap::ConstIterator cend = data.constEnd();
    for (QVariantMap::ConstIterator it = data.constBegin(); it != cend; ++it)
        profile.setValue(it.key(), it.value());
}
开发者ID:ZerpHmm,项目名称:qt-creator,代码行数:7,代码来源:qbsprojectmanager.cpp

示例4: addProfile

void QbsManager::addProfile(const QString &name, const QVariantMap &data)
{
    const QString base = QLatin1String(PROFILES_PREFIX) + name;
    const QVariantMap::ConstIterator cend = data.constEnd();
    for (QVariantMap::ConstIterator it = data.constBegin(); it != cend; ++it)
        m_settings->setValue(base + it.key(), it.value());
}
开发者ID:aizaimenghuangu,项目名称:QtTestor,代码行数:7,代码来源:qbsprojectmanager.cpp

示例5: prepareSetFieldsUpdateQuery

			void DatabaseUtilities::prepareSetFieldsUpdateQuery(QSqlQuery& query, QString const& queryString, QVariantMap const& fieldsAndValues) {
				if (fieldsAndValues.size() > 0) {
					QString setString;
					setString.reserve(512);
					auto it = fieldsAndValues.constBegin();
					auto const end = fieldsAndValues.constEnd();

					int keyIndex = 1;
					for (; it != end; ++it) {
						if (!setString.isEmpty()) {
							setString.append(QStringLiteral(", "));
						}
						setString.append(QStringLiteral("`%1` = :value%2").arg(it.key()).arg(keyIndex, 4, 10, QChar('0')));
						++keyIndex;
					}

					query.prepare(queryString.arg(setString));

					it = fieldsAndValues.constBegin();
					keyIndex = 1;
					for (; it != end; ++it) {
						query.bindValue(QStringLiteral(":value%1").arg(keyIndex, 4, 10, QChar('0')), it.value());
						++keyIndex;
					}
				} else {
					throw openmittsu::exceptions::InternalErrorException() << "Can not build setFields update query part with empty field/value map, this should never happen!";
				}
			}
开发者ID:blizzard4591,项目名称:openMittsu,代码行数:28,代码来源:DatabaseUtilities.cpp

示例6:

static void
interpretInstances( const YAML::Node& node, Settings::InstanceDescriptionList& customInstances )
{
    // Parse the custom instances section
    if ( node )
    {
        QVariant instancesV = CalamaresUtils::yamlToVariant( node ).toList();
        if ( instancesV.type() == QVariant::List )
        {
            const auto instances = instancesV.toList();
            for ( const QVariant& instancesVListItem : instances )
            {
                if ( instancesVListItem.type() != QVariant::Map )
                    continue;
                QVariantMap instancesVListItemMap =
                        instancesVListItem.toMap();
                Settings::InstanceDescription instanceMap;
                for ( auto it = instancesVListItemMap.constBegin();
                        it != instancesVListItemMap.constEnd(); ++it )
                {
                    if ( it.value().type() != QVariant::String )
                        continue;
                    instanceMap.insert( it.key(), it.value().toString() );
                }
                customInstances.append( instanceMap );
            }
        }
    }
}
开发者ID:calamares,项目名称:calamares,代码行数:29,代码来源:Settings.cpp

示例7: testSetting

void BridgeSettingTest::testSetting()
{
    QFETCH(QString, interfaceName);
    QFETCH(bool, stp);
    QFETCH(quint16, priority);
    QFETCH(quint16, forwardDelay);
    QFETCH(quint16, helloTime);
    QFETCH(quint16, maxAge);
    QFETCH(quint32, ageintTime);

    QVariantMap map;

#if NM_CHECK_VERSION(1, 0, 0)
    map.insert(QLatin1String("interface-name"), interfaceName);
#else
    map.insert(QLatin1String(NM_SETTING_BRIDGE_INTERFACE_NAME), interfaceName);
#endif
    map.insert(QLatin1String(NM_SETTING_BRIDGE_STP), stp);
    map.insert(QLatin1String(NM_SETTING_BRIDGE_PRIORITY), priority);
    map.insert(QLatin1String(NM_SETTING_BRIDGE_FORWARD_DELAY), forwardDelay);
    map.insert(QLatin1String(NM_SETTING_BRIDGE_HELLO_TIME), helloTime);
    map.insert(QLatin1String(NM_SETTING_BRIDGE_MAX_AGE), maxAge);
    map.insert(QLatin1String(NM_SETTING_BRIDGE_AGEING_TIME), ageintTime);

    NetworkManager::BridgeSetting setting;
    setting.fromMap(map);

    QVariantMap map1 = setting.toMap();
    QVariantMap::const_iterator it = map.constBegin();
    while (it != map.constEnd()) {
        QCOMPARE(it.value(), map1.value(it.key()));
        ++it;
    }
}
开发者ID:KDE,项目名称:networkmanager-qt,代码行数:34,代码来源:bridgesettingtest.cpp

示例8: countQuery

			int DatabaseUtilities::countQuery(InternalDatabaseInterface const* database, QString const& tableName, QVariantMap const& whereQueryPart) {
				QSqlQuery query(database->getQueryObject());
				QString whereString;
				whereString.reserve(512);
				auto it = whereQueryPart.constBegin();
				auto const end = whereQueryPart.constEnd();

				int keyIndex = 1;
				for (; it != end; ++it) {
					if (whereString.isEmpty()) {
						whereString = QStringLiteral(" WHERE ");
					} else {
						whereString.append(QStringLiteral(" AND "));
					}
					whereString.append(QStringLiteral("`%1` = :value%2").arg(it.key()).arg(keyIndex, 4, 10, QChar('0')));
					++keyIndex;
				}

				query.prepare(QStringLiteral("SELECT Count(*) AS `count` FROM `%1`%2").arg(tableName).arg(whereString));

				it = whereQueryPart.constBegin();
				keyIndex = 1;
				for (; it != end; ++it) {
					query.bindValue(QStringLiteral(":value%1").arg(keyIndex, 4, 10, QChar('0')), it.value());
					++keyIndex;
				}

				if (query.exec() && query.isSelect() && query.next()) {
					return query.value(QStringLiteral("count")).toInt();
				} else {
					throw openmittsu::exceptions::InternalErrorException() << "Could not execute count query for table '" << tableName.toStdString() << "'. Query error: " << query.lastError().text().toStdString();
				}
			}
开发者ID:blizzard4591,项目名称:openMittsu,代码行数:33,代码来源:DatabaseUtilities.cpp

示例9: fromQVariant

Var Var::fromQVariant(QVariant qvar)
{
    Var var;
	if(qvar.type()==QVariant::List)
    {
        QVariantList qlist = qvar.toList();
		var.setType("list");
		for(int i=0;i<qlist.size();i++)
			var.append(fromQVariant(qlist[i]));
    }
	if(qvar.type()==QVariant::Map)
    {
        QVariantMap qmap = qvar.toMap();
		var.setType("map");
		for(QVariantMap::const_iterator i = qmap.constBegin();i != qmap.constEnd();i++)
			var.insert(i.key(),fromQVariant(i.value()));
    }
	if(qvar.type()==QVariant::String)
    {
        var.setType("string");
		var.setString(qvar.toString());
    }
	if(qvar.type()==QVariant::Int)
    {
        var.setType("string");
		var.setString(QString::number(qvar.toInt()));
    }
	if(qvar.type()==QVariant::Double)
    {
        var.setType("string");
		var.setString(QString::number(qvar.toDouble()));
    }
	return var;
	}
开发者ID:Aspenka,项目名称:SSD,代码行数:34,代码来源:var.cpp

示例10: valueFromVariantMap

 static inline bool valueFromVariantMap(const QVariantMap &v, const QString &key, T &value) {
     const QVariantMap::const_iterator it = v.constFind(key);
     const bool found = it != v.constEnd();
     if (found)
         value = qVariantValue<T>(it.value());
     return found;
 }
开发者ID:Mr-Kumar-Abhishek,项目名称:qt,代码行数:7,代码来源:grid.cpp

示例11: setModemPath

void QOfonoRadioSettings::setModemPath(const QString &path)
{
    if (path == d_ptr->modemPath ||
            path.isEmpty())
        return;

    QStringList removedProperties = d_ptr->properties.keys();

    delete d_ptr->radioSettings;
    d_ptr->radioSettings = new OfonoRadioSettings("org.ofono", path, QDBusConnection::systemBus(),this);

    if (d_ptr->radioSettings->isValid()) {
        d_ptr->modemPath = path;

        connect(d_ptr->radioSettings,SIGNAL(PropertyChanged(QString,QDBusVariant)),
                this,SLOT(propertyChanged(QString,QDBusVariant)));

        QVariantMap properties = d_ptr->radioSettings->GetProperties().value();
        for (QVariantMap::ConstIterator it = properties.constBegin();
             it != properties.constEnd(); ++it) {
            updateProperty(it.key(), it.value());
            removedProperties.removeOne(it.key());
        }

        Q_EMIT modemPathChanged(path);
    }

    foreach (const QString &p, removedProperties)
        updateProperty(p, QVariant());
}
开发者ID:amccarthy,项目名称:libqofono,代码行数:30,代码来源:qofonoradiosettings.cpp

示例12: toProperties

Properties VariantToMapConverter::toProperties(const QVariant &propertiesVariant,
                                               const QVariant &propertyTypesVariant) const
{
    const QVariantMap propertiesMap = propertiesVariant.toMap();
    const QVariantMap propertyTypesMap = propertyTypesVariant.toMap();

    Properties properties;

    QVariantMap::const_iterator it = propertiesMap.constBegin();
    QVariantMap::const_iterator it_end = propertiesMap.constEnd();
    for (; it != it_end; ++it) {
        int type = nameToType(propertyTypesMap.value(it.key()).toString());
        if (type == QVariant::Invalid)
            type = QVariant::String;

        QVariant value = it.value();

        if (type == filePathTypeId())
            value = resolvePath(mMapDir, value);

        value = fromExportValue(value, type);

        properties[it.key()] = value;
    }

    return properties;
}
开发者ID:Alturos,项目名称:tiled,代码行数:27,代码来源:varianttomapconverter.cpp

示例13: if

QVariant & value_unsafe(const QStringList & keys, QVariantMap & context){
    QVariantMap* map = &context;
    int i = 0;
    while(i < keys.size()) {
        const QString & key = keys.at(i++);
        QVariantMap::iterator it = map->find(key);
        if(it == map->constEnd())
            return nullVariant;
        QVariant & value = *it;
        if(i >= keys.size())
            return value;
        if(value.type() == QVariant::Map)
            map = &asMap(value);
        else if(i == keys.size() -1 && value.type() == QVariant::List) {
            const QString & idxStr = keys.at(i);
            bool ok;
            int idx = idxStr.toInt(&ok);
            if(ok) {
                QVariantList & lst = asList(value);
                if(idx < lst.size())
                    return lst[idx];
            }
        }
        else
            return nullVariant;
    }
    return nullVariant;
}
开发者ID:cor3ntin,项目名称:Ici,代码行数:28,代码来源:ici.cpp

示例14: load

void CameraItem::load(QVariantMap &d, int countId)
{
    QMap<QString, QVariant>::const_iterator i = d.constBegin();
    while (i != d.constEnd())
    {
        cameraData[i.key()] = i.value();
        ++i;
    }

    update_cameraId(cameraData["id"].toString());
    if (cameraData.contains("url_lowres"))
    {
        update_cameraId(QString::number(countId));
        isV1 = true; //when url_lowres is present, assume we are talking to a V1 calaos-os
        update_v1Url(cameraData["url_lowres"].toString());
    }
    update_name(cameraData["name"].toString());
    update_url_single(QString("image://camera/%1/%2").arg(get_cameraId()).arg(qrand()));
    currentImage = QImage(":/img/camera_nocam.png");

    qDebug() << "New camera loaded: " << get_name();

    QTimer::singleShot(100, this, [=]()
    {
        connection->getCameraPicture(get_cameraId(), get_v1Url());
    });
}
开发者ID:calaos,项目名称:calaos_mobile,代码行数:27,代码来源:CameraModel.cpp

示例15: connectOfono

void QOfonoMessageWaiting::connectOfono()
{
    bool wasReady = isReady();
    // FIXME: Clearing properties here results in false *Changed signal
    // emissions. Ideally ready() should not be derived from
    // properties.isEmpty(). Also compare with QOfonoSimManager.
    if (d_ptr->messageWaiting) {
        delete d_ptr->messageWaiting;
        d_ptr->messageWaiting = 0;
        d_ptr->properties.clear();
    }

    d_ptr->messageWaiting = new OfonoMessageWaiting("org.ofono", d_ptr->modemPath, QDBusConnection::systemBus(),this);

    if (d_ptr->messageWaiting->isValid()) {
        connect(d_ptr->messageWaiting,SIGNAL(PropertyChanged(QString,QDBusVariant)),
                this,SLOT(propertyChanged(QString,QDBusVariant)));

        QDBusPendingReply<QVariantMap> reply;
        reply = d_ptr->messageWaiting->GetProperties();
        reply.waitForFinished();
        if (reply.isError()) {
            Q_EMIT getPropertiesFailed();
        } else {
            QVariantMap properties = reply.value();
            for (QVariantMap::ConstIterator it = properties.constBegin();
                    it != properties.constEnd(); ++it) {
                updateProperty(it.key(), it.value());
            }
        }
    }

    if (wasReady != isReady())
        Q_EMIT readyChanged();
}
开发者ID:amccarthy,项目名称:libqofono,代码行数:35,代码来源:qofonomessagewaiting.cpp


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