本文整理汇总了C++中QVariantMap::end方法的典型用法代码示例。如果您正苦于以下问题:C++ QVariantMap::end方法的具体用法?C++ QVariantMap::end怎么用?C++ QVariantMap::end使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QVariantMap
的用法示例。
在下文中一共展示了QVariantMap::end方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: propertiesChanged
void RemoteActivatable::propertiesChanged(const QVariantMap &changedProperties)
{
Q_D(RemoteActivatable);
QStringList propKeys = changedProperties.keys();
QLatin1String deviceUniKey("deviceUni"),
activatableTypeKey("activatableType"),
sharedKey("shared");
QVariantMap::const_iterator it = changedProperties.find(deviceUniKey);
if (it != changedProperties.end())
{
d->deviceUni = it->toString();
propKeys.removeOne(deviceUniKey);
}
it = changedProperties.find(activatableTypeKey);
if (it != changedProperties.end())
{
d->activatableType = (Knm::Activatable::ActivatableType)it->toUInt();
propKeys.removeOne(activatableTypeKey);
}
it = changedProperties.find(sharedKey);
if (it != changedProperties.end())
{
d->shared = it->toBool();
propKeys.removeOne(sharedKey);
}
/*if (propKeys.count()) {
qDebug() << "Unhandled properties: " << propKeys;
}*/
}
示例2: SetRange
void SetRange(QCustomPlot& plot, int index, QVariantMap range, QCPAxis::AxisType type)
{
auto g = plot.graph(index);
auto it = range.find("lo");
if (it != range.end())
{
switch (type)
{
case QCPAxis::atLeft:
g->valueAxis()->setRangeLower(it->toReal());
break;
case QCPAxis::atBottom:
g->keyAxis()->setRangeLower(it->toReal());
break;
}
}
it = range.find("up");
if (it != range.end())
{
switch (type)
{
case QCPAxis::atLeft:
g->valueAxis()->setRangeUpper(it->toReal());
break;
case QCPAxis::atBottom:
g->keyAxis()->setRangeUpper(it->toReal());
break;
}
}
}
示例3: capabilities
void ModemManager::ModemLocationInterface::propertiesChanged(const QString & interface, const QVariantMap & properties)
{
mmDebug() << interface << properties.keys();
if (interface == QString("org.freedesktop.ModemManager.Modem.Location")) {
QLatin1String capabilities("Capabilities");
QLatin1String enabled("Enabled");
QLatin1String signalsLocation("SignalsLocation");
QLatin1String location("Location");
QVariantMap::const_iterator it = properties.find(capabilities);
if ( it != properties.end()) {
emit capabilitiesChanged((ModemManager::ModemLocationInterface::Capability)it->toUInt());
}
it = properties.find(enabled);
if ( it != properties.end()) {
emit enabledChanged(it->toBool());
}
it = properties.find(signalsLocation);
if ( it != properties.end()) {
emit signalsLocationChanged(it->toBool());
}
it = properties.find(location);
if ( it != properties.end()) {
QVariant v = it.value();
LocationInformationMap map;
if (v.canConvert<LocationInformationMap>()) {
map = v.value<LocationInformationMap>();
} else {
mmDebug() << "Error converting LocationInformationMap property";
}
emit locationChanged(map);
}
}
}
示例4: onRequestFinished
void YandexNarodAuthorizator::onRequestFinished(QNetworkReply *reply)
{
reply->deleteLater();
if (reply != m_reply.data())
return;
QVariantMap data = Json::parse(reply->readAll()).toMap();
QVariantMap::Iterator error = data.find(QLatin1String("error"));
if (error != data.end() || reply->error() != QNetworkReply::NoError) {
QString errorStr = error.value().toString();
m_stage = Need;
if (errorStr == QLatin1String("unsupported_grant_type"))
emit result(Error, tr("Unsupported grant type. Inform developers."));
else if (errorStr == QLatin1String("invalid_request"))
emit result(Error, tr("Invalid request. Inform developers."));
else
emit result(Error, tr("Invalid login or/and password"));
return;
}
QString accessToken = data.value(QLatin1String("access_token")).toString();
QDateTime expiresAt;
QVariantMap::Iterator expiresIn = data.find(QLatin1String("expires_in"));
if (expiresIn != data.end()) {
expiresAt = QDateTime::currentDateTime();
expiresAt.addSecs(expiresIn.value().toInt());
}
debug() << accessToken << data;
m_token = accessToken;
m_stage = Already;
emit result(Success);
emit needSaveCookies();
}
示例5: testFlashValidatorsDriver
static void testFlashValidatorsDriver(const QVariantMap ¶ms, const QVariantMap &validators, Context::Errors &errors)
{
QVariantMap::const_iterator ii, endii;
QVariantMap::const_iterator vv;
endii = params.end();
for (ii = params.begin(); ii != endii; ++ii) {
// check if there is a validator for this param
vv = validators.find(ii.key());
if (vv == validators.end())
continue;
// if its a map, we recurse
if (vv->type() == QVariant::Map)
testFlashValidatorsDriver(asVariantMap(*ii), asVariantMap(*vv), errors);
else {
// its not a map, execute the validator
ValidationExpr validexpr = ValidationExpr::fromVariant(*vv);
QStringList errorslist;
validexpr.test(*ii, &errorslist);
if (!errorslist.isEmpty())
errors[ii.key()] = errorslist;
}
}
}
示例6: findTheme
void DecorationBridge::findTheme(const QVariantMap &map)
{
auto it = map.find(QStringLiteral("themes"));
if (it == map.end()) {
return;
}
if (!it.value().toBool()) {
return;
}
it = map.find(QStringLiteral("defaultTheme"));
m_defaultTheme = it != map.end() ? it.value().toString() : QString();
m_theme = readTheme();
}
示例7: updateMainSectionSettings
void KonvergoWindow::updateMainSectionSettings(const QVariantMap& values)
{
// update mouse visibility if needed
if (values.find("disablemouse") != values.end())
{
SystemComponent::Get().setCursorVisibility(!SettingsComponent::Get().value(SETTINGS_SECTION_MAIN, "disablemouse").toBool());
}
if (values.find("fullscreen") == values.end())
return;
updateFullscreenState();
}
示例8: 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) );
}
示例9: onMediaDevicesListChanged
void CdoSampleAppWindow::onMediaDevicesListChanged(int devType,
QVariantMap devs)
{
QComboBox * targetCombo;
switch (devType)
{
case AUDIO_IN:
targetCombo = ui->micCombo;
break;
case AUDIO_OUT:
targetCombo = ui->spkCombo;
break;
case VIDEO_IN:
targetCombo = ui->camCombo;
break;
case SCREEN:
targetCombo = ui->screenCombo;
break;
}
targetCombo->clear();
QVariantMap::iterator i;
for (i = devs.begin(); i != devs.end(); ++i)
{
qDebug() << "Adding device: " << i.key();
targetCombo->addItem(QIcon(), i.value().toString(), i.key());
}
}
示例10: 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;
}
示例11: setupCompilerPathByLanguage
static void setupCompilerPathByLanguage(Profile &profile, const QStringList &toolchainTypes,
const QString &toolchainInstallPath, const QString &toolchainPrefix)
{
QVariantMap m;
if (toolchainTypes.contains(QLatin1String("clang"))) {
m[QLatin1String("c")] = m[QLatin1String("objc")] = QLatin1String("clang");
m[QLatin1String("cpp")] = m[QLatin1String("objcpp")] = QLatin1String("clang++");
} else if (toolchainTypes.contains(QLatin1String("gcc"))) {
m[QLatin1String("c")] = m[QLatin1String("objc")] = QLatin1String("gcc");
m[QLatin1String("cpp")] = m[QLatin1String("objcpp")] = QLatin1String("g++");
} else {
qDebug("WARNING: unexpected toolchain %s", qPrintable(toJSLiteral(toolchainTypes)));
return;
}
const QString toolchainPathPrefix = toolchainInstallPath + QLatin1Char('/') + toolchainPrefix;
for (QVariantMap::iterator it = m.begin(); it != m.end();) {
const QString filePath = HostOsInfo::appendExecutableSuffix(toolchainPathPrefix
+ it.value().toString());
if (QFile::exists(filePath)) {
it.value() = filePath;
++it;
continue;
}
qDebug("WARNING: Compiler %s for file tag %s not found.",
qPrintable(QDir::toNativeSeparators(filePath)), qPrintable(it.key()));
it = m.erase(it);
}
if (!m.isEmpty())
profile.setValue(QLatin1String("cpp.compilerPathByLanguage"), m);
}
示例12: restore
void StatusManager::restore(const QString& filename)
{
QVariant var;
// Try to Read a JSON file
bool res =
fromJsonFile(filename.toStdString().c_str(), var);
if (res)
{
const QVariantMap map = var.toMap();
for (QVariantMap::const_iterator it = map.begin();
it != map.end(); ++it)
{
Holder holder(status(it.key()));
if (holder.is_valid())
{
res = fromQVariant(holder.get_type_descriptor(),
holder, it.value());
if (res)
{
setStatus(it.key(), holder);
}
}
}
}
else
{
emit error(QString("Unable to load file '%1'").arg(filename));
}
}
示例13:
QVariantMap Nuria::RestfulHttpNode::deepConvertMap (QVariantMap map) {
for (auto it = map.begin (), end = map.end (); it != end; ++it) {
*it = serializeVariant (*it);
}
return map;
}
示例14: parseUniformVariables
/* This only parses uniform variables between the following lines:
// BEGIN UNIFORM
uniform float x; // default
uniform vec4 color; // red green blue alpha
// END UNIFORM
uniform can be replaced by 'in' and if no default is given the floats default
to 0.0 and the color to white. Comments between the BEGIN and END lines are
ignored.
*/
QVariantMap ShaderLibrary::parseUniformVariables(QString const& vertexShaderPath)
{
QVariantMap map;
QFile file(vertexShaderPath);
if (file.open(QIODevice::ReadOnly | QIODevice::Text)) {
Parser2::TextStream textStream(&file);
int n;
bool tf;
double value;
QString line;
QString name;
QColor color;
QStringList tokens;
textStream.seek("BEGIN UNIFORM");
while (!textStream.atEnd()) {
line = textStream.nextLine();
if (line.contains("END UNIFORM")) break;
if (!line.startsWith("//")) {
line = line.replace(";"," ");
line = line.replace(","," ");
line = line.replace("//"," ");
tokens = Parser2::TextStream::tokenize(line);
n = tokens.size();
if (n >= 3 && (tokens[0] == "uniform" || tokens[0] == "in")) {
name = tokens[2];
if (tokens[1] == "float") {
value = (n >= 4) ? tokens[3].toDouble() : 0.0;
map.insert(name, value);
}else if (tokens[1] == "bool") {
tf = (n >= 4) ? tokens[3].toInt() : false;
map.insert(name, tf);
}else if (tokens[1] == "vec4") {
color = Qt::white;
if (n >= 7) {
color.setRgbF(tokens[3].toDouble(), tokens[4].toDouble(),
tokens[5].toDouble(), tokens[6].toDouble());
}
map.insert(name, color);
}else {
qDebug() << "Unknown uniform variable in shader" << tokens[1];
}
}
}
}
file.close();
}
qDebug() << "Parsed the following uniform variables:";
for (QVariantMap::iterator iter = map.begin(); iter != map.end(); ++iter) {
qDebug() << iter.key() << iter.value();
}
return map;
}
示例15: checkErrors
void QCouch::checkErrors(QVariant var){
QVariantMap map = var.toMap();
if ( map.find("error") != map.end() ) {
throw CouchException(map["reason"].toString());
}
}