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


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

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


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

示例1: QgsDebugMsg

QList<QgsWCSSourceSelect::SupportedFormat> QgsWCSSourceSelect::providerFormats()
{
  QgsDebugMsg( "entered" );
  QList<SupportedFormat> formats;

  QMap<QString, QString> mimes = QgsWcsProvider::supportedMimes();
  Q_FOREACH ( const QString& mime, mimes.keys() )
  {
    SupportedFormat format = { mime, mimes.value( mime ) };

    // prefer tiff
    if ( mime == "image/tiff" )
    {
      formats.prepend( format );
    }
    else
    {
      formats.append( format );
    }
  }

  return formats;
}
开发者ID:AM7000000,项目名称:QGIS,代码行数:23,代码来源:qgswcssourceselect.cpp

示例2: resolve

QString Style::resolve(QString qss, const QFont& baseFont)
{
    if (dict.isEmpty()) {
        dict = {// colors
                {"@green", Style::getColor(Style::Green).name()},
                {"@yellow", Style::getColor(Style::Yellow).name()},
                {"@red", Style::getColor(Style::Red).name()},
                {"@black", Style::getColor(Style::Black).name()},
                {"@darkGrey", Style::getColor(Style::DarkGrey).name()},
                {"@mediumGrey", Style::getColor(Style::MediumGrey).name()},
                {"@mediumGreyLight", Style::getColor(Style::MediumGreyLight).name()},
                {"@lightGrey", Style::getColor(Style::LightGrey).name()},
                {"@white", Style::getColor(Style::White).name()},
                {"@orange", Style::getColor(Style::Orange).name()},
                {"@themeDark", Style::getColor(Style::ThemeDark).name()},
                {"@themeMediumDark", Style::getColor(Style::ThemeMediumDark).name()},
                {"@themeMedium", Style::getColor(Style::ThemeMedium).name()},
                {"@themeLight", Style::getColor(Style::ThemeLight).name()},

                // fonts
                {"@baseFont",
                 QString::fromUtf8("'%1' %2px").arg(baseFont.family()).arg(QFontInfo(baseFont).pixelSize())},
                {"@extraBig", qssifyFont(Style::getFont(Style::ExtraBig))},
                {"@big", qssifyFont(Style::getFont(Style::Big))},
                {"@bigBold", qssifyFont(Style::getFont(Style::BigBold))},
                {"@medium", qssifyFont(Style::getFont(Style::Medium))},
                {"@mediumBold", qssifyFont(Style::getFont(Style::MediumBold))},
                {"@small", qssifyFont(Style::getFont(Style::Small))},
                {"@smallLight", qssifyFont(Style::getFont(Style::SmallLight))}};
    }

    for (const QString& key : dict.keys()) {
        qss.replace(QRegularExpression(QString("%1\\b").arg(key)), dict[key]);
    }

    return qss;
}
开发者ID:Grokafar,项目名称:qTox,代码行数:37,代码来源:style.cpp

示例3: setStatus

void MyImageList::setStatus(const QMap<QUrl, int>& status)
{
    foreach (const QUrl& url, status.keys())
    {
        KPImagesListViewItem* const item = listView()->findItem(url);

        if (item)
        {
            QStringList errors;
            int         flags = status.value(url);

            if (flags & META_TIME_ERROR)
            {
                errors << i18n("Failed to update metadata timestamp");
            }

            if (flags & FILE_TIME_ERROR)
            {
                errors << i18n("Failed to update file timestamp");
            }

            if (flags & FILE_NAME_ERROR)
            {
                errors << i18n("Failed to rename file");
            }

            if (errors.isEmpty())
            {
                item->setText(STATUS, i18n("Processed without error"));
            }
            else
            {
                item->setText(STATUS, errors.join(QLatin1String(" | ")));
            }
        }
    }
}
开发者ID:IlyaSukhanov,项目名称:kipi-plugins,代码行数:37,代码来源:myimagelist.cpp

示例4: databaseColumn

QString QDjangoCompiler::databaseColumn(const QString &name)
{
    QDjangoMetaModel model = baseModel;
    QString modelName;
    QString modelPath;
    QString modelRef = referenceModel(QString(), &model, false);
    QStringList bits = name.split(QLatin1String("__"));

    while (bits.size() > 1) {
        const QByteArray fk = bits.first().toLatin1();
        QDjangoMetaModel foreignModel;
        bool foreignNullable = false;

        if (!modelPath.isEmpty())
            modelPath += QLatin1String("__");
        modelPath += bits.first();

        if (!model.foreignFields().contains(fk)) {
            // this might be a reverse relation, so look for the model
            // and if it exists continue
            foreignModel = QDjango::metaModel(fk);
            QDjangoReverseReference rev;
            const QMap<QByteArray, QByteArray> foreignFields = foreignModel.foreignFields();
            foreach (const QByteArray &foreignKey, foreignFields.keys()) {
                if (foreignFields[foreignKey] == baseModel.className()) {
                    rev.leftHandKey = foreignModel.localField(foreignKey + "_id").column();
                    break;
                }
            }

            if (rev.leftHandKey.isEmpty()) {
                qWarning() << "Invalid field lookup" << name;
                return QString();
            }
            rev.rightHandKey = foreignModel.primaryKey();
            reverseModelRefs[modelPath] = rev;
        } else {
开发者ID:gen1izh,项目名称:cpp,代码行数:37,代码来源:QDjangoQuerySet.cpp

示例5: distributeProcesses

void ProcessingManager::distributeProcesses() {
    QMutexLocker locker(&ProcessingManager::mutex_);
    
    int numJobs = ProjectPreferences().processJobs();
    setupProcessors(numJobs);
    
    //Loop over all the processors that are free
    for (int np = 0; np < numJobs; ++np) {
        ImageScriptProcessor* processor = processors_[np];
        int queueSize = queueModel_->rowCount();
        if (processor->state() == QProcess::NotRunning && queueSize > 0) {
            QMap<ProjectImage*, QStringList> next = queueModel_->nextInQueue();
            ProjectImage* image=0;
            QStringList scripts;
            if (!next.isEmpty()) {
                image = next.keys().first();
                scripts = next[image];
            }

            if (image && !scripts.isEmpty()) {
                processor->execute(image, scripts);
            }
        }
    }

    //Check if all the processors are free, if yes stop the execution
    bool running = false;
    for (ImageScriptProcessor* processor : processors_) {
        if(processor->state() == QProcess::Running || processor->state() == QProcess::Starting){
            running = true;
            break;
        }
    }
    
    if(!running) executeProcesses(false);
    
}
开发者ID:C-CINA,项目名称:2dx,代码行数:37,代码来源:ProcessingManager.cpp

示例6: QGeoSearchManagerEngine

QGeoSearchManagerEngineCm::QGeoSearchManagerEngineCm(
    const QMap<QString, QVariant> &parameters, QGeoServiceProvider::Error *error,
    QString *errorString)
        : QGeoSearchManagerEngine(parameters),
	  m_host("geocoding.cloudmade.com"),
	  m_token(QGeoServiceProviderFactoryCm::defaultToken)
{
    m_networkManager = new QNetworkAccessManager(this);

    QList<QString> keys = parameters.keys();

    if (keys.contains("places.proxy")) {
        QString proxy = parameters.value("places.proxy").toString();
        if (!proxy.isEmpty())
            m_networkManager->setProxy(QNetworkProxy(QNetworkProxy::HttpProxy, proxy, 8080));
    }

    if (keys.contains("places.host")) {
        QString host = parameters.value("places.host").toString();
        if (!host.isEmpty())
            m_host = host;
    }

    setSupportsGeocoding(true);
    setSupportsReverseGeocoding(true);

    QGeoSearchManager::SearchTypes supportedSearchTypes;
    supportedSearchTypes |= QGeoSearchManager::SearchLandmarks;
    supportedSearchTypes |= QGeoSearchManager::SearchGeocode;
    setSupportedSearchTypes(supportedSearchTypes);

    if (error)
        *error = QGeoServiceProvider::NoError;

    if (errorString)
        *errorString = "";
}
开发者ID:harbaum,项目名称:CacheMe,代码行数:37,代码来源:qgeosearchmanagerengine_cm.cpp

示例7: debug

void Mp3tunesServiceCollectionLocation::copyUrlsToCollection (
        const QMap<Meta::TrackPtr, KUrl> &sources,
        const Transcoding::Configuration &configuration )
{
    DEBUG_BLOCK
    Q_UNUSED( configuration ); // TODO: we might support transcoding here

    QStringList urls;
    QString error;
    debug() << "sources has " << sources.count();
    foreach( const Meta::TrackPtr &track, sources.keys() )
    {
        debug() << "copying " << sources[ track ] << " to mp3tunes locker";
        debug() << "file is at " << sources[ track ].pathOrUrl();

        QString supported_types = "mp3 mp4 m4a m4b m4p aac wma ogg";
        
        if( supported_types.contains( track->type() ) )
        {   

            debug() << "Added " << sources[ track ].pathOrUrl() << " to queue.";
            urls.push_back( sources[ track ].pathOrUrl() );

        } 
        else 
        {
            error = i18n( "Only the following types of tracks can be uploaded to MP3tunes: mp3, mp4, m4a, m4p, aac, wma, and ogg. " );
            debug() << "File type not supprted " << track->type();
        }
    }
    if( !error.isEmpty() )
        Amarok::Components::logger()->longMessage( error );
    Mp3tunesSimpleUploader * uploadWorker = new Mp3tunesSimpleUploader( m_collection->locker(), urls );
    connect( uploadWorker, SIGNAL(uploadComplete()), this, SLOT(slotCopyOperationFinished()) );
    ThreadWeaver::Weaver::instance()->enqueue( uploadWorker );
}
开发者ID:darthcodus,项目名称:Amarok,代码行数:36,代码来源:Mp3tunesServiceCollectionLocation.cpp

示例8: restoreSettings

//! ----------------------- restoreSettings ------------------------------------
void Equalizer_Dialog::restoreSettings()
{
    _presetList.clear();
    _comboBoxPreset->clear();

    QMap<QString, Equalizer::EqPreset> presetsEq = SETTINGS()->_presetEq;

    //! Load presets
    if ( presetsEq.isEmpty() ) {
      addDefaultPreset();
    }
    else {
      foreach (const QString& name, presetsEq.keys()) {
        addPreset( name , presetsEq[name] );
      }
    }

    //! Load selected preset
    const QString selected_preset = SETTINGS()->_currentPreset;
    const int selectedIdx = _comboBoxPreset->findText(selected_preset);

    if (selectedIdx != -1) {
      _comboBoxPreset->setCurrentIndex(selectedIdx);
      for (int i=0 ; i < Equalizer::kBands ; ++i) {
        eqSliderList[i]->setValue(_presetList[selected_preset].gain[i]);
      }
    }

    //! Load Enabled state
    _enableCheckBox->setChecked( SETTINGS()->_enableEq );
    _slider_container->setEnabled(_enableCheckBox->isChecked());

    //! signal loaded preset
    if(_enableCheckBox->isChecked())
      equalizerChanged();
}
开发者ID:RavetcoFX,项目名称:Yarock,代码行数:37,代码来源:equalizer_dialog.cpp

示例9:

QMap<QString, int> VersionFinal::getExistingOrder() const
{

	QMap<QString, int> order;
	// default
	{
		for (auto file : versionFiles)
		{
			order.insert(file->fileId, file->order);
		}
	}
	// overriden
	{
		QMap<QString, int> overridenOrder = OneSixVersionBuilder::readOverrideOrders(m_instance);
		for (auto id : order.keys())
		{
			if (overridenOrder.contains(id))
			{
				order[id] = overridenOrder[id];
			}
		}
	}
	return order;
}
开发者ID:Nightreaver,项目名称:MultiMC5,代码行数:24,代码来源:VersionFinal.cpp

示例10: buildUri

/*!
   Returns a URI that completely describes a manager implementation, datastore, and the parameters
   with which to instantiate the manager, from the given \a managerName, \a params and an optional
   \a implementationVersion.  This function is generally useful only if you intend to construct a
   manager with the \l fromUri() function, or wish to construct a contact id
   manually (for synchronization or other purposes).  Most clients will not need to use this function.
*/
QString QContactManager::buildUri(const QString &managerName, const QMap<QString, QString> &params, int implementationVersion)
{
    QString ret(QStringLiteral("qtcontacts:%1:%2"));
    // we have to escape each param
    QStringList escapedParams;
    QStringList keys = params.keys();
    for (int i=0; i < keys.size(); i++) {
        QString key = keys.at(i);
        QString arg = params.value(key);
        arg = QContactId::escapeUriParam(arg);
        key = QContactId::escapeUriParam(key);
        key = key + QLatin1Char('=') + arg;
        escapedParams.append(key);
    }

    if (implementationVersion != -1) {
        QString versionString = QString(QStringLiteral(QTCONTACTS_IMPLEMENTATION_VERSION_NAME));
        versionString += QString::fromLatin1("=");
        versionString += QString::number(implementationVersion);
        escapedParams.append(versionString);
    }

    return ret.arg(managerName, escapedParams.join(QStringLiteral("&")));
}
开发者ID:mer-packages,项目名称:qtpim,代码行数:31,代码来源:qcontactmanager.cpp

示例11: requestsDone

void MainWindow::requestsDone()
{
    switch(action) {
    case NIX:
        break;
    case CENSUS:
        break;
    case PLAYERS:
        break;
    case GUILDS:
        break;
    case TESTACHIEVE:
        QMap<int,int> acount;
        QMap<int,int> ts;
        for(Character c: ArmoryCharacter::characters) {
            qDebug() << c.achievements.size() << c.achievementsTimestamp.size() << c.name;
            for (int i=0; i<c.achievements.size(); i++) {
                int a = c.achievements[i];
                if (i==0) qDebug() << a << c.achievementsTimestamp[i];
                if (acount[a] > 0) {
                    if (ts[a] == c.achievementsTimestamp[i])
                        acount[a]++;
                } else {
                    acount[a] = 1;
                    ts[a] = c.achievementsTimestamp[i];
                }
            }
        }
        for(int a: acount.keys()) {
            if (acount[a] == 4) {
                qDebug() << Armory::achievementIndex[a];
            }
        }
        break;
    }
}
开发者ID:gpiez,项目名称:battlecrawler,代码行数:36,代码来源:mainwindow.cpp

示例12: fillComboBox

void SM_FilePanel::fillComboBox(QMap<QString, QString> accountsMap, const QString &currentAccount)
{
    QStringList keys(accountsMap.keys());

    accountsComboBox->clear();

    for(int i = 0; i < keys.count(); ++i)
    {
        QString discLetter(keys[i]);

        discLetter = discLetter.rightJustified(2,' ');
        discLetter = discLetter.leftJustified(6, ' ');

        accountsComboBox->addItem(discLetter + ACCOUNT_SEPARATOR_BEGIN + accountsMap[keys[i]] + ACCOUNT_SEPARATOR_END);
        accountsComboBox->setItemIcon(i, QIcon(QApplication::style()->standardIcon(QStyle::SP_DriveFDIcon)));

        if(currentAccount == accountsMap[keys[i]] && accountsComboBox->currentIndex() != i)
        {
            accountsComboBox->setCurrentIndex(i);
        }
    }

    accountsComboBox->setMinimumWidth(80);
}
开发者ID:AdrianBZG,项目名称:SyncMe,代码行数:24,代码来源:SM_FilePanel.cpp

示例13: AddShowPlatformsMenu

void MenuBar::AddShowPlatformsMenu(QMenu* view_menu)
{
  static const QMap<QString, bool*> platform_map{
      {tr("Show Wii"), &SConfig::GetInstance().m_ListWii},
      {tr("Show GameCube"), &SConfig::GetInstance().m_ListGC},
      {tr("Show WAD"), &SConfig::GetInstance().m_ListWad},
      {tr("Show ELF/DOL"), &SConfig::GetInstance().m_ListElfDol}};

  QActionGroup* platform_group = new QActionGroup(this);
  QMenu* plat_menu = view_menu->addMenu(tr("Show Platforms"));
  platform_group->setExclusive(false);

  for (const auto& key : platform_map.keys())
  {
    bool* config = platform_map[key];
    QAction* action = platform_group->addAction(plat_menu->addAction(key));
    action->setCheckable(true);
    action->setChecked(*config);
    connect(action, &QAction::toggled, [this, config, key](bool value) {
      *config = value;
      emit GameListPlatformVisibilityToggled(key, value);
    });
  }
}
开发者ID:t27duck,项目名称:dolphin,代码行数:24,代码来源:MenuBar.cpp

示例14: saveShortcuts

void PropertiesDialog::saveShortcuts()
{
    QMap<QString, QAction*> actions = QTerminalApp::Instance()->getWindowList()[0]->leaseActions();
    QList< QString > shortcutKeys = actions.keys();
    int shortcutCount = shortcutKeys.count();

    shortcutsWidget->setRowCount( shortcutCount );

    for( int x=0; x < shortcutCount; x++ )
    {
        QString keyValue = shortcutKeys.at(x);
        QAction *keyAction = actions[keyValue];

        QTableWidgetItem *item = shortcutsWidget->item(x, 1);
        QKeySequence sequence = QKeySequence(item->text());
        QString sequenceString = sequence.toString();

        QList<QKeySequence> shortcuts;
        foreach (sequenceString, item->text().split('|'))
            shortcuts.append(QKeySequence(sequenceString));
        keyAction->setShortcuts(shortcuts);
    }
    Properties::Instance()->saveSettings();
}
开发者ID:jubalh,项目名称:qterminal,代码行数:24,代码来源:propertiesdialog.cpp

示例15: QWidget

SpellCheckerCoreOptionsWidget::SpellCheckerCoreOptionsWidget(const SpellChecker::Internal::SpellCheckerCoreSettings * const settings, QWidget *parent) :
    QWidget(parent),
    ui(new Ui::SpellCheckerCoreOptionsWidget)
{
    ui->setupUi(this);
    /* Hide the error widget by default, since there should not be errors. */
    ui->widgetErrorOutput->setVisible(false);
    ui->toolButtonAddProject->setIcon(Utils::Icons::PLUS.icon());
    /* Manually create the correct Minus icon in the same way that the Icon
     * Utils creates the PLUS icon. The reason for this is that the PLUS
     * icon also has a PLUS_TOOLBAR icon for toolbars, but the Minus icon
     * does not have these two icons, it only has the one, and that one
     * is for the toolbar since nowhere else is a normal one needed. */
    ui->toolButtonRemoveProject->setIcon(Utils::Icon({{QLatin1String(":/utils/images/minus.png")
                                                       , Utils::Theme::PaletteText}}, Utils::Icon::Tint).icon());

    ui->comboBoxSpellChecker->addItem(QLatin1String(""));
    QMap<QString, ISpellChecker*> availableSpellCheckers = SpellCheckerCore::instance()->addedSpellCheckers();
    foreach(const QString& name, availableSpellCheckers.keys()) {
        ui->comboBoxSpellChecker->addItem(name);
    }

    updateWithSettings(settings);
}
开发者ID:Typz,项目名称:SpellChecker-Plugin,代码行数:24,代码来源:spellcheckercoreoptionswidget.cpp


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