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


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

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


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

示例1: openElement

void TasXmlWriter::openElement(const QString& name, QMap<QString,QString> attributes)
{
    mXmlStream << "<" << name << " ";

    QMap<QString, QString>::const_iterator i;

    for (i = attributes.constBegin(); i != attributes.constEnd(); ++i)
        mXmlStream << i.key() << "=\"" << i.value() << "\" ";
        
    mXmlStream << ">";
}
开发者ID:alirezaarmn,项目名称:cutedriver-agent_qt,代码行数:11,代码来源:tasxmlwriter.cpp

示例2: QString

QString QMacPasteboardMimeQt3Any::mimeFor(QString flav)
{
    loadMimeRegistry();
    const int os_flav = UTGetOSTypeFromString(UTTypeCopyPreferredTagWithClass(QCFString(flav), kUTTagClassOSType));
    for(QMap<QString, int>::const_iterator it = mime_registry.constBegin();
        it != mime_registry.constEnd(); ++it) {
        if(it.value() == os_flav)
            return QString::fromLatin1(it.key().toLatin1());
    }
    return QString();
}
开发者ID:FilipBE,项目名称:qtextended,代码行数:11,代码来源:qmime_mac.cpp

示例3: mapToReversedLists

//! populate two lists (ks, vs) from map - in reverse order
template <class Key, class T> void mapToReversedLists( const QMap< Key, T > &map, QList<Key> &ks, QList<T> &vs )
{
  ks.reserve( map.size() );
  vs.reserve( map.size() );
  typename QMap<Key, T>::const_iterator i = map.constEnd();
  while ( i-- != map.constBegin() )
  {
    ks.append( i.key() );
    vs.append( i.value() );
  }
}
开发者ID:anitagraser,项目名称:QGIS,代码行数:12,代码来源:qgsvectorlayereditbuffer.cpp

示例4: proc

AlbumScanner::AlbumScanner(const QMap<int, QString> &files)
    : proc(0)
{
    QMap<int, QString>::ConstIterator it=files.constBegin();
    QMap<int, QString>::ConstIterator end=files.constEnd();

    for (int i=0; it!=end; ++it, ++i) {
        fileNames.append(it.value());
        trackIndexMap[i]=it.key();
    }
}
开发者ID:CDrummond,项目名称:cantata,代码行数:11,代码来源:albumscanner.cpp

示例5: setEntry

int DocumentsHandler::setEntry(const Akonadi::Item &item, QString &newId, QString &errorMessage)
{
    if (!item.hasPayload<SugarDocument>()) {
        qCCritical(FATCRM_SUGARCRMRESOURCE_LOG) << "item (id=" << item.id() << ", remoteId=" << item.remoteId()
                 << ", mime=" << item.mimeType() << ") is missing Document payload";
        return SugarJob::InvalidContextError;
    }

    QList<KDSoapGenerated::TNS__Name_value> itemList;

    // if there is an id add it, otherwise skip this field
    // no id will result in the email being added
    if (!item.remoteId().isEmpty()) {
        KDSoapGenerated::TNS__Name_value field;
        field.setName(QStringLiteral("id"));
        field.setValue(item.remoteId());

        itemList << field;
    }

    const SugarDocument document = item.payload<SugarDocument>();
    const SugarDocument::AccessorHash accessors = SugarDocument::accessorHash();
    SugarDocument::AccessorHash::const_iterator it    = accessors.constBegin();
    SugarDocument::AccessorHash::const_iterator endIt = accessors.constEnd();
    for (; it != endIt; ++it) {
        // check if this is a read-only field
        if (it.key() == QLatin1String("id")) {
            continue;
        }

        const SugarDocument::valueGetter getter = (*it).getter;
        KDSoapGenerated::TNS__Name_value field;
        field.setName(sugarFieldFromCrmField(it.key()));
        field.setValue(KDCRMUtils::encodeXML((document.*getter)()));

        itemList << field;
    }

    // plus custom fields
    QMap<QString, QString> customFields = document.customFields();
    QMap<QString, QString>::const_iterator cit = customFields.constBegin();
    const QMap<QString, QString>::const_iterator end = customFields.constEnd();
    for ( ; cit != end ; ++cit ) {
        KDSoapGenerated::TNS__Name_value field;
        field.setName(customSugarFieldFromCrmField(cit.key()));
        field.setValue(KDCRMUtils::encodeXML(cit.value()));
        itemList << field;
    }

    KDSoapGenerated::TNS__Name_value_list valueList;
    valueList.setItems(itemList);

    return mSession->protocol()->setEntry(module(), valueList, newId, errorMessage);
}
开发者ID:KDAB,项目名称:FatCRM,代码行数:54,代码来源:documentshandler.cpp

示例6: printOptions

static void printOptions(QTextStream& s, const QMap<QString, QString>& options) {
    QMap<QString, QString>::const_iterator it = options.constBegin();
    s.setFieldAlignment(QTextStream::AlignLeft);
    for (; it != options.constEnd(); ++it) {
        s << "  --";
        s.setFieldWidth(38);
        s << it.key() << it.value();
        s.setFieldWidth(0);
        s << endl;
    }
}
开发者ID:OdyX,项目名称:Generatorrunner,代码行数:11,代码来源:main.cpp

示例7: loadProcessingSystems

void SubpanelDesignDialog::loadProcessingSystems()
{
	ui->base_panel->addItem("<select>");

	QMap<QString, QString> systems = NGSD().getProcessingSystems(true, true);
	auto it = systems.constBegin();
	while (it != systems.constEnd())
	{
		ui->base_panel->addItem(it.key(), it.value());
		++it;
	}
}
开发者ID:imgag,项目名称:ngs-bits,代码行数:12,代码来源:SubpanelDesignDialog.cpp

示例8: saveUser

void ThesaurusDatabaseType::saveUser(){
	if (userFileName.isEmpty() || userWords.isEmpty()) return;
	QFile f(userFileName);
	if (!f.open(QFile::WriteOnly)) return;
	QTextStream s(&f);
	s.setCodec(QTextCodec::codecForMib(MIB_UTF8));
	for (QMap<QString, QStringList>::const_iterator it = userWords.constBegin(), end = userWords.constEnd(); it != end; ++it ) {
		if (it.value().size() < 2) continue;
		s << it.value().join("|") << "\n";
	}
	//userFileName.clear(); why was it there? save only once?
}
开发者ID:Axure,项目名称:TeXstudio,代码行数:12,代码来源:thesaurusdialog.cpp

示例9: slotShowResults

void ArchiveOrg::slotShowResults(KJob* job)
{
    if (job->error() != 0 ) return;
    m_listWidget->blockSignals(true);
    KIO::StoredTransferJob* storedQueryJob = static_cast<KIO::StoredTransferJob*>( job );
    QJsonParseError jsonError;
    QJsonDocument doc = QJsonDocument::fromJson(storedQueryJob->data(), &jsonError);
    if (jsonError.error != QJsonParseError::NoError) {
        // There was an error parsing data
        KMessageBox::sorry(m_listWidget, jsonError.errorString(), i18n("Error Loading Data"));
    }
    QVariant data = doc.toVariant();
    
    QVariant sounds;
    if (data.canConvert(QVariant::Map)) {
        QMap <QString, QVariant> map = data.toMap();
        QMap<QString, QVariant>::const_iterator i = map.constBegin();
        while (i != map.constEnd()) {
            if (i.key() == QLatin1String("response")) {
                sounds = i.value();
                if (sounds.canConvert(QVariant::Map)) {
                    QMap <QString, QVariant> soundsList = sounds.toMap();
                    if (soundsList.contains(QStringLiteral("numFound"))) emit searchInfo(i18np("Found %1 result", "Found %1 results", soundsList.value("numFound").toInt()));
                    QList <QVariant> resultsList;
                    if (soundsList.contains(QStringLiteral("docs"))) {
                        resultsList = soundsList.value(QStringLiteral("docs")).toList();
                    }
                    
                    for (int j = 0; j < resultsList.count(); ++j) {
                        if (resultsList.at(j).canConvert(QVariant::Map)) {
                            QMap <QString, QVariant> soundmap = resultsList.at(j).toMap();
                            if (soundmap.contains(QStringLiteral("title"))) {
                                QListWidgetItem *item = new   QListWidgetItem(soundmap.value(QStringLiteral("title")).toString(), m_listWidget);
                                item->setData(descriptionRole, soundmap.value(QStringLiteral("description")).toString());
                                item->setData(idRole, soundmap.value(QStringLiteral("identifier")).toString());
                                QString author = soundmap.value(QStringLiteral("creator")).toString();
                                item->setData(authorRole, author);
                                if (author.startsWith(QLatin1String("http"))) item->setData(authorUrl, author);
                                item->setData(infoUrl, "http://archive.org/details/" + soundmap.value(QStringLiteral("identifier")).toString());
                                item->setData(downloadRole, "http://archive.org/download/" + soundmap.value(QStringLiteral("identifier")).toString());
                                item->setData(licenseRole, soundmap.value(QStringLiteral("licenseurl")).toString());                        
                            }
                        }
                    }
                }
            }
            ++i;
        }
    }
    m_listWidget->blockSignals(false);
    m_listWidget->setCurrentRow(0);
    emit searchDone();
}
开发者ID:dreamsxin,项目名称:kdenlive,代码行数:53,代码来源:archiveorg.cpp

示例10: updateIdentity

void FaceDb::updateIdentity(const Identity& p)
{
    d->db->execSql(QString::fromLatin1("DELETE FROM IdentityAttributes WHERE id=?;"), p.id());
    const QMap<QString, QString> map = p.attributesMap();
    QMap<QString, QString>::const_iterator it;

    for (it = map.constBegin(); it != map.constEnd(); ++it)
    {
        d->db->execSql(QString::fromLatin1("INSERT INTO IdentityAttributes (id, attribute, value) VALUES (?, ?,?);"),
                       p.id(), it.key(), it.value());
    }
}
开发者ID:KDE,项目名称:digikam,代码行数:12,代码来源:facedb.cpp

示例11: writeAnnotations

void AnnotationOutput::writeAnnotations(const QString &fileName, const QMap<uint, QPair<QString, QString> > &a_annotations)
{
  m_annotatedFileItems.clear();
  m_fileNames.clear();
  m_lines.clear();
  m_yourFileItems.clear();
  m_yourFileNames.clear();
  m_yourLines.clear();

  bool modified = false;
  QMap<uint, QPair<QString, QString> > annotations = a_annotations;
  QDomDocument *dom = Project::ref()->dom();
  QDomElement annotationElement = dom->firstChild().firstChild().namedItem("annotations").toElement();
  if (annotationElement.isNull())
  {
    annotationElement = dom->createElement("annotations");
    dom->firstChild().firstChild().appendChild(annotationElement);
  }
  QDomNode n = annotationElement.firstChild();
  while ( !n.isNull() ) 
  {
    QDomElement el = n.toElement();
    QString fName = el.attribute("url");
    QDomNode n2 = n.nextSibling();
    if (fileName == fName)    
    {
      QString text = el.attribute("text");
      bool ok;
      int line = el.attribute("line").toInt(&ok, 10);
      if (!annotations.contains(line) || (annotations[line].first != text))
      {
        n.parentNode().removeChild(n);
        modified = true;
      } else
        annotations.remove(line);
    }
    n = n2;
  }
  for (QMap<uint, QPair<QString, QString> >::ConstIterator it = annotations.constBegin(); it != annotations.constEnd(); ++it)
  {
    QDomElement el = dom->createElement("annotation");
    el.setAttribute("url", fileName);
    el.setAttribute("line", it.key());
    el.setAttribute("text", it.data().first);
    el.setAttribute("receiver", it.data().second.lower());
    annotationElement.appendChild(el);
    modified = true;
  }
  if (modified)
    Project::ref()->setModified(true);
  if (m_allAnnotations->isVisible() || m_yourAnnotations->isVisible())
    readAnnotations();
}
开发者ID:serghei,项目名称:kde3-kdewebdev,代码行数:53,代码来源:annotationoutput.cpp

示例12: applyTheme

void SoundThemeManager::applyTheme(const QString &themeName)
{
	MyThemes->setTheme(themeName);
	QMap<QString, QString> entries = MyThemes->getEntries();
	QMap<QString, QString>::const_iterator i = entries.constBegin();

	while (i != entries.constEnd())
	{
		config_file.writeEntry("Sounds", i.key() + "_sound", MyThemes->themePath() + i.value());
		++i;
	}
}
开发者ID:partition,项目名称:kadu,代码行数:12,代码来源:sound-theme-manager.cpp

示例13: findKey

static QMap<QString, QString>::const_iterator findKey(const QMap<QString, QString> &input,
                                                      Utils::OsType osType,
                                                      const QString &key)
{
    const Qt::CaseSensitivity casing
            = (osType == Utils::OsTypeWindows) ? Qt::CaseInsensitive : Qt::CaseSensitive;
    for (auto it = input.constBegin(); it != input.constEnd(); ++it) {
        if (key.compare(it.key(), casing) == 0)
            return it;
    }
    return input.constEnd();
}
开发者ID:choenig,项目名称:qt-creator,代码行数:12,代码来源:environment.cpp

示例14: showHelpForKeyword

void HelpBrowser::showHelpForKeyword(const QString &id)
{
    if (m_helpEngine) {
        QMap<QString, QUrl> links = m_helpEngine->linksForIdentifier(id);
        qDebug()<<m_helpEngine->collectionFile();
        qDebug()<<m_helpEngine->filterAttributes();
        qDebug()<<id<<links.count();
        if (links.count()){
            qDebug()<<links.constBegin().value();
            setSource(links.constBegin().value());
    }
    }
}
开发者ID:luigialberti,项目名称:dolomites,代码行数:13,代码来源:helpbrowser.cpp

示例15: KDataPrivate

    KDataPrivate(const Quantity *qty, const QMap<QString, qreal> & items, KData::ContentTypes t)
        : _quantity(qty)
    {
        Q_ASSERT(_quantity != 0);
        _types |= (KData::Array | t);

        QMap<QString, qreal>::const_iterator it = items.constBegin();
        QMap<QString, qreal>::const_iterator end = items.constEnd();
        while (it != end) {
            _items.append(KDataItem(it.key(), it.value(), t));
            it++;
        }
    }
开发者ID:ipsusila,项目名称:radenv,代码行数:13,代码来源:kdata.cpp


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