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


C++ QStringList::find方法代码示例

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


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

示例1: if

/******************************************************************************
*  Return the descriptions of all undo or redo items, in order latest first.
*  For alarms which have undergone more than one change, only the first one is
*  listed, to force dependent undos to be executed in their correct order.
*  If 'ids' is non-null, also returns a list of their corresponding IDs.
*/
QValueList<int> Undo::ids(Undo::Type type)
{
    QValueList<int> ids;
    QStringList ignoreIDs;
    //int n=0;
    List *list = (type == UNDO) ? &mUndoList : (type == REDO) ? &mRedoList : 0;
    if(!list)
        return ids;
    for(Iterator it = list->begin();  it != list->end();  ++it)
    {
        // Check whether this item should be ignored because it is a
        // deendent undo. If not, add this item's ID to the ignore list.
        UndoItem *item = *it;
        bool omit = false;
        if(item->operation() == UndoItem::MULTI)
        {
            // If any item in a multi-undo is disqualified, omit the whole multi-undo
            QStringList newIDs;
            const Undo::List &undos = ((UndoMultiBase *)item)->undos();
            for(Undo::List::ConstIterator u = undos.begin();  u != undos.end();  ++u)
            {
                QString evid = (*u)->eventID();
                if(ignoreIDs.find(evid) != ignoreIDs.end())
                    omit = true;
                else if(omit)
                    ignoreIDs.append(evid);
                else
                    newIDs.append(evid);
            }
            if(omit)
            {
                for(QStringList::ConstIterator i = newIDs.begin();  i != newIDs.end();  ++i)
                    ignoreIDs.append(*i);
            }
        }
        else
        {
            omit = (ignoreIDs.find(item->eventID()) != ignoreIDs.end());
            if(!omit)
                ignoreIDs.append(item->eventID());
            if(item->operation() == UndoItem::EDIT)
                ignoreIDs.append(item->oldEventID());   // continue looking for its post-edit ID
        }
        if(!omit)
            ids.append(item->id());
        //else kdDebug(5950)<<"Undo::ids(): omit "<<item->actionText()<<": "<<item->description()<<endl;
    }
    //kdDebug(5950)<<"Undo::ids(): "<<n<<" -> "<<ids.count()<<endl;
    return ids;
}
开发者ID:serghei,项目名称:kde3-kdepim,代码行数:56,代码来源:undo.cpp

示例2: nextQuestionHook

void boxAsker::nextQuestionHook(const QString &division)
{
	QString otherDivision;
	QStringList auxList;
	int i;
	
	setFocus();
	for (i = 0; i < 4; i++) p_rb[i] -> setChecked(false);
	
	auxList << division;
		
	// we put the division in a random place
	p_position = (int)((float)4 * kapp -> random() / (RAND_MAX + 1.0));
	nextBoxAskerQuestionHook(division, p_position, true);
		
	// we put other 3 names
	i = 0;
	while (i < 4)
	{
		// false because boxaskers never are clickOnDivision
		otherDivision = p_map -> getRandomDivision(false);
		while (auxList.find(otherDivision) != auxList.end()) otherDivision = p_map -> getRandomDivision(false);
		if (i == p_position) i++;
		if (i < 4 && nextBoxAskerQuestionHook(otherDivision, i, false)) i++;
		auxList << otherDivision;
	}
}
开发者ID:,项目名称:,代码行数:27,代码来源:

示例3: GetIniProfileSectionNames

//-----------------------------------------------------------------------------
// 
///  DESCRIPTION: 
///		This method checks if a section is present twice in an ini file
///		and returns the list of section name
/// 
///  RETURNS: 
///		the list of section names
///                    
///  REQUIREMENT ID: NONE 
//-----------------------------------------------------------------------------
QStringList CIniFile::GetIniProfileSectionNames(bool& bDouble)
{
	QStringList sectionList;
	QString current;
	QString sDoubleList="";
	for (int line=0;line<m_StringTable.GetSize();line++)
	{
		current=m_StringTable[line];
		if (current.length())
		{
			// looks if section SecName has been found in the ini file
			if ((current[0]=='[') && (current.at(current.length()-1)==']'))
			{
				QString sSection = current.right(current.length()-1);
				
				if (sectionList.find(sSection) != sectionList.end())
					bDouble = true;
				
				sectionList += sSection;
			}
		}
	}
	
	// CDS BREAK JPM 2006/05/17 Use of ptr->fld access cannot be used in this case 
	//							the iterator is of type QStringList 
	QStringList::Iterator iter = sectionList.begin();
	while (iter != sectionList.end())
	{
		(*iter).remove("]");
		iter++;
	}
	
	return sectionList;
}
开发者ID:korusdipl,项目名称:albatross-display,代码行数:45,代码来源:IniFile.cpp

示例4: save

void KPluginSelectionWidget::save()
{
    kdDebug(702) << k_funcinfo << endl;

    for(QMap< QCheckListItem *, KPluginInfo * >::Iterator it = d->pluginInfoMap.begin(); it != d->pluginInfoMap.end(); ++it)
    {
        KPluginInfo *info = it.data();
        bool checked = it.key()->isOn();
        info->setPluginEnabled(checked);
        info->save(d->config);
        d->plugincheckedchanged[info] = false;
    }
    QStringList updatedModules;
    for(QValueList< KCModuleProxy * >::Iterator it = d->modulelist.begin(); it != d->modulelist.end(); ++it)
        if((*it)->changed())
        {
            (*it)->save();
            QStringList *names = d->moduleParentComponents[*it];
            if(names->size() == 0)
                names->append(QString::null);
            for(QStringList::ConstIterator nameit = names->begin(); nameit != names->end(); ++nameit)
                if(updatedModules.find(*nameit) == updatedModules.end())
                    updatedModules.append(*nameit);
        }
    for(QStringList::ConstIterator it = updatedModules.begin(); it != updatedModules.end(); ++it)
        emit configCommitted((*it).latin1());

    updateConfigPage();
    kdDebug(702) << "syncing config file" << endl;
    d->config->sync();
    d->changed = 0;
    emit changed(false);
}
开发者ID:,项目名称:,代码行数:33,代码来源:

示例5: Init

void FX_SetupImpl::Init(QStringList c_avail)
{
  m_config->setGroup("Effect Stack Configuration");
  QStringList conf_active = m_config->readListEntry("Activated");
  QStringList c_active;
  QStringList::Iterator sit, it;
  
  listBox_Available->clear();
  listBox_Active->clear();
  c_active.clear();
  
  pushButton_removeAll->setEnabled(false);
  
  for (sit=conf_active.begin(); sit!=conf_active.end(); ++sit){
      it = c_avail.find(*sit);
      if ( it!=c_avail.end() ){ // active plugin as per config-file in pluginlist found
          c_active.append(*sit); // append to active list
          c_avail.remove(*sit); // remove active plugin from the list of avail plugins
      }
  }
    
  if ( !c_active.isEmpty() ){
      pushButton_removeAll->setEnabled(true);
  }
  
  // Fill ListBoxes
  for(it=c_avail.begin(); it!=c_avail.end(); ++it){
    listBox_Available->insertItem( (*it), -1 );  
  }
  for(it=c_active.begin(); it!=c_active.end(); ++it){
    listBox_Active->insertItem( (*it), -1 );
  }
}
开发者ID:,项目名称:,代码行数:33,代码来源:

示例6: addSelectedToBookmarks

void MainWindow::addSelectedToBookmarks(void)
{
  QListViewItem *item = stationView->selectedItem();
  assert(item != 0);
  QStringList bookmarks = Settings::instance()->bookmarks();
  if (bookmarks.find(item->text(0)) == bookmarks.end())
  {
    bookmarks.append(item->text(0));
    Settings::instance()->setBookmarks(bookmarks);
  }
} /* MainWindow::addSelectedToBookmarks */
开发者ID:8cH9azbsFifZ,项目名称:svxlink,代码行数:11,代码来源:MainWindow.cpp

示例7: difference

QStringList PrivacyManager::difference( const QStringList & lhs, const QStringList & rhs )
{
	QStringList diff;
	const QStringList::ConstIterator lhsEnd = lhs.end();
	const QStringList::ConstIterator rhsEnd = rhs.end();
	for ( QStringList::ConstIterator lhsIt = lhs.begin(); lhsIt != lhsEnd; ++lhsIt )
	{
		if ( rhs.find( *lhsIt ) == rhsEnd )
			diff.append( *lhsIt );
	}
	return diff;
}
开发者ID:serghei,项目名称:kde3-kdenetwork,代码行数:12,代码来源:privacymanager.cpp

示例8: setupDesignerTabs

void KOIncidenceEditor::setupDesignerTabs( const QString &type )
{
  QStringList activePages = KOPrefs::instance()->activeDesignerFields();

  QStringList list = KGlobal::dirs()->findAllResources( "data",
    "korganizer/designer/" + type + "/*.ui", true, true );
  for ( QStringList::iterator it = list.begin(); it != list.end(); ++it ) {
    const QString &fn = (*it).mid( (*it).findRev('/') + 1 );
    if ( activePages.find( fn ) != activePages.end() ) {
      addDesignerTab( *it );
    }
  }
}
开发者ID:,项目名称:,代码行数:13,代码来源:

示例9: fillOrganizerCombo

void KOAttendeeEditor::fillOrganizerCombo()
{
  Q_ASSERT( mOrganizerCombo );
  // Get all emails from KOPrefs (coming from various places),
  // and insert them - removing duplicates
  const QStringList lst = KOPrefs::instance()->fullEmails();
  QStringList uniqueList;
  for( QStringList::ConstIterator it = lst.begin(); it != lst.end(); ++it ) {
    if ( uniqueList.find( *it ) == uniqueList.end() )
      uniqueList << *it;
  }
  mOrganizerCombo->insertStringList( uniqueList );
}
开发者ID:,项目名称:,代码行数:13,代码来源:

示例10: defaultUserAgent

QString KProtocolManager::defaultUserAgent(const QString &_modifiers)
{
    if(!d)
        d = new KProtocolManagerPrivate;

    QString modifiers = _modifiers.lower();
    if(modifiers.isEmpty())
        modifiers = DEFAULT_USER_AGENT_KEYS;

    if(d->modifiers == modifiers)
        return d->useragent;

    QString supp;
    struct utsname nam;
    if(uname(&nam) >= 0)
    {
        if(modifiers.contains('o'))
        {
            supp += QString("; %1").arg(nam.sysname);
            if(modifiers.contains('v'))
                supp += QString(" %1").arg(nam.release);
        }
        if(modifiers.contains('p'))
        {
            // TODO: determine this value instead of hardcoding it...
            supp += QString::fromLatin1("; X11");
        }
        if(modifiers.contains('m'))
        {
            supp += QString("; %1").arg(nam.machine);
        }
        if(modifiers.contains('l'))
        {
            QStringList languageList = KGlobal::locale()->languageList();
            QStringList::Iterator it = languageList.find(QString::fromLatin1("C"));
            if(it != languageList.end())
            {
                if(languageList.contains(QString::fromLatin1("en")) > 0)
                    languageList.remove(it);
                else
                    (*it) = QString::fromLatin1("en");
            }
            if(languageList.count())
                supp += QString("; %1").arg(languageList.join(", "));
        }
    }
    d->modifiers = modifiers;
    d->useragent = CFG_DEFAULT_UAGENT(supp);
    return d->useragent;
}
开发者ID:,项目名称:,代码行数:50,代码来源:

示例11: dir

WeatherGlobal::WeatherGlobal()
{
	QStringList serverList = QStringList::split(";", config_file.readEntry("Weather", "Servers"));
	QStringList serversUsing = QStringList::split(";", config_file.readEntry("Weather", "ServersUsing"));

	QDir dir(dataPath(WeatherConfigPath), "*.ini");
	dir.setFilter(QDir::Files);

	QStringList iniFiles;
	for (unsigned int i = 0; i < dir.count(); ++i)
		iniFiles.append(dir[i]);

	// Remove non-existent files from the server list
	//
	for (unsigned int i = 0; i < serverList.count(); ++i)
	{
		QStringList::iterator file = iniFiles.find(serverList[i]);
		if (file == iniFiles.end())
		{
			serverList.removeAt(i);
			serversUsing.removeAt(i);
		}
		else
			iniFiles.erase(file);
	}

	// Add new files to the server list
	//
	serverList += iniFiles;
	for (unsigned int i = 0; i < iniFiles.count(); ++i)
		serversUsing.append("1");

	// Load server configs and initialize server list
	//
	for (unsigned int i = 0; i < serverList.count(); ++i)
	{
		PlainConfigFile wConfig(getConfigPath(serverList[i]));
		servers_.append(Server(wConfig.readEntry("Header","Name"), serverList[i], serversUsing[i] == "1"));
	}

	// Load recent locations search list
	//
	for (unsigned int i = 0; i < RECENT_LOCATIONS_COUNT; i++)
	{
		QString city = config_file.readEntry("Weather", QString("Location%1").arg(i + 1));
		if (!city.isEmpty() && !recentLocations_.contains(city))
			recentLocations_.push_back(city);
	}

}
开发者ID:partition,项目名称:kadu,代码行数:50,代码来源:weather_global.cpp

示例12: entry

NewLanguageDialog::NewLanguageDialog(LanguageItemList &suppressedLangs,
                                     QWidget *parent, const char *name,
                                     bool modal)
    : KDialogBase(parent, name, modal, i18n("New Language"), Ok | Cancel, Ok, true)
{
    // layout the page (a combobox with label):
    QWidget *page = makeMainWidget();
    QHBoxLayout *hlay = new QHBoxLayout(page, 0, spacingHint());
    mComboBox = new QComboBox(false, page);
    hlay->addWidget(new QLabel(mComboBox, i18n("Choose &language:"), page));
    hlay->addWidget(mComboBox, 1);

    QStringList pathList = KGlobal::dirs()->findAllResources("locale",
                           QString::fromLatin1("*/entry.desktop"));
    // extract a list of language tags that should not be included:
    QStringList suppressedAcronyms;
    for(LanguageItemList::Iterator lit = suppressedLangs.begin();
            lit != suppressedLangs.end(); ++lit)
        suppressedAcronyms << (*lit).mLanguage;

    // populate the combo box:
    for(QStringList::ConstIterator it = pathList.begin();
            it != pathList.end(); ++it)
    {
        KSimpleConfig entry(*it);
        entry.setGroup("KCM Locale");
        // full name:
        QString name = entry.readEntry("Name");
        // {2,3}-letter abbreviation:
        // we extract it from the path: "/prefix/de/entry.desktop" -> "de"
        QString acronym = (*it).section('/', -2, -2);

        if(suppressedAcronyms.find(acronym) == suppressedAcronyms.end())
        {
            // not found:
            QString displayname = QString::fromLatin1("%1 (%2)")
                                  .arg(name).arg(acronym);
            QPixmap flag(locate("locale", acronym + flagPng));
            mComboBox->insertItem(flag, displayname);
        }
    }
    if(!mComboBox->count())
    {
        mComboBox->insertItem(i18n("No More Languages Available"));
        enableButtonOK(false);
    }
    else mComboBox->listBox()->sort();
}
开发者ID:serghei,项目名称:kde3-kdepim,代码行数:48,代码来源:configuredialog_p.cpp

示例13: removeSelectedFromBookmarks

void MainWindow::removeSelectedFromBookmarks(void)
{
  QListViewItem *item = stationView->selectedItem();
  assert(item != 0);
  QStringList bookmarks = Settings::instance()->bookmarks();
  QStringList::iterator it = bookmarks.find(item->text(0));
  if (it != bookmarks.end())
  {
    bookmarks.remove(it);
    Settings::instance()->setBookmarks(bookmarks);
    item = explorerView->selectedItem();
    if (item != 0)
    {
      explorerViewClicked(item);
    }    
  }
} /* MainWindow::removeSelectedFromBookmarks */
开发者ID:8cH9azbsFifZ,项目名称:svxlink,代码行数:17,代码来源:MainWindow.cpp

示例14: readProperties

void MainWindow::readProperties( KConfig *config )
{
  Core::readProperties( config );

  QStringList activePlugins = config->readListEntry( "ActivePlugins" );
  QValueList<Plugin*>::ConstIterator it = mPlugins.begin();
  QValueList<Plugin*>::ConstIterator end = mPlugins.end();
  for ( ; it != end; ++it ) {
    Plugin *plugin = *it;
    if ( !plugin->isRunningStandalone() ) {
      QStringList::ConstIterator activePlugin = activePlugins.find( plugin->identifier() );
      if ( activePlugin != activePlugins.end() ) {
        plugin->readProperties( config );
      }
    }
  }
}
开发者ID:,项目名称:,代码行数:17,代码来源:

示例15: removeDuplicateTracks

QString Playlist::removeDuplicateTracks(const QString &new_songlist)
{
    raw_songlist.remove(' ');

    QStringList curList = raw_songlist.split(",", QString::SkipEmptyParts);
    QStringList newList = new_songlist.split(",", QString::SkipEmptyParts);
    QStringList::iterator it = newList.begin();
    QString songlist;

    for (; it != newList.end(); it++)
    {
        if (curList.find(QString(*it)) == curList.end())
            songlist += "," + QString(*it);
    }
    songlist.remove(0, 1);
    return songlist;
}
开发者ID:Cougar,项目名称:mythtv,代码行数:17,代码来源:playlist.cpp


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