本文整理汇总了C++中QMultiMap类的典型用法代码示例。如果您正苦于以下问题:C++ QMultiMap类的具体用法?C++ QMultiMap怎么用?C++ QMultiMap使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了QMultiMap类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
QMultiMap<int, IOptionsDialogWidget *> ClientInfo::optionsDialogWidgets(const QString &ANodeId, QWidget *AParent)
{
QMultiMap<int, IOptionsDialogWidget *> widgets;
if (FOptionsManager && ANodeId == OPN_COMMON)
{
widgets.insertMulti(OWO_COMMON_SENDCLIENTINFO, FOptionsManager->newOptionsDialogWidget(Options::node(OPV_COMMON_SHAREOSVERSION),tr("Share information about your OS version"),AParent));
}
return widgets;
}
示例2: replyString
QMultiMap<QString, QString> KQOAuthManagerPrivate::createTokensFromResponse(QByteArray reply) {
QMultiMap<QString, QString> result;
QString replyString(reply);
QStringList parameterPairs = replyString.split('&', QString::SkipEmptyParts);
foreach (const QString ¶meterPair, parameterPairs) {
QStringList parameter = parameterPair.split('=');
result.insert(parameter.value(0), parameter.value(1));
}
示例3: remapMaterialKeysToToolKeys
void ToolScript::remapMaterialKeysToToolKeys(QMultiMap<QString,AMFRegion*>* map) const {
QMultiMap<QString,AMFRegion*> remap;
// Scrape all of the regions matching a given material name from the map
foreach (ToolScriptTool* tool, tools_) {
QList<AMFRegion*> regions = map->values(tool->materialName());
foreach (AMFRegion* region, regions) {
remap.insert(tool->name(), region);
}
示例4: while
void Statistics::incrementRankingEntry(QString ranking, QString key){
if(!this->_rankings.contains(ranking)){
this->_rankings.insert(ranking, new QMultiMap<quint64, QString>());
this->_rankingsCounter.insert(ranking,0);
}
//"Reinigen"?
if(this->_rankingsCounter[ranking] > 1000){
for(int i = 0; i < 900;++i){
QMultiMap<quint64, QString>::const_iterator beg = this->_rankings.value(ranking)->begin();
this->_rankings.value(ranking)->remove(beg.key(), beg.value());
}
this->_rankingsCounter[ranking] = 100;
//Durchgehen und den Wert auf 25% senken
QMultiMap<quint64, QString>::const_iterator i = this->_rankings.value(ranking)->begin();
QMultiMap<quint64, QString>::const_iterator end = this->_rankings.value(ranking)->end();
QMultiMap<quint64, QString> *tmpMap = new QMultiMap<quint64, QString>();
while(i != end){
tmpMap->insertMulti(i.key()*0.25, i.value());
i++;
}
//Alte Map löschen
delete this->_rankings.value(ranking);
//Neue einsetzen
this->_rankings[ranking] = tmpMap;
}
//Werte durchgehen
QMultiMap<quint64, QString>::const_iterator it = this->_rankings.value(ranking)->begin();
QMultiMap<quint64, QString>::const_iterator end = this->_rankings.value(ranking)->end();
while(it != end){
//Schlüssel gefunden?
if(it.value() == key){
//Wert zwischenspeichern
uint val = it.key();
//Alten Wert entfernen
this->_rankings.value(ranking)->remove(it.key(), it.value());
//Neu einschreiben
this->_rankings.value(ranking)->insertMulti(val+1, key);
return;
}
it++;
}
//Counter erhöhen
this->_rankingsCounter[ranking]++;
//Einfügen
this->_rankings.value(ranking)->insertMulti(1, key);
}
示例5: getBackwardKeys
QMultiMap<int, QString> getBackwardKeys()
{
QMultiMap<int, QString> result;
for (QHash<QString, int>::const_iterator it = _keys.begin(); it != _keys.end(); ++it)
{
result.insertMulti(it.value(), it.key());
}
return result;
}
示例6: MessengerOptions
QMultiMap<int, IOptionsWidget *> MessageWidgets::optionsWidgets(const QString &ANodeId, QWidget *AParent)
{
QMultiMap<int, IOptionsWidget *> widgets;
if (FOptionsManager && ANodeId == OPN_MESSAGES)
{
widgets.insertMulti(OWO_MESSAGES, FOptionsManager->optionsHeaderWidget(QString::null,tr("Select the method of sending messages"),AParent));
widgets.insertMulti(OWO_MESSAGES, new MessengerOptions(AParent));
}
return widgets;
}
示例7: ShortcutOptionsWidget
QMultiMap<int, IOptionsDialogWidget *> ShortcutManager::optionsDialogWidgets(const QString &ANodeId, QWidget *AParent)
{
QMultiMap<int, IOptionsDialogWidget *> widgets;
if (ANodeId == OPN_SHORTCUTS)
{
widgets.insertMulti(OHO_SHORTCUTS, FOptionsManager->newOptionsDialogHeader(tr("Shortcuts"),AParent));
widgets.insertMulti(OWO_SHORTCUTS, new ShortcutOptionsWidget(AParent));
}
return widgets;
}
示例8:
QMultiMap<int, IOptionsDialogWidget *> RosterItemExchange::optionsDialogWidgets(const QString &ANodeId, QWidget *AParent)
{
QMultiMap<int, IOptionsDialogWidget *> widgets;
if (ANodeId == OPN_ROSTERVIEW)
{
widgets.insertMulti(OHO_ROSTER_MANAGEMENT,FOptionsManager->newOptionsDialogHeader(tr("Contacts list management"),AParent));
widgets.insertMulti(OWO_ROSTER_EXCHANGEAUTO,FOptionsManager->newOptionsDialogWidget(Options::node(OPV_ROSTER_EXCHANGE_AUTOAPPROVEENABLED),tr("Allow gateways and group services manage your contacts list"),AParent));
}
return widgets;
}
示例9: removeAllButThese
/**
* Removes all but the given properties from the combined properties
* collected so far.
*/
void RPropertyEditor::removeAllButThese(
const QMultiMap<QString, QString>& propertyTitles, bool customOnly) {
// iterate through all groups of properties (e.g. "Start Point", "End Point", ...):
QStringList removableGroups;
RPropertyGroupMap::iterator it;
for (it = combinedProperties.begin(); it != combinedProperties.end(); ++it) {
// iterate through all properties in the current group (e.g. "X", "Y"):
QStringList removableProperties;
RPropertyMap::iterator it2;
for (it2 = it.value().begin(); it2 != it.value().end(); ++it2) {
if (customOnly && !it2.value().second.getPropertyTypeId().isCustom()) {
continue;
}
bool keep = false;
// check if the current property is among the given properties
// we want to keep:
QMultiMap<QString, QString>::const_iterator it3;
for (it3 = propertyTitles.begin(); it3 != propertyTitles.end(); ++it3) {
if (it3.key() == it.key() && it3.value() == it2.key()) {
keep = true;
break;
}
}
if (keep == false) {
// schedule property for removal:
removableProperties.push_back(it2.key());
}
}
// remove all properties in the current group that are scheduled for removal:
QStringList::iterator it4;
for (it4 = removableProperties.begin(); it4
!= removableProperties.end(); ++it4) {
it.value().remove(*it4);
propertyOrder[it.key()].removeAll(*it4);
}
// schedule empty groups for removal:
if (it.value().empty()) {
removableGroups.push_back(it.key());
}
}
// remove all groups that are scheduled for removal:
QStringList::iterator it5;
for (it5 = removableGroups.begin(); it5 != removableGroups.end(); ++it5) {
combinedProperties.remove(*it5);
groupOrder.removeAll(*it5);
}
}
示例10: foreach
void QgsSelectedFeature::moveSelectedVertexes( const QgsVector &v )
{
int nUpdates = 0;
foreach ( QgsVertexEntry *entry, mVertexMap )
{
if ( entry->isSelected() )
nUpdates++;
}
if ( nUpdates == 0 )
return;
mVlayer->beginEditCommand( QObject::tr( "Moved vertices" ) );
int topologicalEditing = QgsProject::instance()->readNumEntry( "Digitizing", "/TopologicalEditing", 0 );
beginGeometryChange();
QMultiMap<double, QgsSnappingResult> currentResultList;
for ( int i = mVertexMap.size() - 1; i > -1 && nUpdates > 0; i-- )
{
QgsVertexEntry *entry = mVertexMap.value( i, 0 );
if ( !entry || !entry->isSelected() )
continue;
if ( topologicalEditing )
{
// snap from current vertex
currentResultList.clear();
mVlayer->snapWithContext( entry->point(), ZERO_TOLERANCE, currentResultList, QgsSnapper::SnapToVertex );
}
// only last update should trigger the geometry update
// as vertex selection gets lost on the update
if ( --nUpdates == 0 )
endGeometryChange();
QgsPoint p = entry->point() + v;
mVlayer->moveVertex( p.x(), p.y(), mFeatureId, i );
if ( topologicalEditing )
{
QMultiMap<double, QgsSnappingResult>::iterator resultIt = currentResultList.begin();
for ( ; resultIt != currentResultList.end(); ++resultIt )
{
// move all other
if ( mFeatureId != resultIt.value().snappedAtGeometry )
mVlayer->moveVertex( p.x(), p.y(),
resultIt.value().snappedAtGeometry, resultIt.value().snappedVertexNr );
}
}
}
mVlayer->endEditCommand();
}
示例11: reloadPlugins
void Device::reloadPlugins()
{
QHash<QString, KdeConnectPlugin*> newPluginMap;
QMultiMap<QString, KdeConnectPlugin*> newPluginsByIncomingInterface;
QMultiMap<QString, KdeConnectPlugin*> newPluginsByOutgoingInterface;
if (isPaired() && isReachable()) { //Do not load any plugin for unpaired devices, nor useless loading them for unreachable devices
KConfigGroup pluginStates = KSharedConfig::openConfig(pluginsConfigFile())->group("Plugins");
PluginLoader* loader = PluginLoader::instance();
//Code borrowed from KWin
foreach (const QString& pluginName, loader->getPluginList()) {
QString enabledKey = pluginName + QString::fromLatin1("Enabled");
bool isPluginEnabled = (pluginStates.hasKey(enabledKey) ? pluginStates.readEntry(enabledKey, false)
: loader->getPluginInfo(pluginName).isEnabledByDefault());
if (isPluginEnabled) {
KdeConnectPlugin* plugin = m_plugins.take(pluginName);
QStringList incomingInterfaces, outgoingInterfaces;
if (plugin) {
incomingInterfaces = m_pluginsByIncomingInterface.keys(plugin);
outgoingInterfaces = m_pluginsByOutgoingInterface.keys(plugin);
} else {
const KPluginMetaData service = loader->getPluginInfo(pluginName);
incomingInterfaces = KPluginMetaData::readStringList(service.rawData(), "X-KdeConnect-SupportedPackageType");
outgoingInterfaces = KPluginMetaData::readStringList(service.rawData(), "X-KdeConnect-OutgoingPackageType");
}
//If we don't find intersection with the received on one end and the sent on the other, we don't
//let the plugin stay
//Also, if no capabilities are specified on the other end, we don't apply this optimizaton, as
//we assume that the other client doesn't know about capabilities.
if (!m_incomingCapabilities.isEmpty() && !m_outgoingCapabilities.isEmpty()
&& (m_incomingCapabilities & outgoingInterfaces.toSet()).isEmpty()
&& (m_outgoingCapabilities & incomingInterfaces.toSet()).isEmpty()
) {
delete plugin;
continue;
}
if (!plugin) {
plugin = loader->instantiatePluginForDevice(pluginName, this);
}
foreach(const QString& interface, incomingInterfaces) {
newPluginsByIncomingInterface.insert(interface, plugin);
}
foreach(const QString& interface, outgoingInterfaces) {
newPluginsByOutgoingInterface.insert(interface, plugin);
}
newPluginMap[pluginName] = plugin;
}
示例12: setEnabled
void VarManager::search()
{
setEnabled(false);
QMultiMap<int, QString> vars = fieldArchive->searchAllVars();
quint32 key;
qint32 param;
QTreeWidgetItem *item;
QMap<int, bool> count;
int lastVar=-1;
QMapIterator<int, QString> i(vars);
while(i.hasNext()) {
i.next();
if(lastVar == i.key()) continue;
lastVar = i.key();
JsmOpcode op(lastVar);
key = op.key();
param = op.param();
count.insert(param, true);
item = list->topLevelItem(param);
item->setBackground(0, QColor(0xff,0xe5,0x99));
if(key == 10 || key == 11 || key == 16) {
item->setText(1, QString("%1Byte").arg(key == 16 ? "Signed " : ""));
}
else if(key == 12 || key == 13 || key == 17) {
item->setText(1, QString("%1Word").arg(key == 17 ? "Signed " : ""));
count.insert(param+1, true);
list->topLevelItem(param+1)->setBackground(0, QColor(0xff,0xe5,0x99));
}
else if(key == 14 || key == 15 || key == 18) {
item->setText(1, QString("%1Long").arg(key == 18 ? "Signed " : ""));
count.insert(param+1, true);
list->topLevelItem(param+1)->setBackground(0, QColor(0xff,0xe5,0x99));
count.insert(param+2, true);
list->topLevelItem(param+2)->setBackground(0, QColor(0xff,0xe5,0x99));
count.insert(param+3, true);
list->topLevelItem(param+3)->setBackground(0, QColor(0xff,0xe5,0x99));
}
QStringList fields(vars.values(lastVar));
fields.append(item->text(3).split(", ", QString::SkipEmptyParts));
fields.removeDuplicates();
item->setText(3, fields.join(", "));
}
list->resizeColumnToContents(0);
list->resizeColumnToContents(1);
setEnabled(true);
countLabel->setText(tr("Vars utilisés : %1/1536").arg(count.size()));
}
示例13:
QMultiMap<QString, ProjectConverter> ToolPluginManager::projectConverters() const
{
QMultiMap<QString, ProjectConverter> result;
for (ToolPluginInterface * const toolPlugin : mPlugins) {
for (ProjectConverter const &converter : toolPlugin->projectConverters()) {
result.insertMulti(converter.editor(), converter);
}
}
return result;
}
示例14: loader
/*!
\internal
Returns a lazily-initialized singleton. Ownership is granted to the
QPlatformPrinterSupportPlugin, which is never unloaded or destroyed until
application exit, i.e. you can expect this pointer to always be valid and
multiple calls to this function will always return the same pointer.
*/
QPlatformPrinterSupport *QPlatformPrinterSupportPlugin::get()
{
if (!printerSupport) {
const QMultiMap<int, QString> keyMap = loader()->keyMap();
if (!keyMap.isEmpty())
printerSupport = qLoadPlugin<QPlatformPrinterSupport, QPlatformPrinterSupportPlugin>(loader(), keyMap.constBegin().value());
if (printerSupport)
qAddPostRoutine(cleanupPrinterSupport);
}
return printerSupport;
}
示例15: ranking
QStringList Statistics::ranking(QString key){
QMultiMap<quint64, QString> *map = this->_rankings.value(key);
QStringList rankedList;
QList<quint64> keys = map->keys();
for(int i = keys.length()-1; i >= 0;--i){
rankedList.append(map->value(keys.at(i)));
}
return rankedList;
}