本文整理汇总了C++中qvariantmap::ConstIterator::value方法的典型用法代码示例。如果您正苦于以下问题:C++ ConstIterator::value方法的具体用法?C++ ConstIterator::value怎么用?C++ ConstIterator::value使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类qvariantmap::ConstIterator
的用法示例。
在下文中一共展示了ConstIterator::value方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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());
}
示例2: 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());
}
示例3: 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();
}
示例4: fetchPartition
void JsonDbSortingListModelPrivate::fetchPartition(int index, bool reset)
{
Q_Q(JsonDbSortingListModel);
if (index >= partitionObjects.count())
return;
if (state != JsonDbSortingListModel::Querying) {
state = JsonDbSortingListModel::Querying;
emit q->stateChanged(state);
}
RequestInfo &r = partitionObjectDetails[index];
QPointer<JsonDbPartition> p = partitionObjects[index];
Q_ASSERT(p);
if (reset) {
r.lastSize = -1;
r.lastOffset = 0;
} else {
r.lastOffset += chunkSize;
}
QJsonDbReadRequest *request = valueRequests[index]->newRequest(index);
request->setQuery(query);
QVariantMap::ConstIterator i = queryBindings.constBegin();
while (i != queryBindings.constEnd()) {
request->bindValue(i.key(), QJsonValue::fromVariant(i.value()));
++i;
}
request->setProperty("queryOffset", r.lastOffset);
request->setQueryLimit(chunkSize);
request->setPartition(p->name());
JsonDatabase::sharedConnection().send(request);
}
示例5: 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());
}
示例6:
// unite two QVariantMaps, but don't generate duplicate keys
static QVariantMap &operator+=(QVariantMap &lhs, const QVariantMap &rhs)
{
QVariantMap::ConstIterator it = rhs.constBegin(),
end = rhs.constEnd();
for ( ; it != end; ++it)
lhs.insert(it.key(), it.value());
return lhs;
}
示例7: setConfig
void QgsValueMapConfigDlg::setConfig( const QVariantMap &config )
{
tableWidget->clearContents();
for ( int i = tableWidget->rowCount() - 1; i > 0; i-- )
{
tableWidget->removeRow( i );
}
int row = 0;
QVariantMap values = config.value( QStringLiteral( "map" ) ).toMap();
for ( QVariantMap::ConstIterator mit = values.constBegin(); mit != values.constEnd(); mit++, row++ )
{
if ( mit.value().isNull() )
setRow( row, mit.key(), QString() );
else
setRow( row, mit.value().toString(), mit.key() );
}
}
示例8: fromVariant
//метод конвертирует QVariant в DataManager,
// а также определяет и устанавливает тип узла объекта
DataManager DataManager::fromVariant(QVariant qvar)
{
DataManager temp;
if(qvar.type() == QVariant::Map)
{
QVariantMap qmap = qvar.toMap();
temp.setType(T_MAP);
temp.setParent(&object);
//qDebug() << "map this: " << ;
QVariantMap::ConstIterator i = qmap.constBegin();
while(i != qmap.constEnd())
{
temp.append(fromVariant(i.value()), i.key());
i++;
}
}
else if(qvar.type() == QVariant::List)
{
QVariantList qlist = qvar.toList();
temp.setType(T_LIST);
temp.setParent(&array);
//qDebug() << "list this: " << &array;
for(int i=0; i<qlist.size(); i++)
{
temp.append(fromVariant(qlist.at(i)), "");
}
}
else if(qvar.type() == QVariant::String)
{
//qDebug() << "string this: " << &stringValue;
temp.setType(T_STRING);
temp.setValue(qvar.toString());
//temp.setParent(this);
}
else if(qvar.type() == QVariant::Int)
{
//qDebug() << "int this: " << &intValue;
temp.setType(T_INT);
temp.setValue(qvar.toInt());
//temp.setParent(this);
}
else if(qvar.type() == QVariant::Double)
{
//qDebug() << "double this: " << &doubleValue;
temp.setType(T_DOUBLE);
temp.setValue(qvar.toDouble());
//temp.setParent(this);
}
else if(qvar.type() == QVariant::Bool)
{
qDebug() << "bool this: " << &boolValue;
temp.setType(T_BOOL);
temp.setValue(qvar.toBool());
//temp.setParent(this);
}
return temp;
}
示例9: initWidget
void QgsValueMapSearchWidgetWrapper::initWidget( QWidget *editor )
{
mComboBox = qobject_cast<QComboBox *>( editor );
if ( mComboBox )
{
const QVariantMap cfg = config();
QVariantMap::ConstIterator it = cfg.constBegin();
mComboBox->addItem( tr( "Please select" ), "" );
while ( it != cfg.constEnd() )
{
if ( it.value() != QgsValueMapFieldFormatter::NULL_VALUE )
mComboBox->addItem( it.key(), it.value() );
++it;
}
connect( mComboBox, static_cast<void ( QComboBox::* )( int )>( &QComboBox::currentIndexChanged ), this, &QgsValueMapSearchWidgetWrapper::comboBoxIndexChanged );
}
}
示例10: doMethodJson
int HyvesAPI::doMethodJson(const QString &method, const QString &jsonParameters) {
QVariantMap variantMap = Util::jsonToVariantMap(jsonParameters);
GenusApis::OAuthUtil::ParameterMap parameterMap;
for (QVariantMap::ConstIterator it = variantMap.begin();
it != variantMap.end(); ++it) {
parameterMap[it.key()] = it.value().toString();
}
int id = m_d->genusApis->doMethod(method, parameterMap, m_d->accessToken);
m_d->log->debug(QString("Calling method '%1' (request #%2)").arg(method).arg(id));
return id;
}
示例11: sendInfo
void StatisticsHelperPrivate::sendInfo()
{
QUrl url(QLatin1String("http://qutim.org/stats"));
Config config = Profile::instance()->config();
config.beginGroup(QLatin1String("statistics"));
url.addQueryItem(QLatin1String("api"), QString::number(2));
QString id = config.value(QLatin1String("key"), QString());
if (!id.isEmpty())
url.addQueryItem(QLatin1String("key"), id);
for (QVariantMap::ConstIterator it = systemInfo.constBegin();
it != systemInfo.constEnd(); ++it) {
url.addQueryItem(it.key(), it.value().toString());
}
QObject::connect(manager.get(QNetworkRequest(url)), SIGNAL(finished()),
q_func(), SLOT(_q_on_finished()));
}
示例12: q
void
ImporterSqlConnection::slotQuery( const QString &query, const QVariantMap &bindValues,
bool* const ok )
{
Q_ASSERT( this->thread() == ThreadWeaver::Thread::currentThread() );
if( ok != 0 )
*ok = false;
QSqlDatabase db = connection();
if( !db.isOpen() )
return;
QSqlQuery q( db );
q.setForwardOnly( true );
q.prepare( query );
for( QVariantMap::ConstIterator bindValue = bindValues.constBegin();
bindValue != bindValues.constEnd(); ++bindValue )
q.bindValue( bindValue.key(), bindValue.value() );
if( q.exec() )
{
if( ok != 0 )
*ok = true;
m_result.reserve( q.size() );
while( q.next() )
{
const int fields = q.record().count();
QVariantList row;
row.reserve( fields );
for( int field = 0; field < fields; ++field )
row.append( q.value( field ) );
m_result.append( row );
}
}
else
warning() << __PRETTY_FUNCTION__ << q.lastError().text();
// This is a stupid QSqlDatabase connection manager; we don't want to leave connection
// open unless we're inside a transaction.
if( !isTransaction() )
db.close();
}
示例13: _q_on_finished
void StatisticsHelperPrivate::_q_on_finished()
{
QNetworkReply *reply = qobject_cast<QNetworkReply*>(q_func()->sender());
Q_ASSERT(reply);
if (reply->error() == QNetworkReply::NoError) {
QString key = QLatin1String(reply->readAll());
if (!key.isEmpty()) {
Config config = Profile::instance()->config();
config.beginGroup(QLatin1String("statistics"));
config.setValue(QLatin1String("key"), key);
for (QVariantMap::ConstIterator it = systemInfo.constBegin();
it != systemInfo.constEnd(); ++it) {
config.setValue(it.key(), it.value());
}
}
}
// q_func()->deleteLater();
}
示例14: init
void StatisticsHelperPrivate::init()
{
QRect size = qApp->desktop()->screenGeometry();
systemInfo.insert(QLatin1String("os"), SystemInfo::getVersion());
systemInfo.insert(QLatin1String("short"), SystemInfo::getName());
systemInfo.insert(QLatin1String("full"), SystemInfo::getFullName());
systemInfo.insert(QLatin1String("version"), versionString());
systemInfo.insert(QLatin1String("qt"), QLatin1String(qVersion()));
systemInfo.insert(QLatin1String("wordSize"), QString::number(QSysInfo::WordSize));
systemInfo.insert(QLatin1String("width"), QString::number(size.width()));
systemInfo.insert(QLatin1String("height"), QString::number(size.height()));
systemInfo.insert(QLatin1String("locale"), QLocale::system().name());
Config config = Profile::instance()->config();
config.beginGroup(QLatin1String("statistics"));
bool denied = config.value(QLatin1String("denied"), false);
bool automatic = config.value(QLatin1String("automatic"), false);
if (denied && automatic) {
action = StatisticsHelper::DeniedToSend;
return;
}
QString key = config.value(QLatin1String("key"), QString());
if (key.isEmpty()) {
action = StatisticsHelper::NeedToAskInit;
return;
}
for (QVariantMap::ConstIterator it = systemInfo.constBegin();
it != systemInfo.constEnd(); ++it) {
if (config.value(it.key(), QString()) != it.value().toString()) {
if (automatic) {
sendInfo();
action = StatisticsHelper::NothingToAsk;
return;
}
action = StatisticsHelper::NeedToAskUpdate;
return;
}
}
action = StatisticsHelper::NothingToAsk;
}
示例15: createOrUpdateNotification
void JsonDbSortingListModelPrivate::createOrUpdateNotification(int index)
{
Q_Q(JsonDbSortingListModel);
if (index >= partitionObjects.count())
return;
clearNotification(index);
QJsonDbWatcher *watcher = new QJsonDbWatcher();
watcher->setQuery(query);
watcher->setWatchedActions(QJsonDbWatcher::Created | QJsonDbWatcher::Updated |QJsonDbWatcher::Removed);
watcher->setPartition(partitionObjects[index]->name());
QVariantMap::ConstIterator i = queryBindings.constBegin();
while (i != queryBindings.constEnd()) {
watcher->bindValue(i.key(), QJsonValue::fromVariant(i.value()));
++i;
}
QObject::connect(watcher, SIGNAL(notificationsAvailable(int)),
q, SLOT(_q_notificationsAvailable()));
QObject::connect(watcher, SIGNAL(error(QtJsonDb::QJsonDbWatcher::ErrorCode,QString)),
q, SLOT(_q_notificationError(QtJsonDb::QJsonDbWatcher::ErrorCode,QString)));
JsonDatabase::sharedConnection().addWatcher(watcher);
partitionObjectDetails[index].watcher = watcher;
}