本文整理汇总了C++中QMultiMap::values方法的典型用法代码示例。如果您正苦于以下问题:C++ QMultiMap::values方法的具体用法?C++ QMultiMap::values怎么用?C++ QMultiMap::values使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QMultiMap
的用法示例。
在下文中一共展示了QMultiMap::values方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: sort
void PlaylistModel::sort(int column, Qt::SortOrder order)
{
if (m_tracks.count() < 2)
{
return;
}
QMultiMap<QString, KUrl> keyMap;
QMultiMap<qint64, KUrl> durationMap;
KUrl::List tracks;
const KUrl url = m_tracks.value(m_currentTrack);
if (column == DurationColumn)
{
for (int i = 0; i < m_tracks.count(); ++i)
{
durationMap.insert(MetaDataManager::duration(m_tracks.at(i)), m_tracks.at(i));
}
tracks = durationMap.values();
}
else if (column > FileNameColumn && column < DurationColumn)
{
const MetaDataKey key = translateColumn(column);
for (int i = 0; i < m_tracks.count(); ++i)
{
keyMap.insert(MetaDataManager::metaData(m_tracks.at(i), key), m_tracks.at(i));
}
tracks = keyMap.values();
}
else
{
for (int i = 0; i < m_tracks.count(); ++i)
{
keyMap.insert(m_tracks.at(i).pathOrUrl(), m_tracks.at(i));
}
tracks = keyMap.values();
}
if (order == Qt::AscendingOrder)
{
KUrl::List items;
for (int i = (tracks.count() - 1); i >= 0; --i)
{
items.append(tracks.at(i));
}
tracks = items;
}
m_tracks = tracks;
setCurrentTrack(findTrack(url));
emit tracksChanged();
}
示例2: parseIndexFile
void XCursorThemeData::parseIndexFile () {
QMultiMap<QString, QString> cfg = loadCfgFile(mPath+"/index.theme", true);
if (cfg.contains("icon theme/name")) mTitle = cfg.values("icon theme/name").at(0).trimmed();
if (cfg.contains("icon theme/comment")) mDescription = cfg.values("icon theme/comment").at(0).trimmed();
if (cfg.contains("icon theme/example")) mSample = cfg.values("icon theme/example").at(0).trimmed();
if (cfg.contains("icon theme/hidden")) {
QString hiddenValue = cfg.values("icon theme/hidden").at(0).toLower();
mHidden = hiddenValue=="false" ? false : true;
}
if (cfg.contains("icon theme/inherits")) {
QStringList i = cfg.values("icon theme/inherits"), res;
for (int f = i.size()-1; f >= 0; f--) res << i.at(f).trimmed();
}
if (mDescription.startsWith("- Converted by")) mDescription.remove(0, 2);
}
示例3: buildTemplateList
void NewProjectPage::buildTemplateList()
{
QMultiMap<QString, ProjectEntry*> *dirList = mFrontloader->getProjectList()->getTemplateDirectoryList();
QList<ProjectEntry*> entryList = dirList->values("Templates");
mTemplateNameList.clear();
TemplateList->clear();
for(int i=0; i<entryList.size(); i++)
{
ProjectEntry *entry = entryList.at(i);
if(mTemplateNameList.values(entry->mName).size() == 0)
{
mTemplateNameList.insert(entry->mName, entry);
QPixmap *pixmap = NULL;
if(mFrontloader != NULL)
{
pixmap = mFrontloader->getProjectPixmap(entry);
}
if(pixmap == NULL)
{
TemplateList->addItem(entry->mName);
}
else
{
QIcon icon(pixmap->scaled(16, 16));
TemplateList->addItem(icon, entry->mName);
}
}
}
}
示例4: rescan
int Library::rescan() throw (Exception)
{
clearDatabaseAndCreateTables();
int count = 0;
QMultiMap<QString, FilePath> dirs = getAllElementDirectories();
count += addCategoriesToDb<ComponentCategory>( dirs.values("cmpcat"), "component_categories", "cat_id");
count += addCategoriesToDb<PackageCategory>( dirs.values("pkgcat"), "package_categories", "cat_id");
count += addElementsToDb<Symbol>( dirs.values("sym"), "symbols", "symbol_id");
count += addElementsToDb<SpiceModel>( dirs.values("spcmdl"), "spice_models", "model_id");
count += addElementsToDb<Package>( dirs.values("pkg"), "packages", "package_id");
count += addElementsToDb<Component>( dirs.values("cmp"), "components", "component_id");
count += addDevicesToDb( dirs.values("dev"), "devices", "device_id");
return count;
}
示例5: on_cVersion_currentIndexChanged
void MainWindow::on_cVersion_currentIndexChanged(const QString &version)
{
QHash<QString, QStringList> &hVersion = reports[version];
QStringList crashLocations = hVersion.keys();
ui->cLocation->clear();
if (crashLocations.size())
{
QMultiMap<int, QString> sortedMap;
for (int i=0; i< crashLocations.size(); i++)
{
sortedMap.insert(hVersion.value(crashLocations.at(i)).size(), crashLocations.at(i));
}
QStringList sortedLocations = sortedMap.values();
std::reverse(sortedLocations.begin(), sortedLocations.end());
ui->cLocation->addItems(sortedLocations);
ui->cLocation->setCurrentIndex(0);
int acum = 0;
for (int i = 0; i < crashLocations.size(); i++)
{
acum += hVersion.value(crashLocations[i]).size();
}
ui->eVersion->setText(QString::number(acum));
}
else
{
ui->eVersion->setText(QString::number(0));
ui->cLocation->addItem(tr("Crash location"));
}
}
示例6: certToFormattedString
static QString certToFormattedString(QSslCertificate cert)
{
QString resultstring = QLatin1String("<p>");
QStringList tmplist;
resultstring += cert.subjectInfo(QSslCertificate::CommonName);
resultstring += QString::fromLatin1("<br/>Issuer: %1")
.arg(cert.issuerInfo(QSslCertificate::CommonName));
resultstring += QString::fromLatin1("<br/>Not valid before: %1<br/>Valid Until: %2")
.arg(cert.effectiveDate().toString(Qt::ISODate))
.arg(cert.expiryDate().toString(Qt::ISODate));
QMultiMap<QSsl::AlternateNameEntryType, QString> names = cert.alternateSubjectNames();
if (names.count() > 0) {
tmplist = names.values(QSsl::DnsEntry);
resultstring += QLatin1String("<br/>Alternate Names:<ul><li>")
+ tmplist.join(QLatin1String("</li><li>"))
+ QLatin1String("</li><</ul>");
}
resultstring += QLatin1String("</p>");
return resultstring;
}
示例7: validateCurrentProject
bool VersionsConverterManager::validateCurrentProject()
{
QSet<QString> editorsToCheck;
IdList const allElements = mMainWindow.models()->logicalModelAssistApi().children(Id::rootId());
for (Id const &element : allElements) {
editorsToCheck << element.editor();
}
QMap<Id, Version> const savedVersions = mMainWindow.models()->logicalModelAssistApi().editorVersions();
QMultiMap<QString, ProjectConverter> const converters = mMainWindow.toolManager().projectConverters();
for (QString const &editor : editorsToCheck) {
Version const currentVersion = mMainWindow.editorManager().version(Id(editor));
Version const savedVersion = savedVersions[Id(editor)];
if (currentVersion == savedVersion) {
continue;
}
if (currentVersion < savedVersion) {
displayTooOldEnviromentError(savedVersion);
return false;
}
if (!convertProject(currentVersion, savedVersion, converters.values(editor))) {
return false;
}
}
return true;
}
示例8: 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();
}
示例9: loadFromPlugin
AbstractView* ViewLoader::loadFromPlugin(AbstractView *currentView, const QString &menuAction)
{
AbstractView *view = nullptr;
// Other views loaded from plugins
QMultiMap<QString, QObject*> multiMap = _pluginManager->dependencies();
QObjectList dep = multiMap.values(menuAction);
if (dep.isEmpty()) {
return view;
}
qDebug() << Q_FUNC_INFO << "No built-in view was found for this action. Was it from an external plugin?";
for (BasicPlugin *plugin : _pluginManager->loadedPlugins().values()) {
if (plugin->name() != menuAction) {
continue;
}
// Check if we need to pass some objects from old view to new view, because new one can be brought by plugins
// For example, a plugin may need the MediaPlayerControl from the current view
if (MediaPlayerPlugin *mediaPlayerPlugin = qobject_cast<MediaPlayerPlugin*>(plugin)) {
mediaPlayerPlugin->setMediaPlayerControl(currentView->mediaPlayerControl());
if (mediaPlayerPlugin->hasView()) {
view = mediaPlayerPlugin->instanciateView();
view->setOrigin(currentView);
}
}
}
return view;
}
示例10: channelNames
void WidgetChatCenter::channelNames(QStringList names)
{
WidgetChatTab* tab = tabByName(names.at(2));
QString namestr = names.at(3);
QStringList list = namestr.split(" ");
list.sort();
QMultiMap<int, int> map;
for(int i = 0; i < list.size(); ++i)
{
QString user = list.at(i);
int idx = prefixChars.indexOf(user.at(0));
if(idx < 0)
{
idx = prefixChars.length(); // normal user
}
map.insert(idx, i);
}
QStringList sorted;
QList<int> values = map.values();
for(int i = 0; i < values.size(); ++i)
{
sorted.append(list.at(values.at(i)));
}
tab->channelNames(sorted);
}
示例11: search
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()));
}
示例12: executeActions
void MERFTag::executeActions(NFA* nfa) {
MSFormula* formula = (MSFormula*)(nfa->formula);
/** pre match **/
QString preMatch = msf->name;
preMatch.append("_preMatch();\n");
formula->actionData.append(preMatch);
/** Done **/
match->executeActions(nfa);
/** on match **/
QString onMatch = msf->name;
onMatch.append("_onMatch");
QMultiMap<QString,QPair<QString,QString> > *functionParametersMap = &(formula->functionParametersMap);
QList<QPair<QString,QString> > params = functionParametersMap->values(onMatch);
onMatch.append('(');
for(int j=0; j<params.count(); j++) {
QString msfName = params.at(j).first;
QString field = params.at(j).second;
QString sarfMatches;
QString paramValue = getParam(msfName,field,&sarfMatches);
if(field.compare("text") == 0) {
onMatch.append('\"' + paramValue + "\",");
}
else if(field.compare("position") == 0) {
onMatch.append(paramValue + ',');
}
else if(field.compare("length") == 0) {
onMatch.append(paramValue + ',');
}
else if(field.compare("number") == 0) {
onMatch.append(paramValue + ',');
}
else if(field.compare("matches") == 0) {
onMatch.append(paramValue + ',');
formula->actionData.append(sarfMatches);
}
}
if(params.count() == 0) {
onMatch.append(");\n");
}
else {
onMatch.chop(1);
onMatch.append(");\n");
}
formula->actionData.append(onMatch);
/** Done **/
}
示例13: dumpCertificate
void Connector::dumpCertificate( const QSslCertificate &cert )
{
qDebug() << cert.toPem();
qDebug() << "== Subject Info ==\b";
qDebug() << "CommonName:\t\t" << cert.subjectInfo( QSslCertificate::CommonName );
qDebug() << "Organization:\t\t" << cert.subjectInfo( QSslCertificate::Organization );
qDebug() << "LocalityName:\t\t" << cert.subjectInfo( QSslCertificate::LocalityName );
qDebug() << "OrganizationalUnitName:\t" << cert.subjectInfo( QSslCertificate::OrganizationalUnitName );
qDebug() << "StateOrProvinceName:\t" << cert.subjectInfo( QSslCertificate::StateOrProvinceName );
QMultiMap<QSsl::AlternateNameEntryType, QString> altNames = cert.alternateSubjectNames();
if ( !altNames.isEmpty() ) {
qDebug() << "Alternate Subject Names (DNS):";
foreach (const QString &altName, altNames.values(QSsl::DnsEntry)) {
qDebug() << altName;
}
qDebug() << "Alternate Subject Names (Email):";
foreach (const QString &altName, altNames.values(QSsl::EmailEntry)) {
qDebug() << altName;
}
}
示例14: testCodeParserGTest
void AutoTestUnitTests::testCodeParserGTest()
{
if (qgetenv("GOOGLETEST_DIR").isEmpty())
QSKIP("This test needs googletest - set GOOGLETEST_DIR (point to googletest repository)");
QFETCH(QString, projectFilePath);
CppTools::Tests::ProjectOpenerAndCloser projectManager;
CppTools::ProjectInfo projectInfo = projectManager.open(projectFilePath, true);
QVERIFY(projectInfo.isValid());
QSignalSpy parserSpy(m_model->parser(), SIGNAL(parsingFinished()));
QSignalSpy modelUpdateSpy(m_model, SIGNAL(sweepingDone()));
QVERIFY(parserSpy.wait(20000));
QVERIFY(modelUpdateSpy.wait());
QCOMPARE(m_model->gtestNamesCount(), 7);
QMultiMap<QString, int> expectedNamesAndSets;
expectedNamesAndSets.insert(QStringLiteral("FactorialTest"), 3);
expectedNamesAndSets.insert(QStringLiteral("FactorialTest_Iterative"), 2);
expectedNamesAndSets.insert(QStringLiteral("Sum"), 2);
expectedNamesAndSets.insert(QStringLiteral("QueueTest"), 2);
expectedNamesAndSets.insert(QStringLiteral("DummyTest"), 1); // used as parameterized test
expectedNamesAndSets.insert(QStringLiteral("DummyTest"), 1); // used as 'normal' test
expectedNamesAndSets.insert(QStringLiteral("NamespaceTest"), 1);
QMultiMap<QString, int> foundNamesAndSets = m_model->gtestNamesAndSets();
QCOMPARE(expectedNamesAndSets.size(), foundNamesAndSets.size());
foreach (const QString &name, expectedNamesAndSets.keys())
QCOMPARE(expectedNamesAndSets.values(name), foundNamesAndSets.values(name));
// check also that no Qt related tests have been found
QCOMPARE(m_model->autoTestsCount(), 0);
QCOMPARE(m_model->namedQuickTestsCount(), 0);
QCOMPARE(m_model->unnamedQuickTestsCount(), 0);
QCOMPARE(m_model->dataTagsCount(), 0);
}
示例15: testCodeParserGTest
void AutoTestUnitTests::testCodeParserGTest()
{
if (qgetenv("GOOGLETEST_DIR").isEmpty())
QSKIP("This test needs googletest - set GOOGLETEST_DIR (point to googletest repository)");
NavigationWidget *navigation = NavigationWidget::instance();
navigation->activateSubWidget(Constants::AUTOTEST_ID);
CppTools::Tests::ProjectOpenerAndCloser projectManager;
CppTools::ProjectInfo projectInfo = projectManager.open(
QString(m_tmpDir->path() + QLatin1String("/simple_gt/simple_gt.pro")), true);
QVERIFY(projectInfo.isValid());
QSignalSpy parserSpy(m_model->parser(), SIGNAL(parsingFinished()));
QVERIFY(parserSpy.wait(20000));
QCOMPARE(m_model->gtestNamesCount(), 6);
QMultiMap<QString, int> expectedNamesAndSets;
expectedNamesAndSets.insert(QStringLiteral("FactorialTest"), 3);
expectedNamesAndSets.insert(QStringLiteral("FactorialTest_Iterative"), 2);
expectedNamesAndSets.insert(QStringLiteral("Sum"), 2);
expectedNamesAndSets.insert(QStringLiteral("QueueTest"), 2);
expectedNamesAndSets.insert(QStringLiteral("DummyTest"), 1); // used as parameterized test
expectedNamesAndSets.insert(QStringLiteral("DummyTest"), 1); // used as 'normal' test
QMultiMap<QString, int> foundNamesAndSets = m_model->gtestNamesAndSets();
QCOMPARE(expectedNamesAndSets.size(), foundNamesAndSets.size());
foreach (const QString &name, expectedNamesAndSets.keys())
QCOMPARE(expectedNamesAndSets.values(name), foundNamesAndSets.values(name));
// check also that no Qt related tests have been found
QCOMPARE(m_model->autoTestsCount(), 0);
QCOMPARE(m_model->namedQuickTestsCount(), 0);
QCOMPARE(m_model->unnamedQuickTestsCount(), 0);
QCOMPARE(m_model->dataTagsCount(), 0);
}