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


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

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


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

示例1: getMATypes

PlotLine * THERM::calculateCustom (QString &p, QPtrList<PlotLine> &d)
{
  // format1: MA_TYPE, MA_PERIOD, THRESHOLD, SMOOTHING_TYPE, SMOOTHING_PERIOD

  if (checkFormat(p, d, 5, 5))
    return 0;

  QStringList mal;
  getMATypes(mal);
  maType = mal.findIndex(formatStringList[0]);
  maPeriod = formatStringList[1].toInt();
  threshold = formatStringList[2].toDouble();
  smoothType = mal.findIndex(formatStringList[3]);
  smoothing = formatStringList[4].toInt();

  QPtrList<PlotLine> pll;
  pll.setAutoDelete(FALSE);
  getTHERM(pll);

  int loop;
  for (loop = pll.count() - 1; loop > 0; loop--)
    pll.remove(loop);

  return pll.at(0);
}
开发者ID:botvs,项目名称:FinancialAnalytics,代码行数:25,代码来源:THERM.cpp

示例2: getCurrentContract

void FuturesData::getCurrentContract (QDateTime &dt, QString &cont)
{
  cont = symbol;
  bool yearFlag = FALSE;
  QStringList ml;
  getMonthList(ml);
  QStringList fml;
  getMonths(fml);

  int currentMonth = dt.date().month() - 1;

  int i = ml.findIndex(fml[currentMonth]);
  if (i != -1)
  {
    currentMonth++;
    if (currentMonth == 12)
    {
      yearFlag = TRUE;
      currentMonth = 0;
    }
  }

  if (! symbol.compare("CL") ||
      ! symbol.compare("HO") ||
      ! symbol.compare("HU") ||
      ! symbol.compare("NG"))
  {
    currentMonth++;
    if (currentMonth == 12)
    {
      yearFlag = TRUE;
      currentMonth = 0;
    }
  }

  while (1)
  {
    QString s = fml[currentMonth];
    int i = ml.findIndex(s);
    if (i != -1)
    {
      if (yearFlag)
        cont.append(QString::number(dt.date().year() + 1));
      else
        cont.append(QString::number(dt.date().year()));

      cont.append(fml[currentMonth]);
      break;
    }
    else
    {
      currentMonth++;
      if (currentMonth == 12)
      {
        yearFlag = TRUE;
        currentMonth = 0;
      }
    }
  }
}
开发者ID:DigitalPig,项目名称:qtstalker-qt4,代码行数:60,代码来源:FuturesData.cpp

示例3: parseKey

Key VCardTool::parseKey(const VCardLine &line)
{
    Key key;

    const QStringList params = line.parameterList();
    if(params.findIndex("encoding") != -1)
        key.setBinaryData(line.value().asByteArray());
    else
        key.setTextData(line.value().asString());

    if(params.findIndex("type") != -1)
    {
        if(line.parameter("type").lower() == "x509")
            key.setType(Key::X509);
        else if(line.parameter("type").lower() == "pgp")
            key.setType(Key::PGP);
        else
        {
            key.setType(Key::Custom);
            key.setCustomTypeString(line.parameter("type"));
        }
    }

    return key;
}
开发者ID:serghei,项目名称:kde3-kdelibs,代码行数:25,代码来源:vcardtool.cpp

示例4:

void
wCatalogEditor::checkUserFields( QStringList &lst)
{
	aCfgItem item = md->find(catId);
	int fid;
	if(item.isNull()) return;
	item = md->findChild(item,md_element);
	for(int i=0; i< md->count(item,md_field); i++)
  	{
		aCfgItem mdi = md->findChild(item,md_field,i);
		int ind = lst.findIndex(QString("uf%1").arg(md->attr(mdi,mda_id)));
		if(ind!=-1)
		{
			lst.insert(lst.at(i),lst[ind]);
			lst.remove(lst.at(ind+1));
			
		}
		else
		{
			ind = lst.findIndex(QString("text_uf%1").arg(md->attr(mdi,mda_id)));
			if(ind!=-1)
			{
				lst.insert(lst.at(i),lst[ind]);
				lst.remove(lst.at(ind+1));
			
			}
		}
  	}
	
}
开发者ID:app,项目名称:ananas-labs,代码行数:30,代码来源:wcatalogeditor.cpp

示例5: setZoom

void KoZoomAction::setZoom( const QString& text )
{
  bool ok = false;
  QString t = text;
  int zoom = t.remove( '%' ).toInt( &ok );
  
  // where we'll store sorted new zoom values
  QValueList<int> list;
  if( zoom > 10 ) list.append( zoom );
  
  // "Captured" non-empty sequence of digits
  QRegExp regexp("(\\d+)"); 
  
  const QStringList itemsList( items() );
  for( QStringList::ConstIterator it = itemsList.begin(); it != itemsList.end(); ++it )
  {
    regexp.search( *it );
    const int val=regexp.cap(1).toInt( &ok );
    
    //zoom : limit inferior=10
    if( ok && val>9 && list.contains( val )==0 )
      list.append( val );
  }
  
  qHeapSort( list );

  // update items with new sorted zoom values
  QStringList values;
  for (QValueList<int>::Iterator it = list.begin(); it != list.end(); ++it )
    values.append( i18n("%1%").arg(*it) );
  setItems( values );
  
  QString zoomStr = i18n("%1%").arg( zoom );
  setCurrentItem( values.findIndex( zoomStr ) );
}
开发者ID:,项目名称:,代码行数:35,代码来源:

示例6: getCategories

const QStringList XineConfig::getCategories()
{
	QStringList cats;
	xine_cfg_entry_t* ent = new xine_cfg_entry_t;
	if (!xine_config_get_first_entry(m_xine, ent))
		return cats;
	QString entCat;

	do
	{
		entCat = QString(ent->key);
		entCat = entCat.left(entCat.find("."));
		if (cats.findIndex(entCat) == -1)
		{
			// kdDebug() << "XineConfig: new category: " << entCat << endl;
			cats.append(entCat);
		}
		delete ent;
		ent = new xine_cfg_entry_t;

	}
	while(xine_config_get_next_entry(m_xine, ent));

	delete ent;
	return cats;
}
开发者ID:iegor,项目名称:kdesktop,代码行数:26,代码来源:xineconfig.cpp

示例7: check_unique

bool KeyValuesTable::check_unique()
{
    forceUpdateCells();

    unsigned n = numRows();

    if (n != 0) {
        unsigned index;

        if (text(n - 1, 0).isEmpty())
            n -= 1;

        QStringList l;

        for (index = 0; index != n; index += 1) {
            const QString & s = text(index, 0);

            if (l.findIndex(s) != -1) {
                msg_critical(TR("Error"), TR("key '%1' used several times", s));
                return FALSE;
            }
            else
                l.append(s);
        }
    }

    return TRUE;
}
开发者ID:mobius3,项目名称:douml,代码行数:28,代码来源:KeyValueTable.cpp

示例8: createDir

bool UpgradeMessage::createDir (QString &p)
{
  QString path = p;
  int t = path.find("/data0/", 0, TRUE);
  path.replace(t + 5, 1, "1");
  
  QStringList l = QStringList::split("/", path, FALSE);
  int loop = l.findIndex(".qtstalker");
  loop = loop + 2;
  for (; loop < (int) l.count() - 1; loop++)
  {
    QString s;
    int loop2;
    for (loop2 = 0; loop2 <= loop; loop2++)
      s.append("/" + l[loop2]);

    QDir dir(s);
    if (! dir.exists(s, TRUE))
    {
      if (! dir.mkdir(s, TRUE))
      {
        qDebug("UpgradeMessage::createDir: error %s", s.latin1());
        return TRUE;
      }
    }
  }

  return FALSE;
}
开发者ID:botvs,项目名称:FinancialAnalytics,代码行数:29,代码来源:UpgradeMessage.cpp

示例9: parseAgent

Agent VCardTool::parseAgent(const VCardLine &line)
{
    Agent agent;

    const QStringList params = line.parameterList();
    if(params.findIndex("value") != -1)
    {
        if(line.parameter("value").lower() == "uri")
            agent.setUrl(line.value().asString());
    }
    else
    {
        QString str = line.value().asString();
        str.replace("\\n", "\r\n");
        str.replace("\\N", "\r\n");
        str.replace("\\;", ";");
        str.replace("\\:", ":");
        str.replace("\\,", ",");

        const Addressee::List list = parseVCards(str);
        if(list.count() > 0)
        {
            Addressee *addr = new Addressee;
            *addr = list[0];
            agent.setAddressee(addr);
        }
    }

    return agent;
}
开发者ID:serghei,项目名称:kde3-kdelibs,代码行数:30,代码来源:vcardtool.cpp

示例10: addResource

void ResourceView::addResource()
{
  bool ok = false;
  KCal::CalendarResourceManager *manager = mCalendar->resourceManager();
  ResourceItem *i = static_cast<ResourceItem*>( mListView->selectedItem() );
  if ( i && ( i->isSubresource() || i->resource()->canHaveSubresources() ) ) {
    const QString folderName = KInputDialog::getText( i18n( "Add Subresource" ),
            i18n( "Please enter a name for the new subresource" ), QString::null,
            &ok, this );
    if ( !ok )
      return;
    const QString parentId = i->isSubresource() ? i->resourceIdentifier() : QString:: null;
    if ( !i->resource()->addSubresource( folderName, parentId ) ) {
      KMessageBox::error( this, i18n("<qt>Unable to create subresource <b>%1</b>.</qt>")
                                .arg( folderName ) );
    }
    return;
  }

  QStringList types = manager->resourceTypeNames();
  QStringList descs = manager->resourceTypeDescriptions();
  QString desc = KInputDialog::getItem( i18n( "Resource Configuration" ),
      i18n( "Please select type of the new resource:" ), descs, 0, false, &ok,
            this );
  if ( !ok )
    return;

  QString type = types[ descs.findIndex( desc ) ];

  // Create new resource
  ResourceCalendar *resource = manager->createResource( type );
  if( !resource ) {
    KMessageBox::error( this, i18n("<qt>Unable to create resource of type <b>%1</b>.</qt>")
                              .arg( type ) );
    return;
  }

  resource->setResourceName( i18n("%1 resource").arg( type ) );

  KRES::ConfigDialog *dlg = new KRES::ConfigDialog( this, QString("calendar"), resource,
                          "KRES::ConfigDialog" );

  if ( dlg && dlg->exec() ) {
    resource->setTimeZoneId( KOPrefs::instance()->mTimeZoneId );
    if ( resource->isActive() ) {
      resource->open();
      resource->load();
    }
    manager->add( resource );
    // we have to call resourceAdded manually, because for in-process changes
    // the dcop signals are not connected, so the resource's signals would not
    // be connected otherwise
    mCalendar->resourceAdded( resource );
  } else {
    delete resource;
    resource = 0;
  }
  if ( dlg ) delete dlg;
  emitResourcesChanged();
}
开发者ID:,项目名称:,代码行数:60,代码来源:

示例11: selectMixer

/**
 * Opens a dialog box with all available mixers and let the user choose one.
 * If the user selects a mixer, "_mixer" will be set and positionChange() is called.
 */
void KMixApplet::selectMixer()
{
   QStringList lst;

   int n=1;
   for (Mixer *mixer=Mixer::mixers().first(); mixer!=0; mixer=Mixer::mixers().next())
   {
      QString s;
      s.sprintf("%i. %s", n, mixer->mixerName().ascii());
      lst << s;
      n++;
   }

   bool ok = FALSE;
   QString res = KInputDialog::getItem( i18n("Mixers"),
                                        i18n("Available mixers:"),
					lst, 1, FALSE, &ok, this );
   if ( ok )
   {
      Mixer *mixer = Mixer::mixers().at( lst.findIndex( res ) );
      if (!mixer)
         KMessageBox::sorry( this, i18n("Invalid mixer entered.") );
      else
      {
         delete m_errorLabel;
         m_errorLabel = 0;

	 _mixer = mixer;
	 // Create the ViewApplet by calling positionChange() ... :)
	 // To take over reversedDir and (more important) to create the mixer widget
	 // if necessary!
	 positionChange(position());
      }
   }
}
开发者ID:serghei,项目名称:kde3-kdemultimedia,代码行数:39,代码来源:kmixapplet.cpp

示例12: logFile

void
CollectionScanner::doJob() //SLOT
{
    std::cout << "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>";
    std::cout << "<scanner>";


    QStringList entries;

    if( m_restart ) {
        QFile logFile( m_logfile );
        logFile.open( IO_ReadOnly );
        QString lastFile = logFile.readAll();

        QFile folderFile( amaroK::saveLocation( QString::null ) + "collection_scan.files"   );
        folderFile.open( IO_ReadOnly );
        entries = QStringList::split( "\n", folderFile.readAll() );

        for( int count = entries.findIndex( lastFile ) + 1; count; --count )
            entries.pop_front();

//         debug() << "Restarting at: " << entries.front() << endl;
    }
    else {
        foreachType( QStringList, m_folders ) {
            if( (*it).isEmpty() )
                //apparently somewhere empty strings get into the mix
                //which results in a full-system scan! Which we can't allow
                continue;

            QString dir = *it;
            if( !dir.endsWith( "/" ) )
                dir += '/';

            readDir( dir, entries );
        }

        QFile folderFile( amaroK::saveLocation( QString::null ) + "collection_scan.files"   );
        folderFile.open( IO_WriteOnly );
        QTextStream stream( &folderFile );
        stream << entries.join( "\n" );
        folderFile.close();
    }

    if( !entries.isEmpty() ) {
        if( !m_restart ) {
            AttributeMap attributes;
            attributes["count"] = QString::number( entries.count() );
            writeElement( "itemcount", attributes );
        }

        scanFiles( entries );
    }

    std::cout << "</scanner>" << std::endl;

    quit();
}
开发者ID:tmarques,项目名称:waheela,代码行数:58,代码来源:collectionscanner.cpp

示例13: type

QString type(const QString & t, const QStringList & types,
             BrowserNodeList & nodes)
{
    int rank = types.findIndex(t);

    return (rank != -1)
           ? QString(((BrowserClass *) nodes.at(rank))->get_name())
           : t;
}
开发者ID:harmegnies,项目名称:douml,代码行数:9,代码来源:DialogUtil.cpp

示例14: selectObject

int PMObjectSelect::selectObject( PMObject* link,
                                  const QStringList& t,
                                  PMObject* & obj, QWidget* parent )
{
   PMObject* last = link;
   PMObject* scene;
   bool stop = false;
   bool found = false;
   
   do
   {
      scene = last->parent( );
      if( scene )
      {
         if( scene->type( ) == "Scene" )
         {
            last = last->prevSibling( );
            stop = true;
            found = true;
         }
         else
            last = last->parent( );
      }
      else
         stop = true;
   }
   while( !stop );
   
   if( found )
   {
      PMObjectSelect s( parent );

      PMObject* o = scene->firstChild( );
      bool l = false;
      
      while( o && !l && last )
      {
         if( t.findIndex( o->type( ) ) >= 0 )
            s.m_pListBox->insertItem( new PMListBoxObject( o ) );
         
         if( o == last )
            l = true;
         else
            o = o->nextSibling( );
      }
   
      int result = s.exec( );
      if( result == Accepted )
         obj = s.selectedObject( );
      
      return result;
   }
   else
      kdError( PMArea ) << "PMObjectSelect: Link does not seem to be correctly inserted in the scene.\n";
   return Rejected;
}
开发者ID:,项目名称:,代码行数:56,代码来源:

示例15: parseSound

Sound VCardTool::parseSound(const VCardLine &line)
{
    Sound snd;

    const QStringList params = line.parameterList();
    if(params.findIndex("encoding") != -1)
        snd.setData(line.value().asByteArray());
    else if(params.findIndex("value") != -1)
    {
        if(line.parameter("value").lower() == "uri")
            snd.setUrl(line.value().asString());
    }

    /* TODO: support sound types
      if ( params.contains( "type" ) )
        snd.setType( line.parameter( "type" ) );
    */

    return snd;
}
开发者ID:serghei,项目名称:kde3-kdelibs,代码行数:20,代码来源:vcardtool.cpp


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