本文整理汇总了C++中qvariantmap::const_iterator::value方法的典型用法代码示例。如果您正苦于以下问题:C++ const_iterator::value方法的具体用法?C++ const_iterator::value怎么用?C++ const_iterator::value使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类qvariantmap::const_iterator
的用法示例。
在下文中一共展示了const_iterator::value方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: context_scope
std::map<QString, double> ScriptMatch::getFeatures(const ConstOsmMapPtr& map) const
{
Context::Scope context_scope(_script->getContext());
HandleScope handleScope;
// removing these two lines causes a crash when checking for conflicts. WTF?
Handle<Object> global = _script->getContext()->Global();
global->Get(String::NewSymbol("plugin"));
std::map<QString, double> result;
Handle<Value> v = _callGetMatchFeatureDetails(map);
if (v.IsEmpty() || v->IsObject() == false)
{
throw IllegalArgumentException(
"Expected getMatchFeatureDetails to return an associative array.");
}
QVariantMap vm = toCpp<QVariantMap>(v);
for (QVariantMap::const_iterator it = vm.begin(); it != vm.end(); ++it)
{
if (it.value().isNull() == false)
{
double d = it.value().toDouble();
result[it.key()] = d;
if (isnan(result[it.key()]))
{
LOG_WARN("found NaN feature value for: " << it.key());
}
}
}
return result;
}
示例2: toString
QString QstMessage::toString() const
{
QString ret;
if (!isUnpacked()) {
ret = QLatin1String("(packed)\n");
return ret;
}
QVariantMap::const_iterator i = m_map.constBegin();
while (i != m_map.constEnd()) {
if (!i.value().isValid()) {
i++;
continue;
}
ret += i.key() + QLatin1String(": ");
if (i.value().canConvert<QStringList>())
ret += QLatin1String("'") + i.value().toStringList().join(QLatin1String("','")) + QLatin1String("'");
else if (i.value().canConvert<QString>())
ret += QLatin1String("'") + i.value().toString() + QLatin1String("'");
else
ret += QLatin1String("(data)");
ret += QLatin1Char('\n');
++i;
}
if (ret.endsWith(QLatin1Char('\n'))) ret.chop(1);
return ret;
}
示例3: copyParametersToDialog
void ShaderDialog::copyParametersToDialog(QVariantMap const& map)
{
QString name;
double val;
bool ok;
hideOptionControls();
int sliderCount(0);
int checkBoxCount(0);
int lightBoxCount(0);
for (QVariantMap::const_iterator iter = map.begin(); iter != map.end(); ++iter) {
name = iter.key();
if (name.startsWith("user_light_")) {
// lights are either on or off, no dimmers here
name.replace("user_light_","");
name.replace("_"," ");
m_dialog.lightBox->show();
if (lightBoxCount < s_maxLightBoxes) {
m_lightBoxes[lightBoxCount]->show();
m_lightBoxes[lightBoxCount]->setText(name);
m_lightBoxes[lightBoxCount]->setChecked(iter.value().toBool());
++lightBoxCount;
}
} else if (name.startsWith("user_")) {
name.replace("user_","");
name.replace("_"," ");
switch (iter.value().type()) {
case QVariant::Bool:
if (checkBoxCount < s_maxCheckBoxes) {
m_dialog.optionBox->show();
m_checkBoxes[checkBoxCount]->show();
m_checkBoxes[checkBoxCount]->setText(name);
m_checkBoxes[checkBoxCount]->setChecked(iter.value().toBool());
++checkBoxCount;
}
break;
case QVariant::Double:
case QMetaType::Float:
val = iter.value().toDouble(&ok);
if (ok && val <= 1.0 && sliderCount < s_maxSliders) {
m_labels[sliderCount]->show();
m_labels[sliderCount]->setText(name);
m_sliders[sliderCount]->show();
m_sliders[sliderCount]->setValue(100*val);
++sliderCount;
}
break;
default:
qDebug() << "Unsupported QVariant type in ShaderDialog" << iter.value().type();
break;
}
}
}
}
示例4: setupModelData
void TreeJsonModel::setupModelData(const QVariant& newdata, TreeJsonItem* parent)
{
QMetaType::Type type = (QMetaType::Type)newdata.type();
if (type == QMetaType::QVariantMap) {
QVariantMap map = newdata.toMap();
QVariantMap::const_iterator it;
for (it = map.constBegin(); it != map.constEnd(); it++) {
type = (QMetaType::Type)it.value().type();
if (type == QMetaType::QString || type == QMetaType::ULongLong) {
QList<QVariant> value;
value << it.key() << it.value();
TreeJsonItem* item = new TreeJsonItem(value,parent);
parent->appendChild(item);
} else if (type == QMetaType::QVariantMap) {
QList<QVariant> value;
value << it.key() << "{";
TreeJsonItem* item = new TreeJsonItem(value,parent);
parent->appendChild(item);
setupModelData(it.value(),item);
item->setData(1,QString("{%1}").arg(item->childCount()));
} else if (type == QMetaType::QVariantList) {
QList<QVariant> value;
value << it.key() << "[";
TreeJsonItem* item = new TreeJsonItem(value,parent);
parent->appendChild(item);
setupModelData(it.value(),item);
item->setData(1,QString("[%1]").arg(item->childCount()));
}
}
} else if (type == QMetaType::QVariantList) {
QVariantList list = newdata.toList();
int len = list.size();
for (int i=0;i<len;i++) {
type = (QMetaType::Type)list.value(i).type();
if (type == QMetaType::QString || type == QMetaType::ULongLong) {
QList<QVariant> value;
value << i << list.value(i);
TreeJsonItem* item = new TreeJsonItem(value,parent);
parent->appendChild(item);
} else if (type == QMetaType::QVariantMap) {
QList<QVariant> value;
value << i << "{";
TreeJsonItem* item = new TreeJsonItem(value,parent);
parent->appendChild(item);
setupModelData(list.value(i),item);
item->setData(1,QString("{%1}").arg(item->childCount()));
} else if (type == QMetaType::QVariantList) {
QList<QVariant> value;
value << i << "[";
TreeJsonItem* item = new TreeJsonItem(value,parent);
parent->appendChild(item);
setupModelData(list.value(i),item);
item->setData(1,QString("[%1]").arg(item->childCount()));
}
}
}
}
示例5: 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);
}
}
示例6: DbgPrintf
bool tLibs3::UploadFile( tTransfer* pTransfer )
{
bool success = false;
if( m_Process.state() == QProcess::NotRunning )
{
QString archiveFilename = pTransfer->GetTransferGroup()->GetDirectoryToString() + QDir::separator() + pTransfer->GetArchiveFilename();
QVariantMap metaData = pTransfer->GetMetaData();
for(QVariantMap::const_iterator iter = metaData.begin(); iter != metaData.end(); ++iter)
{
DbgPrintf( QString("%1 = %2").arg(iter.key()).arg(iter.value().toString()) );
}
QString uploadName;
{
uploadName = "navicomerlintest/"; // TODO
uploadName += "support.";
uploadName += tUploadAWS::CreateFilename(metaData["brand"].toString(), metaData["model"].toString(), metaData["serialnumber"].toString(), metaData["time"].toString());
}
QStringList args;
args << "-f" << "put" << QString("%1").arg(uploadName);
args << QString("filename=%1").arg(archiveFilename);
for(QVariantMap::const_iterator iter = metaData.begin(); iter != metaData.end(); ++iter)
{
QString value;
if (iter.value().isValid() == true)
{
value = iter.value().toString();
}
if (value.isEmpty() == false)
{
// x-amz-meta-serial=123456
args << QString("x-amz-meta-%1=%2").arg(iter.key()).arg(value);
}
}
QString command = "";
#ifdef Q_WS_WIN
command = QString( "..\\..\\ThirdParty\\libs3\\s3.exe" );
#else
command = QString( "s3" );
#endif
#ifdef DATATRANSFERMANAGER_DBG
DbgPrintf(command);
foreach (QString arg, args)
{
DbgPrintf( QString(" \"%1\"").arg(arg) );
}
示例7: findKey
QStringList FindKeyOperation::findKey(const QVariantMap &map, const QString &key)
{
QStringList result;
for (QVariantMap::const_iterator i = map.begin(); i != map.end(); ++i) {
if (i.key() == key) {
result << key;
continue;
}
if (i.value().type() == QVariant::Map) {
QStringList subKeyList = findKey(i.value().toMap(), key);
foreach (const QString &subKey, subKeyList)
result << i.key() + QLatin1Char('/') + subKey;
}
}
示例8: getMap
void jsonparser::getMap(QVariantMap* depmap,QVariantMap* totalMap,ActiveOptionsContainer* activeOpts, JasonCore* jCore){
QStringList excludes = jCore->getCoreElements();
for(QVariantMap::const_iterator it = depmap->begin(); it!=depmap->end(); it++){
if(!excludes.contains(it.key())){
activeOpts->addOption(it.key(),it.value());
continue;
}
if(it.key()=="imports")
for(QVariant el : it.value().toList()){
getMap(new QVariantMap(jsonOpenFile(el.toMap().value("file").toString()).object().toVariantMap()),totalMap,activeOpts,jCore);
continue;
}
totalMap->insertMulti(it.key(),it.value()); //We want to generate a complete map of all values from all files. We'll deal with conflicts later.
}
}
示例9: resolve
/*----------------------------------------------------------------------------*/
QString TemplateSet :: resolve(const QString& name, const QString& format, QVariantMap* dict)
{
QVariant result;
QString resultStr;
bool found = false;
if(dict != NULL)
{
QVariantMap::const_iterator it = dict->find(name);
if(it != dict->end())
{
result = it.value();
found = true;
}
}
if(!found)
{
StringMap::iterator it = strHash.find(name);
if(it != strHash.end())
{
result = it.value();
}
else
qDebug() << "Variable" << name << "not found";
}
if(!format.isEmpty())
{
QString formatStr;
if(format.at(0).toAscii() != '%')
formatStr = "%";
formatStr += format;
switch(formatStr.at(formatStr.size() - 1).toAscii())
{
case 'u':
case 'X':
case 'x':
resultStr = QString().sprintf(formatStr.toAscii().constData(), result.toUInt());
break;
case 'd':
resultStr = QString().sprintf(formatStr.toAscii().constData(), result.toInt());
break;
case 'f':
resultStr = QString().sprintf(formatStr.toAscii().constData(), result.toDouble());
break;
case 's':
resultStr = QString().sprintf(formatStr.toAscii().constData(), result.toString().toAscii().constData());
break;
default:
qDebug() << "Format specifier not supported" << format;
resultStr = result.toString();
break;
}
}
else
resultStr = result.toString();
return resultStr;
}
示例10: hostInfoMap
/*
* This function builds a map of hostname -> [ "region" -> regionName, "service" -> serviceName ]
* for every host AWS supports (as gleaned from Amazons' endpoints.xml file).
*/
QVariantMap AwsEndpointTestData::hostInfoMap()
{
QVariantMap hosts;
const QVariantMap regions = AwsEndpointTestData::regionServiceHosts();
for (QVariantMap::const_iterator region = regions.constBegin(); region != regions.constEnd(); ++region) {
const QVariantMap services = region.value().toMap();
for (QVariantMap::const_iterator service = services.constBegin(); service != services.constEnd(); ++service) {
QVariantMap hostInfo;
hostInfo.insert(QLatin1String("region"),
hosts.contains(service.value().toString()) ? QString::fromLatin1("us-east-1") : region.key());
hostInfo.insert(QLatin1String("service"), service.key());
hosts.insert(service.value().toString(), hostInfo);
}
}
return hosts;
}
示例11: onPropertiesChanged
void MprisPlayer::onPropertiesChanged(const QDBusMessage &msg)
{
QDBusArgument arg = msg.arguments().at(1).value<QDBusArgument>();
QVariantMap map = qdbus_cast<QVariantMap>(arg);
QVariantMap::const_iterator it = map.find(QLatin1String("Metadata"));
if (it != map.end()) {
arg = it.value().value<QDBusArgument>();
onTrackChanged(qdbus_cast<QVariantMap>(arg));
}
it = map.find(QLatin1String("PlaybackStatus"));
if (it != map.end()) {
DBusMprisPlayerStatus status;
status.Play = it.value().toString() == QLatin1String("Playing") ? 0 : 1;
onStatusChanged(status);
}
}
示例12: 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;
}
}
示例13: findKey
QStringList FindKeyOperation::findKey(const QVariant &in, const QString &key, const QString &prefix)
{
QStringList result;
if (in.type() == QVariant::Map) {
QVariantMap map = in.toMap();
for (QVariantMap::const_iterator i = map.begin(); i != map.end(); ++i) {
QString pfx = prefix;
if (!pfx.isEmpty())
pfx.append(QLatin1Char('/'));
if (i.key() == key) {
result << pfx + key;
} else {
pfx.append(i.key());
result.append(findKey(i.value(), key, pfx));
}
}
} else if (in.type() == QVariant::List) {
QVariantList list = in.toList();
for (int pos = 0; pos < list.count(); ++pos) {
QString pfx = prefix + QLatin1Char('[') + QString::number(pos) + QLatin1Char(']');
result.append(findKey(list.at(pos), key, pfx));
}
}
return result;
}
示例14: setExtraData
void TransactionObjectBuilder::setExtraData(const QVariantMap &data)
{
for(QVariantMap::const_iterator it = data.begin(), end = data.end(); it!=end; ++it)
{
_data.insert(it.key(), QJsonValue::fromVariant(it.value()));
}
}
示例15: get_conference_room_infos
QVariantMap RemoteControl::get_conference_room_infos()
{
QVariantMap args;
XletConference* conference_xlet = this->get_xlet<XletConference>("conference");
QAbstractItemModel* conflist_model = conference_xlet->findChild<QAbstractItemModel*>("conflist_model");
args["conference_xlet"] = conference_xlet != NULL;
args["conflist_model"] = conflist_model != NULL;
QVariantList content;
QVariantMap header_data;
header_data["name"] = ConfListModel::NAME;
header_data["number"] = ConfListModel::NUMBER;
header_data["pin_required"] = ConfListModel::PIN_REQUIRED;
header_data["member_count"] = ConfListModel::MEMBER_COUNT;
header_data["started_since"] = ConfListModel::STARTED_SINCE;
int nb_rows = conflist_model->rowCount(QModelIndex());
for (int row = 0; row < nb_rows; row++) {
QVariantMap header_value;
QVariantMap::const_iterator i;
for(i = header_data.begin(); i != header_data.end(); ++i) {
header_value[i.key()] = getValueInModel(conflist_model, row, i.value().toInt());
}
content.append(header_value);
}
args["content"] = content;
return args;
}