当前位置: 首页>>代码示例>>C++>>正文


C++ QMap::insertMulti方法代码示例

本文整理汇总了C++中QMap::insertMulti方法的典型用法代码示例。如果您正苦于以下问题:C++ QMap::insertMulti方法的具体用法?C++ QMap::insertMulti怎么用?C++ QMap::insertMulti使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在QMap的用法示例。


在下文中一共展示了QMap::insertMulti方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: testUnitymedia

void TestEITFixups::testUnitymedia()
{
    EITFixUp fixup;

    DBEventEIT *event = SimpleDBEventEIT (EITFixUp::kFixUnitymedia,
                                         "Titel",
                                         "Beschreib",
                                         "Beschreibung ... IMDb Rating: 8.9 /10");
    QMap<QString,QString> cast;
    cast.insertMulti ("Role Player", "Great Actor");
    cast.insertMulti ("Role Player", "Other Actor");
    cast.insertMulti ("Director", "Great Director");
    cast.insertMulti ("Unhandled", "lets fix it up");
    event->items = cast;

    QVERIFY(!event->HasCredits());
    QCOMPARE(event->items.count(), 4);

    PRINT_EVENT(*event);
    fixup.Fix(*event);
    PRINT_EVENT(*event);

    QVERIFY(event->HasCredits());
    QCOMPARE(event->credits->size(), (size_t)3);
    QVERIFY(event->subtitle.isEmpty());
    QCOMPARE(event->description, QString("Beschreibung ..."));
    QCOMPARE(event->stars, 0.89f);
    QCOMPARE(event->items.count(), 1);
    delete event;
}
开发者ID:getgnu,项目名称:mythtv,代码行数:30,代码来源:test_eitfixups.cpp

示例2: RemoveBuildToBeUpdated

void xmlWriter::RemoveBuildToBeUpdated(int buildID){

    QMap <QString,QString> tmpID;
    QMap <QString,QString> tmpName;
    QMap <QString,QString> tmpDesc;
    QMap <QString,QString> tmpDir;

    QMapIterator<QString, QString> i(buildUniqueID);
    QMapIterator<QString, QString> j(buildName);
    QMapIterator<QString, QString> k(buildDescription);
    QMapIterator<QString, QString> l(buildDirectory);

    int m = 0;

    while (i.hasNext() && j.hasNext() && k.hasNext() && l.hasNext())
    {
        i.next(); j.next(); k.next(); l.next();

        if(buildUniqueID.values().at(m).compare(QString::number(buildID))){
            tmpID.insertMulti("buildUniqueID",buildUniqueID.values().at(m));
            tmpName.insertMulti("buildName",buildName.values().at(m));
            tmpDesc.insertMulti("buildDescription",buildDescription.values().at(m));
            tmpDir.insertMulti("buildDirectory",buildDirectory.values().at(m));
        }
        m++;
    }
    buildUniqueID = tmpID;
    buildName = tmpName;
    buildDescription = tmpDesc;
    buildDirectory = tmpDir;
}
开发者ID:hhvvkk,项目名称:COS301DistrobutedApplicationManger,代码行数:31,代码来源:xmlWriter.cpp

示例3: removeBuild

void xmlWriter::removeBuild(int buildID){
    QMap <QString,QString> tmpID;
    QMap <QString,QString> tmpName;
    QMap <QString,QString> tmpDesc;
    QMap <QString,QString> tmpDir;

    QMapIterator<QString, QString> i(buildUniqueID);
    QMapIterator<QString, QString> j(buildName);
    QMapIterator<QString, QString> k(buildDescription);
    QMapIterator<QString, QString> l(buildDirectory);

    int m = 0;

    while (i.hasNext() && j.hasNext() && k.hasNext() && l.hasNext())
    {
        i.next(); j.next(); k.next(); l.next();

        if(buildUniqueID.values().at(m).compare(QString::number(buildID))){
            //if the build is not the same include the build
            tmpID.insertMulti("buildUniqueID",buildUniqueID.values().at(m));
            tmpName.insertMulti("buildName",buildName.values().at(m));
            tmpDesc.insertMulti("buildDescription",buildDescription.values().at(m));
            tmpDir.insertMulti("buildDirectory",buildDirectory.values().at(m));
        }
        m++;
    }

    //replace the current values
    buildUniqueID = tmpID;
    buildName = tmpName;
    buildDescription = tmpDesc;
    buildDirectory = tmpDir;

    createXMLFile();
}
开发者ID:hhvvkk,项目名称:COS301DistrobutedApplicationManger,代码行数:35,代码来源:xmlWriter.cpp

示例4: linksForKeyword

void QHelpDBReader::linksForKeyword(const QString &keyword, const QStringList &filterAttributes,
                                    QMap<QString, QUrl> &linkMap) const
{
    if (!m_query)
        return;

    QString query;
    if (filterAttributes.isEmpty()) {
        query = QString(QLatin1String("SELECT d.Title, f.Name, e.Name, d.Name, a.Anchor "
            "FROM IndexTable a, FileNameTable d, "
            "FolderTable e, NamespaceTable f WHERE "
            "a.FileId=d.FileId AND d.FolderId=e.Id AND a.NamespaceId=f.Id "
            "AND a.Name='%1'")).arg(quote(keyword));
    } else if (m_useAttributesCache) {
        query = QString(QLatin1String("SELECT d.Title, f.Name, e.Name, d.Name, a.Anchor, a.Id "
            "FROM IndexTable a, "
            "FileNameTable d, FolderTable e, NamespaceTable f WHERE "
            "a.FileId=d.FileId AND d.FolderId=e.Id "
            "AND a.NamespaceId=f.Id AND a.Name='%1'"))
            .arg(quote(keyword));
        m_query->exec(query);
        while (m_query->next()) {
            if (m_indicesCache.contains(m_query->value(5).toInt())) {
                linkMap.insertMulti(m_query->value(0).toString(), buildQUrl(m_query->value(1).toString(),
                    m_query->value(2).toString(), m_query->value(3).toString(),
                    m_query->value(4).toString()));
            }
        }
        return;
    } else {
        query = QString(QLatin1String("SELECT d.Title, f.Name, e.Name, d.Name, a.Anchor "
            "FROM IndexTable a, IndexFilterTable b, FilterAttributeTable c, "
            "FileNameTable d, FolderTable e, NamespaceTable f "
            "WHERE a.FileId=d.FileId AND d.FolderId=e.Id "
            "AND a.NamespaceId=f.Id AND b.IndexId=a.Id AND b.FilterAttributeId=c.Id "
            "AND a.Name='%1' AND c.Name='%2'")).arg(quote(keyword))
            .arg(quote(filterAttributes.first()));
        for (int i=1; i<filterAttributes.count(); ++i) {
            query.append(QString(QLatin1String(" INTERSECT SELECT d.Title, f.Name, e.Name, d.Name, a.Anchor "
                "FROM IndexTable a, IndexFilterTable b, FilterAttributeTable c, "
                "FileNameTable d, FolderTable e, NamespaceTable f "
                "WHERE a.FileId=d.FileId AND d.FolderId=e.Id "
                "AND a.NamespaceId=f.Id AND b.IndexId=a.Id AND b.FilterAttributeId=c.Id "
                "AND a.Name='%1' AND c.Name='%2'")).arg(quote(keyword))
                .arg(quote(filterAttributes.at(i))));
        }
    }

    QString title;
    m_query->exec(query);
    while (m_query->next()) {
        title = m_query->value(0).toString();
        if (title.isEmpty()) // generate a title + corresponding path
            title = keyword + QLatin1String(" : ") + m_query->value(3).toString();
        linkMap.insertMulti(title, buildQUrl(m_query->value(1).toString(),
            m_query->value(2).toString(), m_query->value(3).toString(),
            m_query->value(4).toString()));
    }
}
开发者ID:xjohncz,项目名称:qt5,代码行数:59,代码来源:qhelpdbreader.cpp

示例5: evaluateBaseContent

void DNASequenceGenerator::evaluateBaseContent(const MultipleSequenceAlignment& ma, QMap<char, qreal>& result) {
    QList< QMap<char, qreal> > rowsContents;
    foreach(const MultipleSequenceAlignmentRow& row, ma->getMsaRows()) {
        QMap<char, qreal> rowContent;
        evaluate(row->getData(), rowContent);
        rowsContents.append(rowContent);
    }

    QListIterator< QMap<char, qreal> > listIter(rowsContents);
    while (listIter.hasNext()) {
        const QMap<char, qreal>& cm = listIter.next();
        QMapIterator<char, qreal> mapIter(cm);
        while (mapIter.hasNext()) {
            mapIter.next();
            char ch = mapIter.key();
            qreal freq = mapIter.value();
            if (!result.keys().contains(ch)) {
                result.insertMulti(ch, freq);
            } else {
                result[ch] += freq;
            }
        }
    }

    int rowsNum = ma->getNumRows();
    QMutableMapIterator<char, qreal> i(result);
    while (i.hasNext()) {
        i.next();
        i.value() /= rowsNum;
    }
}
开发者ID:ugeneunipro,项目名称:ugene,代码行数:31,代码来源:DNASequenceGenerator.cpp

示例6: neuron_branch_tip_count

void neuron_branch_tip_count(V3DLONG &n_branch, V3DLONG &n_tip, const vector<V_NeuronSWC> & segment_list)
{
	QMap <V_NeuronSWC_coord, V_NeuronSWC_unit> map;
	map.clear();

	for (V3DLONG i=0; i<segment_list.size(); i++)
	{
		const V_NeuronSWC & seg = segment_list.at(i);
		for (V3DLONG j=0; j<seg.row.size(); j++)
		{
			V_NeuronSWC_unit node = seg.row.at(j);
			V_NeuronSWC_coord key = node;
			map.insertMulti(key, node);
		}
	}

	n_branch = 0;
	n_tip = 2*segment_list.size();

	QList <V_NeuronSWC_coord> keys = map.uniqueKeys();
	for (V3DLONG i=0; i<keys.size(); i++)
	{
		V_NeuronSWC_coord key = keys.at(i);
		int nkey = map.count(key);
		if (nkey >= 3)
		{
			n_branch ++;
		}
		if (nkey >= 2)
		{
			n_tip -= nkey;
		}
	}
}
开发者ID:lsqshr,项目名称:v3d_external,代码行数:34,代码来源:neuron_sim_scores.cpp

示例7: cleaner

// This should go into Qt 4.8 once we start using it for Qt Creator
QMap<QString, QUrl> HelpManager::linksForKeyword(const QString &key)
{
    QMap<QString, QUrl> links;
    if (d->m_needsSetup)
        return links;

    const QLatin1String sqlite("QSQLITE");
    const QLatin1String name("HelpManager::linksForKeyword");

    DbCleaner cleaner(name);
    QSqlDatabase db = QSqlDatabase::addDatabase(sqlite, name);
    if (db.driver() && db.driver()->lastError().type() == QSqlError::NoError) {
        const QStringList &registeredDocs = d->m_helpEngine->registeredDocumentations();
        foreach (const QString &nameSpace, registeredDocs) {
            db.setDatabaseName(d->m_helpEngine->documentationFileName(nameSpace));
            if (db.open()) {
                QSqlQuery query = QSqlQuery(db);
                query.setForwardOnly(true);
                query.exec(QString::fromLatin1(linksForKeyQuery).arg(key));
                while (query.next()) {
                    QString title = query.value(0).toString();
                    if (title.isEmpty()) // generate a title + corresponding path
                        title = key + QLatin1String(" : ") + query.value(3).toString();
                    links.insertMulti(title, buildQUrl(query.value(1).toString(),
                                                       query.value(2).toString(), query.value(3).toString(),
                                                       query.value(4).toString()));
                }
            }
        }
    }
开发者ID:hermixy,项目名称:qtplatz,代码行数:31,代码来源:helpmanager.cpp

示例8: foreach

  foreach ( QString key, providersList )
  {
    QLibrary *library = QgsProviderRegistry::instance()->providerLibrary( key );
    if ( !library )
      continue;

    dataCapabilities_t * dataCapabilities = ( dataCapabilities_t * ) cast_to_fptr( library->resolve( "dataCapabilities" ) );
    if ( !dataCapabilities )
    {
      QgsDebugMsg( library->fileName() + " does not have dataCapabilities" );
      continue;
    }

    int capabilities = dataCapabilities();
    if ( capabilities == QgsDataProvider::NoDataCapabilities )
    {
      QgsDebugMsg( library->fileName() + " does not have any dataCapabilities" );
      continue;
    }

    dataItem_t *dataItem = ( dataItem_t * ) cast_to_fptr( library->resolve( "dataItem" ) );
    if ( !dataItem )
    {
      QgsDebugMsg( library->fileName() + " does not have dataItem" );
      continue;
    }

    QgsDataItem *item = dataItem( "", NULL );  // empty path -> top level
    if ( item )
    {
      QgsDebugMsg( "Add new top level item : " + item->name() );
      connectItem( item );
      providerMap.insertMulti( capabilities, item );
    }
  }
开发者ID:Ariki,项目名称:QGIS,代码行数:35,代码来源:qgsbrowsermodel.cpp

示例9: getTilesInView

void MapView::getTilesInView()
{
    if (MapSource.id == None) return;

    QRectF viewRect = mapToScene(0,0,width(),height()).boundingRect();
    QList<QPoint> XYTileList = getXYTileInRange(currentZoom,
                                                getLongFromMercatorX(viewRect.x()+viewRect.width()),
                                                getLongFromMercatorX(viewRect.x()),
                                                getLatFromMercatorY(viewRect.y()),
                                                getLatFromMercatorY(viewRect.y()+viewRect.height()) );
    QPoint p1 = XYTileList.first();
    QPoint p2 = XYTileList.last();
    QPointF center = QPointF( (p2.x()+p1.x()) / 2. , (p1.y()+p2.y()) / 2. );

    //sorts list so that points closest to center are loaded first
    QMap<qreal, QPoint> map;
    for(int i=0;i<XYTileList.size();++i) map.insertMulti(lengthSquared((XYTileList.at(i))-center),XYTileList.at(i));

    XYTileList = map.values();

    QPoint p;
    while(XYTileList.size()>0)
    {
        if (currentRequests.count()<requestLimit) p = XYTileList.takeFirst();
        else p = XYTileList.takeLast();

        if (!tilePlaced(p,currentZoom)) getTile(p.x(),p.y(),currentZoom);
    }

    qDebug("Number of items in scene: "+QString::number(scene()->items().count()));
}
开发者ID:mueslo,项目名称:TEA,代码行数:31,代码来源:mapview.cpp

示例10: arrangeLinearPorts

void PortHandler::arrangeLinearPorts()
{
	for (int linePortId = mPointPorts.size(); linePortId < mPointPorts.size() + mLinePorts.size(); linePortId++) {
		QMap<EdgeArrangeCriteria, EdgeElement*> sortedEdges;
		const QLineF portLine = mLinePorts.at(linePortId)->transformForContents(mNode->contentsRect());
		for (EdgeElement* edge : mNode->edgeList()) {
			QPair<qreal, qreal> edgePortId = edge->portIdOn(mNode);
			qreal currentPortId = -1.0;
			if (portNumber(edgePortId.first) == linePortId) {
				currentPortId = edgePortId.first;
			}
			if (portNumber(edgePortId.second) == linePortId) {
				currentPortId = edgePortId.second;
			}

			if (currentPortId != -1.0) {
				const EdgeArrangeCriteria arrangeCriteria = edge->arrangeCriteria(mNode, portLine);
				sortedEdges.insertMulti(arrangeCriteria, edge);
			}
		}

		const int n = sortedEdges.size();
		int i = 0;
		for (EdgeElement * const edge : sortedEdges) {
			const qreal newId = linePortId + (i + 1.0) / (n + 1);
			edge->moveConnection(mNode, newId);
			i++;
		}
	}
}
开发者ID:Antropovi,项目名称:qreal,代码行数:30,代码来源:portHandler.cpp

示例11: foreach

QMap<QString, int> SCPageEffectFactory::subTypesByName() const
{
    QMap<QString, int> nameToType;
    foreach (const int subType, d->subTypes) {
        nameToType.insertMulti(subTypeName(subType), subType);
    }
    return nameToType;
}
开发者ID:KDE,项目名称:koffice,代码行数:8,代码来源:SCPageEffectFactory.cpp

示例12:

QMap<QString, QString> PropertyDialog::getNewMetaMap()
{
	QMap<QString, QString> metaMap;
	
	for (int i=0;i<labelList.size();i++) metaMap.insertMulti(labelList.at(i)->text(),editList.at(i)->text());
	
	return metaMap;
}
开发者ID:Domlol,项目名称:texomaker,代码行数:8,代码来源:propertydialog.cpp

示例13: HandleQueryCompletedL

void MsgAudioSelectionEngine::HandleQueryCompletedL(CMdEQuery& aQuery,
        TInt aError)
    {
    iNameList.clear();
    iUriList.clear();
    if (aError == KErrCancel)
        {
        emit queryError(aError);
        return;
        }
    else
        {
        QMap<QString,QString> nameUriList;
        CMdEObjectQuery* query = static_cast<CMdEObjectQuery*> (&aQuery);
        TInt count = query->Count();
        for (TInt i = 0; i < count; ++i)
            {
            CMdEObject* object =
                    (CMdEObject*) query->TakeOwnershipOfResult(i);
            CleanupStack::PushL(object);
            CMdEPropertyDef& propDef = MsgAudioSelectionEngine::PropertyDefL(
                    iSession, MsgAudioSelectionEngine::EAttrFileName);

            CMdEProperty* property = 0;
            TInt err = object->Property(propDef, property, 0);
            if (err != KErrNotFound && property)
                {
                QString songName(XQConversions::s60DescToQString(
                        property->TextValueL()));
                QString uriValue(XQConversions::s60DescToQString(
                        object->Uri()));
                
                //insert into the map
                nameUriList.insertMulti(uriValue, songName);
                }
            CleanupStack::PopAndDestroy(object);
            }
        
        //now get all the song names and sort them
        iNameList = nameUriList.values();
        iNameList.sort();
        
        // go through the song list and get the associated uri
        // insert into the uri list
        int nameListTotal = iNameList.count();
        for(int nameListCount = 0; 
                nameListCount<nameListTotal;
                nameListCount++)
            {
            QString key = nameUriList.key(iNameList.at(nameListCount));
            iUriList.append(key);
            nameUriList.remove(key);                        
            }
        
        // emit the list to the model
        emit queryComplete(iNameList, iUriList);
        }
    }
开发者ID:cdaffara,项目名称:symbiandump-ossapps,代码行数:58,代码来源:msgaudioselectionengine.cpp

示例14: AddFocusableChildrenToList

void MythUIType::AddFocusableChildrenToList(QMap<int, MythUIType *> &focusList)
{
    if (m_CanHaveFocus)
        focusList.insertMulti(m_focusOrder, this);

    QList<MythUIType *>::Iterator it;
    for (it = m_ChildrenList.end()-1; it != m_ChildrenList.begin()-1; --it)
        (*it)->AddFocusableChildrenToList(focusList);
}
开发者ID:microe,项目名称:mythtv,代码行数:9,代码来源:mythuitype.cpp

示例15: evaluate

void evaluate(const QByteArray& seq, QMap<char, qreal>& result) {
    QMap<char, int> occurrencesMap;
    foreach(char ch, seq) {
        if (!occurrencesMap.keys().contains(ch)) {
            occurrencesMap.insertMulti(ch, 1);
        } else {
            ++occurrencesMap[ch];
        }
    }

    qreal len = seq.length();
    QMapIterator<char, int> i(occurrencesMap);
    while (i.hasNext()) {
        i.next();
        int count = i.value();
        qreal freq = count / len;
        result.insertMulti(i.key(), freq);
    }
}
开发者ID:ugeneunipro,项目名称:ugene,代码行数:19,代码来源:DNASequenceGenerator.cpp


注:本文中的QMap::insertMulti方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。