本文整理汇总了C++中QVariantMap::remove方法的典型用法代码示例。如果您正苦于以下问题:C++ QVariantMap::remove方法的具体用法?C++ QVariantMap::remove怎么用?C++ QVariantMap::remove使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QVariantMap
的用法示例。
在下文中一共展示了QVariantMap::remove方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: authActionQueryPerms
QVariantMap authActionQueryPerms(int i, QIODevice *connection,
const QSqlDatabase& db, const QSqlDatabase& user_db,
const QVariantMap& action, const QString& email)
{
Q_UNUSED(i);
Q_UNUSED(db);
Q_UNUSED(user_db);
Q_UNUSED(connection);
if( action.contains("email") )
{
QVariantMap perms = auth->queryPerms(
action.value("email").toString() ).toMap();
perms.remove("any");
QVariantMap map;
map["email"] = action.value("email");
map["perms"] = perms;
return map;
}
else
{
QVariantMap perms = auth->queryPerms(email).toMap();
perms.remove("any");
QVariantMap map;
map["email"] = email;
map["perms"] = perms;
return map;
}
}
示例2: modifyAccountObject
/**
* @brief FilePersistence::modifyAccountObject
* @param modifications
* @return
*/
bool FilePersistence::modifyAccountObject(const OptionTable &modifications)
{
int index = findAccountObj(modifications);
if (index < 0) {
m_error.append(QString("Could not modify Account object !\n"));
m_error.append(QString("There is no such an Account object.\n"));
return false;
}
QVariantMap modifyValues = variantMapFromOptionTable(modifications);
if (modifications.contains('i')) {
modifyValues.remove(optionToRealName('i'));
} else {
modifyValues.remove(optionToRealName('p'));
modifyValues.remove(optionToRealName('u'));
}
QVariantMap originObject = m_fileContent[index];
QStringList keyList = modifyValues.keys();
for (int index=0; index<keyList.size(); ++index) {
QVariant value = modifyValues.value(keyList[index]);
originObject.insert(keyList[index], value);
}
m_isModified = true;
return true;
}
示例3: mutate
void BoneLimitsMutation::mutate(QVariantMap &lowerLimits, QVariantMap &upperLimits)
{
// foreach axis...
QString allAxis[] = {"x","y","z"};
for(int i=0;i<3;i++){
QString axis = allAxis[i];
btScalar loValue = lowerLimits[axis].toDouble();
btScalar upValue = upperLimits[axis].toDouble();
loValue = axisMutation->mutate(loValue);
upValue = axisMutation->mutate(upValue);
// Y axis limited between -SIMD_PI/2..SIMD_PI/2
if(axis == "y") {
if(loValue < -SIMD_HALF_PI+0.1)
loValue = -SIMD_HALF_PI+0.1;
if(upValue > SIMD_HALF_PI-0.1)
upValue = SIMD_HALF_PI-0.1;
}
// 0 must be included between lo and up
if(loValue > 0)
loValue = 0;
if(upValue < 0)
upValue = 0;
lowerLimits.remove(axis);
upperLimits.remove(axis);
lowerLimits.insert(axis,QVariant((double)loValue));
upperLimits.insert(axis,QVariant((double)upValue));
}
}
示例4: toGlm
std::shared_ptr<StartEndRenderState> ParabolaPointer::buildRenderState(const QVariantMap& propMap) {
QUuid startID;
if (propMap["start"].isValid()) {
QVariantMap startMap = propMap["start"].toMap();
if (startMap["type"].isValid()) {
startMap.remove("visible");
startID = qApp->getOverlays().addOverlay(startMap["type"].toString(), startMap);
}
}
glm::vec3 color = glm::vec3(RenderState::ParabolaRenderItem::DEFAULT_PARABOLA_COLOR);
float alpha = RenderState::ParabolaRenderItem::DEFAULT_PARABOLA_COLOR.a;
float width = RenderState::ParabolaRenderItem::DEFAULT_PARABOLA_WIDTH;
bool isVisibleInSecondaryCamera = RenderState::ParabolaRenderItem::DEFAULT_PARABOLA_ISVISIBLEINSECONDARYCAMERA;
bool drawInFront = RenderState::ParabolaRenderItem::DEFAULT_PARABOLA_DRAWINFRONT;
bool enabled = false;
if (propMap["path"].isValid()) {
enabled = true;
QVariantMap pathMap = propMap["path"].toMap();
if (pathMap["color"].isValid()) {
color = toGlm(u8vec3FromVariant(pathMap["color"]));
}
if (pathMap["alpha"].isValid()) {
alpha = pathMap["alpha"].toFloat();
}
if (pathMap["width"].isValid()) {
width = pathMap["width"].toFloat();
}
if (pathMap["isVisibleInSecondaryCamera"].isValid()) {
isVisibleInSecondaryCamera = pathMap["isVisibleInSecondaryCamera"].toBool();
}
if (pathMap["drawInFront"].isValid()) {
drawInFront = pathMap["drawInFront"].toBool();
}
}
QUuid endID;
if (propMap["end"].isValid()) {
QVariantMap endMap = propMap["end"].toMap();
if (endMap["type"].isValid()) {
endMap.remove("visible");
endID = qApp->getOverlays().addOverlay(endMap["type"].toString(), endMap);
}
}
return std::make_shared<RenderState>(startID, endID, color, alpha, width, isVisibleInSecondaryCamera, drawInFront, enabled);
}
示例5: getSyncMainData
/**
* The function returns the changed data from the server to synchronize with the web client.
* Return value is map in JSON format.
* Map contain the key:
* - "Rid": ID response
* Map can contain the keys:
* - "full_update": full data update flag
* - "torrents": dictionary contains information about torrents.
* - "torrents_removed": a list of hashes of removed torrents
* - "labels": list of labels
* - "labels_removed": list of removed labels
* - "server_state": map contains information about the state of the server
* The keys of the 'torrents' dictionary are hashes of torrents.
* Each value of the 'torrents' dictionary contains map. The map can contain following keys:
* - "name": Torrent name
* - "size": Torrent size
* - "progress: Torrent progress
* - "dlspeed": Torrent download speed
* - "upspeed": Torrent upload speed
* - "priority": Torrent priority (-1 if queuing is disabled)
* - "num_seeds": Torrent seeds connected to
* - "num_complete": Torrent seeds in the swarm
* - "num_leechs": Torrent leechers connected to
* - "num_incomplete": Torrent leechers in the swarm
* - "ratio": Torrent share ratio
* - "eta": Torrent ETA
* - "state": Torrent state
* - "seq_dl": Torrent sequential download state
* - "f_l_piece_prio": Torrent first last piece priority state
* Server state map may contain the following keys:
* - "connection_status": conection status
* - "dht_nodes": DHT nodes count
* - "dl_info_data": bytes downloaded
* - "dl_info_speed": download speed
* - "dl_rate_limit: downlaod rate limit
* - "up_info_data: bytes uploaded
* - "up_info_speed: upload speed
* - "up_rate_limit: upload speed limit
* - "queueing": priority system usage flag
* - "refresh_interval": torrents table refresh interval
*/
QByteArray btjson::getSyncMainData(int acceptedResponseId, QVariantMap &lastData, QVariantMap &lastAcceptedData)
{
QVariantMap data;
QVariantHash torrents;
std::vector<torrent_handle> torrentsList = QBtSession::instance()->getTorrents();
std::vector<torrent_handle>::const_iterator it = torrentsList.begin();
std::vector<torrent_handle>::const_iterator end = torrentsList.end();
for (; it != end; ++it) {
QTorrentHandle torrent = QTorrentHandle(*it);
QVariantMap map = toMap(torrent);
map.remove(KEY_TORRENT_HASH);
torrents[torrent.hash()] = map;
}
data["torrents"] = torrents;
QVariantList labels;
foreach (QString s, Preferences::instance()->getTorrentLabels())
labels << s;
data["labels"] = labels;
QVariantMap serverState = getTranserInfoMap();
serverState[KEY_SYNC_MAINDATA_QUEUEING] = QBtSession::instance()->isQueueingEnabled();
serverState[KEY_SYNC_MAINDATA_USE_ALT_SPEED_LIMITS] = Preferences::instance()->isAltBandwidthEnabled();
serverState[KEY_SYNC_MAINDATA_REFRESH_INTERVAL] = Preferences::instance()->getRefreshInterval();
data["server_state"] = serverState;
return json::toJson(generateSyncData(acceptedResponseId, data, lastAcceptedData, lastData));
}
示例6: updateComponentInPrefab
void PrefabSystem::updateComponentInPrefab(const QString& path, const QString& component, const QVariantMap& values, bool updateInstances)
{
EntitySystem* es = entityManager()->system(component);
Q_ASSERT(es);
auto i = _prefabs.find(path);
if(i == _prefabs.end())
{
return;
}
Prefab* prefab = i.value().data();
QVariantMap current = prefab->components()[component].toMap();
for(QString param : values.keys())
{
current[param] = values[param];
}
for(QString param : prefab->parameters())
{
current.remove(param);
}
prefab->_components[component] = current;
if(updateInstances)
{
for(auto k = this->begin(); k != this->end(); ++k)
{
if(es->component(k->first))
{
es->fromVariantMap(k->first, values);
}
}
}
}
示例7: accept
void EditAccountDialog::accept()
{
if (!d->widget) {
kWarning() << "missing d->widget, not saving parameters";
return;
}
QVariantMap setParameters = d->widget->parametersSet();
QStringList unsetParameters = d->widget->parametersUnset();
// Check all pages of parameters pass validation.
if (!d->widget->validateParameterValues()) {
kDebug() << "A widget failed parameter validation. Not accepting wizard.";
return;
}
//remove password from setParameters as this is now stored by kwallet instead
setParameters.remove(QLatin1String("password"));
unsetParameters.append(QLatin1String("password")); //remove the password from mission control
Tp::PendingStringList *psl = d->account->updateParameters(setParameters, unsetParameters);
kDebug() << "Set parameters:" << setParameters;
kDebug() << "Unset parameters:" << unsetParameters;
connect(psl,
SIGNAL(finished(Tp::PendingOperation*)),
SLOT(onParametersUpdated(Tp::PendingOperation*)));
}
示例8: CheckSave
bool BookmarksManagerDialog::CheckSave (const QModelIndex& index)
{
if (!index.isValid ())
return false;
if (!CurrentEditor_)
return false;
QStandardItem *item = BMModel_->itemFromIndex (index);
if (!item)
return false;
QVariantMap oldMap = item->data ().toMap ();
const QVariantMap& ourMap = CurrentEditor_->GetIdentifyingData ();
if (!ourMap.contains ("AccountID"))
oldMap.remove ("AccountID");
if (oldMap == ourMap)
return false;
if (QMessageBox::question (this,
tr ("Save the bookmark?"),
tr ("You've changed the bookmark. Do you want to save the changes?"),
QMessageBox::Yes | QMessageBox::No) != QMessageBox::Yes)
return false;
item->setData (ourMap);
Save ();
return true;
}
示例9: getSyncMainData
/**
* The function returns the changed data from the server to synchronize with the web client.
* Return value is map in JSON format.
* Map contain the key:
* - "Rid": ID response
* Map can contain the keys:
* - "full_update": full data update flag
* - "torrents": dictionary contains information about torrents.
* - "torrents_removed": a list of hashes of removed torrents
* - "categories": list of categories
* - "categories_removed": list of removed categories
* - "server_state": map contains information about the state of the server
* The keys of the 'torrents' dictionary are hashes of torrents.
* Each value of the 'torrents' dictionary contains map. The map can contain following keys:
* - "name": Torrent name
* - "size": Torrent size
* - "progress: Torrent progress
* - "dlspeed": Torrent download speed
* - "upspeed": Torrent upload speed
* - "priority": Torrent priority (-1 if queuing is disabled)
* - "num_seeds": Torrent seeds connected to
* - "num_complete": Torrent seeds in the swarm
* - "num_leechs": Torrent leechers connected to
* - "num_incomplete": Torrent leechers in the swarm
* - "ratio": Torrent share ratio
* - "eta": Torrent ETA
* - "state": Torrent state
* - "seq_dl": Torrent sequential download state
* - "f_l_piece_prio": Torrent first last piece priority state
* Server state map may contain the following keys:
* - "connection_status": connection status
* - "dht_nodes": DHT nodes count
* - "dl_info_data": bytes downloaded
* - "dl_info_speed": download speed
* - "dl_rate_limit: download rate limit
* - "up_info_data: bytes uploaded
* - "up_info_speed: upload speed
* - "up_rate_limit: upload speed limit
* - "queueing": priority system usage flag
* - "refresh_interval": torrents table refresh interval
*/
QByteArray btjson::getSyncMainData(int acceptedResponseId, QVariantMap &lastData, QVariantMap &lastAcceptedData)
{
QVariantMap data;
QVariantHash torrents;
BitTorrent::Session *const session = BitTorrent::Session::instance();
foreach (BitTorrent::TorrentHandle *const torrent, session->torrents()) {
QVariantMap map = toMap(torrent);
map.remove(KEY_TORRENT_HASH);
torrents[torrent->hash()] = map;
}
data["torrents"] = torrents;
QVariantList categories;
foreach (const QString &category, session->categories())
categories << category;
data["categories"] = categories;
QVariantMap serverState = getTranserInfoMap();
serverState[KEY_SYNC_MAINDATA_QUEUEING] = session->isQueueingSystemEnabled();
serverState[KEY_SYNC_MAINDATA_USE_ALT_SPEED_LIMITS] = session->isAltGlobalSpeedLimitEnabled();
serverState[KEY_SYNC_MAINDATA_REFRESH_INTERVAL] = session->refreshInterval();
data["server_state"] = serverState;
return json::toJson(generateSyncData(acceptedResponseId, data, lastAcceptedData, lastData));
}
示例10: QDBusAbstractAdaptor
// DeviceInterface
DeviceInterface::DeviceInterface(const QDBusObjectPath &path, const QVariantMap &properties, QObject *parent)
: QDBusAbstractAdaptor(parent)
, m_mediaPlayer(0)
{
setPath(path);
setObjectParent(parent);
setProperties(properties);
setName(QStringLiteral("org.bluez.Device1"));
// Alias needs special handling
setAlias(properties.value(QStringLiteral("Alias")).toString());
// Create Input1
if (properties.contains(QStringLiteral("Input"))) {
const QVariantMap &inputProps = qdbus_cast<QVariantMap>(properties.value(QStringLiteral("Input")));
InputInterface *input = new InputInterface(path, inputProps, parent);
ObjectManager *manager = ObjectManager::self();
manager->addObject(input);
QVariantMap props = properties;
props.remove(QStringLiteral("Input"));
setProperties(props);
}
}
示例11: QPoint
void XmlToQtScript::SimplifyMouseMovementsPostProcessor::process(Item* iterator, QList<Item>* in)
{
if(iterator->method == "moveMouse")
{
const QVariant target = iterator->target;
const QString targetClass = iterator->targetClass;
QVariantMap parameters = iterator->parameters.toMap();
const QPoint origin = QPoint(
parameters.value("x").toInt(),
parameters.value("y").toInt()
);
int duration = 0;
while(!in->isEmpty())
{
Item msec;
msec = in->takeFirst(); // msec << pointing at
duration += msec.parameters.toInt();
if(in->isEmpty())
{
*iterator = msec;
break;
}
*iterator = in->takeFirst(); // ? Unknown
if(iterator->method != "moveMouse" || iterator->target != target)
{
in->prepend(*iterator);
*iterator = msec;
break;
}
parameters = iterator->parameters.toMap();
}
const QPoint destination = QPoint(
parameters.value("x").toInt(),
parameters.value("y").toInt()
);
parameters.remove("x");
parameters.remove("y");
parameters.insert("originX", origin.x());
parameters.insert("originY", origin.y());
parameters.insert("destinationX", destination.x());
parameters.insert("destinationY", destination.y());
parameters.insert("duration", duration);
insertItem(
Item(
target,
targetClass,
"moveMouse",
parameters
),
BeforeCurrentItem
);
}
}
示例12: maindataAction
// The function returns the changed data from the server to synchronize with the web client.
// Return value is map in JSON format.
// Map contain the key:
// - "Rid": ID response
// Map can contain the keys:
// - "full_update": full data update flag
// - "torrents": dictionary contains information about torrents.
// - "torrents_removed": a list of hashes of removed torrents
// - "categories": map of categories info
// - "categories_removed": list of removed categories
// - "server_state": map contains information about the state of the server
// The keys of the 'torrents' dictionary are hashes of torrents.
// Each value of the 'torrents' dictionary contains map. The map can contain following keys:
// - "name": Torrent name
// - "size": Torrent size
// - "progress": Torrent progress
// - "dlspeed": Torrent download speed
// - "upspeed": Torrent upload speed
// - "priority": Torrent priority (-1 if queuing is disabled)
// - "num_seeds": Torrent seeds connected to
// - "num_complete": Torrent seeds in the swarm
// - "num_leechs": Torrent leechers connected to
// - "num_incomplete": Torrent leechers in the swarm
// - "ratio": Torrent share ratio
// - "eta": Torrent ETA
// - "state": Torrent state
// - "seq_dl": Torrent sequential download state
// - "f_l_piece_prio": Torrent first last piece priority state
// - "completion_on": Torrent copletion time
// - "tracker": Torrent tracker
// - "dl_limit": Torrent download limit
// - "up_limit": Torrent upload limit
// - "downloaded": Amount of data downloaded
// - "uploaded": Amount of data uploaded
// - "downloaded_session": Amount of data downloaded since program open
// - "uploaded_session": Amount of data uploaded since program open
// - "amount_left": Amount of data left to download
// - "save_path": Torrent save path
// - "completed": Amount of data completed
// - "max_ratio": Upload max share ratio
// - "max_seeding_time": Upload max seeding time
// - "ratio_limit": Upload share ratio limit
// - "seeding_time_limit": Upload seeding time limit
// - "seen_complete": Indicates the time when the torrent was last seen complete/whole
// - "last_activity": Last time when a chunk was downloaded/uploaded
// - "total_size": Size including unwanted data
// Server state map may contain the following keys:
// - "connection_status": connection status
// - "dht_nodes": DHT nodes count
// - "dl_info_data": bytes downloaded
// - "dl_info_speed": download speed
// - "dl_rate_limit: download rate limit
// - "up_info_data: bytes uploaded
// - "up_info_speed: upload speed
// - "up_rate_limit: upload speed limit
// - "queueing": priority system usage flag
// - "refresh_interval": torrents table refresh interval
// - "free_space_on_disk": Free space on the default save path
// GET param:
// - rid (int): last response id
void SyncController::maindataAction()
{
auto lastResponse = sessionManager()->session()->getData(QLatin1String("syncMainDataLastResponse")).toMap();
auto lastAcceptedResponse = sessionManager()->session()->getData(QLatin1String("syncMainDataLastAcceptedResponse")).toMap();
QVariantMap data;
QVariantHash torrents;
BitTorrent::Session *const session = BitTorrent::Session::instance();
for (BitTorrent::TorrentHandle *const torrent : asConst(session->torrents())) {
QVariantMap map = serialize(*torrent);
map.remove(KEY_TORRENT_HASH);
// Calculated last activity time can differ from actual value by up to 10 seconds (this is a libtorrent issue).
// So we don't need unnecessary updates of last activity time in response.
if (lastResponse.contains("torrents") && lastResponse["torrents"].toHash().contains(torrent->hash()) &&
lastResponse["torrents"].toHash()[torrent->hash()].toMap().contains(KEY_TORRENT_LAST_ACTIVITY_TIME)) {
uint lastValue = lastResponse["torrents"].toHash()[torrent->hash()].toMap()[KEY_TORRENT_LAST_ACTIVITY_TIME].toUInt();
if (qAbs(static_cast<int>(lastValue - map[KEY_TORRENT_LAST_ACTIVITY_TIME].toUInt())) < 15)
map[KEY_TORRENT_LAST_ACTIVITY_TIME] = lastValue;
}
torrents[torrent->hash()] = map;
}
data["torrents"] = torrents;
QVariantHash categories;
const auto categoriesList = session->categories();
for (auto it = categoriesList.cbegin(); it != categoriesList.cend(); ++it) {
const auto key = it.key();
categories[key] = QVariantMap {
{"name", key},
{"savePath", it.value()}
};
}
data["categories"] = categories;
//.........这里部分代码省略.........
示例13: SendImportAcc
void PsiPlusImportPage::SendImportAcc (QStandardItem *accItem)
{
Entity e = Util::MakeEntity (QVariant (),
QString (),
FromUserInitiated | OnlyHandle,
"x-leechcraft/im-account-import");
QVariantMap data = accItem->data (Roles::AccountData).toMap ();
data.remove ("Contacts");
e.Additional_ ["AccountData"] = data;
emit gotEntity (e);
}
示例14: ConfigModifyRecursion
bool FreyaPublicRegister::ConfigModifyRecursion(QVariantMap &varMap, const QStringList &configPath, const ConfModType &type, const QVariant &var)
{
if(configPath.size() > 0)
{
const QString &key = configPath.at(0);
if(configPath.size() == 1)
{
switch (type)
{
case eCMADD:
{
varMap.insert(key, var);
return varMap.contains(key);
}
case eCMDEL:
{
varMap.remove(key);
return !varMap.contains(key);
}
case eCMMOD:
{
if(varMap.contains(key))
{
varMap.insert(key, var);
return (varMap.value(key) == var);
}
}
default:
return false;
}
}
else
{
QVariant newVar = varMap.value(key);
if(newVar.type() == QVariant::Map || eCMADD == type)
{
QStringList newConfigPath = configPath;
newConfigPath.removeAt(0);
QVariantMap tempVarMap = newVar.toMap();
if(ConfigModifyRecursion(tempVarMap, newConfigPath, type, var))
{
varMap.insert(key, tempVarMap);
return true;
}
}
}
}
return false;
}
示例15: QApplication
Application::Application(int& argc, char* argv[]) : QApplication(argc, argv)
{
setApplicationName("Communi");
setOrganizationName("Communi");
setApplicationVersion(Irc::version());
setOrganizationDomain("communi.github.com");
*originalPalette() = palette();
QIcon icon;
icon.addFile(":/resources/icons/16x16/communi.png");
icon.addFile(":/resources/icons/24x24/communi.png");
icon.addFile(":/resources/icons/32x32/communi.png");
icon.addFile(":/resources/icons/48x48/communi.png");
icon.addFile(":/resources/icons/64x64/communi.png");
icon.addFile(":/resources/icons/128x128/communi.png");
setWindowIcon(icon);
qRegisterMetaTypeStreamOperators<ConnectionInfo>("ConnectionInfo");
qRegisterMetaTypeStreamOperators<ConnectionInfos>("ConnectionInfos");
QSettings settings;
if (arguments().contains("-reset"))
settings.clear();
if (arguments().contains("-reset-settings"))
settings.remove("settings");
if (arguments().contains("-reset-connections"))
settings.remove("connections");
if (arguments().contains("-reset-state")) {
settings.remove("list");
settings.remove("tree");
settings.remove("splitter");
settings.remove("geometry");
}
bool appliedSettings = false;
if (settings.contains("settings")) {
QVariant value = settings.value("settings");
if (value.canConvert<QVariantMap>()) {
QVariantMap map = value.toMap();
// cleanup obsolete theme bloat
foreach (const QString& key, map.keys()) {
if (key.startsWith("ui.theme") || key.startsWith("themes."))
map.remove(key);
}
applySettings(map);
appliedSettings = true;
Application::settings()->setValues(map);
}