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


C++ QMultiMap::begin方法代码示例

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


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

示例1: parseHits

void parseHits(QXmlStreamReader & in, Task & task, const QString subtask)
{
    QMultiMap<int, Task::Hit> sortedHits;
    while(!in.atEnd()) {
        QXmlStreamReader::TokenType token = in.readNext();
        if (token == QXmlStreamReader::StartElement) {
            QString elementName = in.name().toString();
            if (0) {
            } else if (elementName.compare("h", Qt::CaseInsensitive) == 0){
                Task::Hit hit;
                QXmlStreamAttributes attrs = in.attributes();
                hit.timestamp = QDateTime::fromString(attrs.value("t").toString(), DATETIMEFORMAT);
                hit.duration = attrs.value("d").toString().toUInt();
                sortedHits.insertMulti(hit.timestamp.toTime_t(), hit);
            }
        } else if (token == QXmlStreamReader::EndElement && in.name().toString().compare("hits", Qt::CaseInsensitive) == 0) {
            break;
        }
    }

    // remove duplicates
    QMultiMap<int, Task::Hit>::iterator itr =  sortedHits.begin();
    Task::Hit prev;
    while(itr != sortedHits.end()) {
        if (itr.value() == prev)
            itr = sortedHits.erase(itr);
        else {
            prev = itr.value();
            itr++;
        }
    }
    task.hits[subtask] = sortedHits.values();
}
开发者ID:zanettea,项目名称:SAK,代码行数:33,代码来源:task.cpp

示例2: updateTrains

void MainApplication::updateTrains()
{
    QDateTime currentDateTime = QDateTime::currentDateTime();

    qDebug() << "update trains: current time:" << currentDateTime;

    southboundTrainModel_->removeTrainsOlderThan(currentDateTime.time());
    northboundTrainModel_->removeTrainsOlderThan(currentDateTime.time());

    QDateTime endTime = currentDateTime.addSecs(90*60);
    QMultiMap<QTime, Caltrains::Train> currentTrains = caltrains_.getTrainsByTime(currentDateTime, endTime);

    QList<Caltrains::Train> northboundTrainsList;
    QList<Caltrains::Train> southboundTrainsList;

    QMultiMap<QTime, Caltrains::Train>::iterator i;
    for (i = currentTrains.begin(); i != currentTrains.end(); ++i)
    {
        if (i.value().direction == Caltrains::North) {
            northboundTrainsList.append(i.value());
        }
        else {
            southboundTrainsList.append(i.value());
        }
    }

    qDebug() << "update trains: south:" << southboundTrainsList;
    qDebug() << "update trains: north:" << northboundTrainsList;

    southboundTrainModel_->addCaltrains(southboundTrainsList);
    northboundTrainModel_->addCaltrains(northboundTrainsList);
}
开发者ID:kenrobbins,项目名称:caltrain_runner,代码行数:32,代码来源:MainApplication.cpp

示例3: cleanResultList

void QgsSnapper::cleanResultList( QMultiMap<double, QgsSnappingResult>& list, const QList<QgsPoint>& excludeList ) const
{
  QgsPoint currentResultPoint;
  QgsSnappingResult currentSnappingResult;
  QList<double> keysToRemove;

  QMultiMap<double, QgsSnappingResult>::iterator result_it = list.begin();
  for ( ; result_it != list.end(); ++result_it )
  {
    currentSnappingResult = result_it.value();
    if ( currentSnappingResult.snappedVertexNr != -1 )
    {
      currentResultPoint = currentSnappingResult.snappedVertex;
      if ( excludeList.contains( currentResultPoint ) )
      {
        keysToRemove.push_back( result_it.key() );
      }
    }
  }

  QList<double>::const_iterator remove_it = keysToRemove.constBegin();
  for ( ; remove_it != keysToRemove.constEnd(); ++remove_it )
  {
    list.remove( *remove_it );
  }
}
开发者ID:AM7000000,项目名称:QGIS,代码行数:26,代码来源:qgssnapper.cpp

示例4: moveSelectedVertexes

void QgsSelectedFeature::moveSelectedVertexes( QgsVector v )
{
  int nUpdates = 0;
  Q_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, nullptr );
    if ( !entry || !entry->isSelected() )
      continue;

    if ( topologicalEditing )
    {
      // snap from current vertex
      currentResultList.clear();
      mVlayer->snapWithContext( entry->pointV1(), 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();

    QgsPointV2 p = entry->point();
    p.setX( p.x() + v.x() );
    p.setY( p.y() + v.y() );
    mVlayer->moveVertex( p, 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, resultIt.value().snappedAtGeometry, resultIt.value().snappedVertexNr );
      }
    }
  }

  if ( nUpdates > 0 )
    endGeometryChange();

  mVlayer->endEditCommand();
}
开发者ID:HeatherHillers,项目名称:QGIS,代码行数:59,代码来源:qgsselectedfeature.cpp

示例5: enabled

void tst_QWebPluginDatabase::enabled()
{
    QMultiMap<QString, QWebPluginInfo> pluginsMap;
    QWebPluginDatabase* database = QWebSettings::pluginDatabase();
    QList<QWebPluginInfo> plugins = database->plugins();

    for (int i = 0; i < plugins.count(); ++i) {
        QWebPluginInfo plugin = plugins.at(i);

        QList<MimeType> mimeTypes = plugin.mimeTypes();
        for (int j = 0; j < mimeTypes.count(); ++j) {
            QString mimeType = mimeTypes.at(j).name;
            pluginsMap.insert(mimeType, plugin);
            QVERIFY(plugin.supportsMimeType(mimeType));
        }
    }

    QMultiMap<QString, QWebPluginInfo>::iterator it = pluginsMap.begin();
    while (it != pluginsMap.end()) {
        QString mimeType = it.key();
        QWebPluginInfo plugin = it.value();
        QWebPluginInfo pluginForMimeType = database->pluginForMimeType(mimeType);

        QVERIFY(pluginsMap.count(mimeType) > 0);

        if (pluginsMap.count(mimeType) == 1) {
            QCOMPARE(plugin, pluginForMimeType);

            QVERIFY(plugin.isEnabled());
            QVERIFY(pluginForMimeType.isEnabled());
            plugin.setEnabled(false);
            QVERIFY(!plugin.isEnabled());
            QVERIFY(!pluginForMimeType.isEnabled());
        } else {
            QVERIFY(plugin.isEnabled());
            QVERIFY(pluginForMimeType.isEnabled());
            plugin.setEnabled(false);
            QVERIFY(!plugin.isEnabled());
        }

        QVERIFY(!plugin.isNull());
        QVERIFY(!pluginForMimeType.isNull());

        QWebPluginInfo pluginForMimeType2 = database->pluginForMimeType(mimeType);
        if (pluginsMap.count(mimeType) == 1) {
            QVERIFY(pluginForMimeType2 != plugin);
            QVERIFY(pluginForMimeType2.isNull());
        } else {
            QVERIFY(pluginForMimeType2 != plugin);
            QVERIFY(!pluginForMimeType2.isNull());
        }

        plugin.setEnabled(true);

        ++it;
    }
}
开发者ID:SchleunigerAG,项目名称:WinEC7_Qt5.3.1_Fixes,代码行数:57,代码来源:tst_qwebplugindatabase.cpp

示例6: 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);
    }
}
开发者ID:ppiecuch,项目名称:qcad,代码行数:59,代码来源:RPropertyEditor.cpp

示例7: convertMapToString

QString SDBCache::convertMapToString(QMultiMap<uint, uint> &map){
    QStringList tmp;

    QMultiMap<uint,uint>::iterator it = map.begin();
    while(it != map.end()){
        tmp.append(QString::number(it.key()));
        tmp.append(QString::number(it.value()));
        it++;
    }
    return tmp.join(",");
}
开发者ID:okirmis,项目名称:sdb-server,代码行数:11,代码来源:sdbcache.cpp

示例8: updateDestination

void Transact::updateDestination()
{
	// TODO: should be a Qt model.
	ui->destination->clear();
	ui->destination->addItem("(Create Contract)");
	QMultiMap<QString, QString> in;
	for (Address const& a: m_main->allKnownAddresses())
		in.insert(QString::fromStdString(m_main->toName(a) + " (" + ICAP(a).encoded() + ")"), QString::fromStdString(a.hex()));
	for (auto i = in.begin(); i != in.end(); ++i)
		ui->destination->addItem(i.key(), i.value());

}
开发者ID:AndresAH,项目名称:cpp-ethereum,代码行数:12,代码来源:Transact.cpp

示例9: update

void EntityTreeWidget::update()
{
    this->clear();
    QMultiMap<QString, QString> entityCatalogue;
    _entityModelHash = ModelsManager::getOrCreate()->getEntityModelHash();
    QStringList availableEntities = ModelsManager::getOrCreate()->getAvailableEntities().keys();

    foreach (NtgEntityModel entityModel, _entityModelHash)
    {

        if (entityModel.browsable && availableEntities.contains(entityModel.name))
        {
          entityCatalogue.insert(entityModel.category,entityModel.name);
        }
    }

    QTreeWidgetItem * categoryItem = NULL;
    EntityTreeWidgetItem * entityItem = NULL;
    QList<QTreeWidgetItem *> treeWidgetList;
    QMultiMap<QString, QString>::iterator i = entityCatalogue.begin();
    while (i != entityCatalogue.end())
    {
    QString categoryName = i.key();
    QString entityName = i.value();
    treeWidgetList = findItems(categoryName,Qt::MatchExactly,0);
    if (treeWidgetList.size() == 0)
    {
      categoryItem = new QTreeWidgetItem(this);
      categoryItem->setText(0,categoryName);
    }
    else
    {
      categoryItem = treeWidgetList.at(0);
    }
    entityItem = new EntityTreeWidgetItem(categoryItem);


    QString uuidName = entityName.toLower().simplified().replace(" ","");
    entityItem->setText(0, _entityModelHash.value(entityName).longName);
    entityItem->setText(1, entityName);
    QPixmap pixmap;
    pixmap.loadFromData(_entityModelHash.value(entityName).imagePNG,"PNG");
    entityItem->setIcon(0, QIcon(pixmap));

    ++i;
    }
    sortItems (0, Qt::AscendingOrder);
    expandAll();
}
开发者ID:agnousse,项目名称:netglub,代码行数:49,代码来源:entitytreewidget.cpp

示例10: toClean

DailyCleaning DirtiestCleaner::toClean(QDate date, const FacilityState &state)
{
  QMultiMap<double,unsigned int> loops;
  for(unsigned int loop=0;loop<state.getFacility().loopNumber;loop++)
    loops.insert(state.getCleanliness(loop),loop);

  DailyCleaning toReturn;

  unsigned int day=loopsperday, night=loopspernight;
  for(auto loop=loops.begin();loop!=loops.end();loop++){
    if(day){toReturn.dayTruck.append(loop.value()); day--;}
    else if(night){toReturn.nightTruck.append(loop.value()); night--;}
    else break;
  }
  return toReturn;
}
开发者ID:hegyhati,项目名称:CSP_Cleaning_Simulator,代码行数:16,代码来源:Dirtiest_Cleaner.cpp

示例11: QDialog

CreateIndexDialog::CreateIndexDialog(DBBrowserDB* db, QWidget* parent)
    : QDialog(parent),
      pdb(db),
      ui(new Ui::CreateIndexDialog)
{
    // Create UI
    ui->setupUi(this);

    // Get list of tables, sort it alphabetically and fill the combobox
    QMultiMap<QString, DBBrowserObject> dbobjs;
    QList<DBBrowserObject> tables = pdb->objMap.values("table");
    for(QList<DBBrowserObject>::ConstIterator it=tables.begin();it!=tables.end();++it)
        dbobjs.insert((*it).getname(), (*it));
    for(QMultiMap<QString, DBBrowserObject>::ConstIterator it=dbobjs.begin(); it != dbobjs.end(); ++it)
        ui->comboTableName->addItem(QIcon(QString(":icons/table")), (*it).getname());
}
开发者ID:0077cc,项目名称:sqlitebrowser,代码行数:16,代码来源:CreateIndexDialog.cpp

示例12: parseRuleReferences

bool AbstractRuleBinder::parseRuleReferences(QString& strRule)
{
    QMultiMap<size_t, QMap<size_t,size_t> > mapLookups;
    if (!ruleCheckerPtr->parseRule(strRule,mapLookups)) return false;
    if (mapLookups.size()>0){

        QMultiMap<size_t,  QMap<size_t,size_t> >::iterator j = mapLookups.begin();
         while (j != mapLookups.end()) {

             QString strResult;

             size_t field=j.value().begin().value();
             size_t mapper=j.value().begin().key();

             QVariant var=getVal(field,mapper);
             if (var.type()==QVariant::Invalid) return false;
             if (var.type()==QVariant::String) strResult=tr("'") + var.toString() + tr("'");
             else strResult=var.toString();

             QString searchStr=StrRulePtr + tr("(") + QVariant(j.key()).toString() + tr(")");
             strRule=strRule.replace(searchStr,
                 strResult);

             ++j;
         }

    }

    //search for references to the current sample
    QMap<QString, QString> mapSample;
    if (!parseSample(strRule,mapSample)) return false;

    QMap<QString, QString>::iterator j = mapSample.begin();
     while (j != mapSample.end()) {

             QString searchStr=StrRuleSample + tr("(") + QVariant(j.key()).toString() + tr(")");
             strRule=strRule.replace(searchStr,
                 j.value());

             //qDebug() << strRule << endl;

         ++j;
     }

    return true;
}
开发者ID:doublebyte1,项目名称:app_solution,代码行数:46,代码来源:abstractrulebinder.cpp

示例13: writeToGui

void multipleCheckDialog::writeToGui()
{

    QMultiMap<QString,contactWidgetFastBook*> fastList;
    QString filter = ui->lineEdit->text();

    for (libJackSMS::dataTypes::phoneBookType::const_iterator i = rubrica.begin(); i != rubrica.end(); ++i) {

        //Controllo che non sia già presente nella lista destinatari
        if (!padre->isInRecipients(i.value().getPhone()))
        {
            if (i->getName().contains(filter, Qt::CaseInsensitive))
            {
                QIcon ico;
                libJackSMS::dataTypes::configuredServicesType::const_iterator x = elencoServiziConfigurati.find(i->getAccount());

                if (x == elencoServiziConfigurati.end())
                {
                    ico = QIcon(":/resource/ico_contact.png");
                }
                else
                {
                    QString serv = x.value().getService();
                    libJackSMS::dataTypes::servicesType::const_iterator tmp = elencoServizi.find(serv);
                    ico = tmp->getIcon();
                }

                contactWidgetFastBook *ww = new contactWidgetFastBook(i.value(), ico.pixmap(16,16), true);
                fastList.insert(i->getName().toUpper(), ww);
            }
        }
    }

    if (fastList.size() > 0)
    {
        for (QMultiMap<QString,contactWidgetFastBook*>::ConstIterator xx = fastList.begin(); xx != fastList.end(); ++xx)
        {
           QListWidgetItem *item = new QListWidgetItem;
           item->setSizeHint(xx.value()->size());
           ui->listWidget->addItem(item);
           ui->listWidget->setItemWidget(item, xx.value());
        }
    }
}
开发者ID:freesmee,项目名称:freesmee-desktop,代码行数:44,代码来源:multiplecheckdialog.cpp

示例14: snappedOffsetForLines

double Snapper::snappedOffsetForLines(const SnapLineMap &snappingLineMap,
                                      double value) const
{
    QMultiMap<double, double> minimumSnappingLineMap;

    SnapLineMapIterator snappingLineIterator(snappingLineMap);
    while (snappingLineIterator.hasNext()) {
        snappingLineIterator.next();
        double snapLine = snappingLineIterator.key();
        double offset = value - snapLine;
        double distance = qAbs(offset);

        if (distance < snappingDistance())
            minimumSnappingLineMap.insert(distance, offset);
    }

    if (!minimumSnappingLineMap.isEmpty())
        return  minimumSnappingLineMap.begin().value();

    return std::numeric_limits<double>::max();
}
开发者ID:jlehtoranta,项目名称:sailfish-qtcreator,代码行数:21,代码来源:snapper.cpp

示例15: snappedOffsetForOffsetLines

double Snapper::snappedOffsetForOffsetLines(const SnapLineMap &snappingOffsetMap,
                              Qt::Orientation orientation,
                              double value,
                              double lowerLimit,
                              double upperLimit) const
{
    QMultiMap<double, double> minimumSnappingLineMap;

    SnapLineMapIterator snappingOffsetIterator(snappingOffsetMap);
    while (snappingOffsetIterator.hasNext()) {
        snappingOffsetIterator.next();
        double snapLine = snappingOffsetIterator.key();
        const QRectF &formEditorItemRect(snappingOffsetIterator.value().first);
        double formEditorItemRectLowerLimit;
        double formEditorItemRectUpperLimit;
        if (orientation == Qt::Horizontal) {
            formEditorItemRectLowerLimit = formEditorItemRect.left();
            formEditorItemRectUpperLimit = formEditorItemRect.right();
        } else {
            formEditorItemRectLowerLimit = formEditorItemRect.top();
            formEditorItemRectUpperLimit = formEditorItemRect.bottom();
        }

        double offset = value - snapLine;
        double distance = qAbs(offset);

        if (distance < snappingDistance() &&
           !(lowerLimit > formEditorItemRectUpperLimit ||
             upperLimit < formEditorItemRectLowerLimit)) {

            minimumSnappingLineMap.insert(distance, offset);
        }
    }

    if (!minimumSnappingLineMap.isEmpty()) {
        return  minimumSnappingLineMap.begin().value();
    }

    return std::numeric_limits<double>::max();
}
开发者ID:CNOT,项目名称:julia-studio,代码行数:40,代码来源:snapper.cpp


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