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


C++ QStrList::count方法代码示例

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


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

示例1: cddb_playlist_encode

void cddb_playlist_encode(QStrList& list,QString& playstr){

    playstr = "";
    for( uint i = 0; i < list.count(); i++){
	playstr += list.at(i);
	if(i < list.count() -1)
	    playstr += ",";
    }
}
开发者ID:kthxbyte,项目名称:KDE1-Linaro,代码行数:9,代码来源:cddb.cpp

示例2: queryCD

void CDDB::queryCD(unsigned long _magicID,QStrList& querylist)
{
//    if(state == DO_NOTHING)
//        return;
//    state = DO_NOTHING;
    if((sock == 0L || sock->socket() < 0) && protocol==CDDBP)
	return;

    QString str;
    title = "";
    category = "";
    magicID = _magicID;

    str = str.sprintf("cddb query %08lx %u ",magicID,querylist.count()-1);
    for(int i = 0; i <(int) querylist.count(); i++) 
    {
	str += querylist.at(i);
	str += " ";
    }

    if(protocol==CDDBHTTP)
    {
	cddb_connect_internal();
	if(connected)
	{
	    QString param = str;
	    send_http_command(param);
	    if(use_http_proxy)
	    {
		saved_state = QUERY;
		state       = HTTP_REQUEST;
	    } else {
		state  = QUERY;
	    }
	}
    }
    else
    {
	// CDDB
	timeouttimer.stop();
	timeouttimer.start(timeout*1000,TRUE);
	str += "\n";
	if(debugflag)
		fprintf(stderr, "strdata: %s\n", str.data());
	write(sock->socket(),str.data(),str.length());
        state  = QUERY;
    }

  
}
开发者ID:kthxbyte,项目名称:KDE1-Linaro,代码行数:50,代码来源:cddb.cpp

示例3: slotCopyClients

void KFMServer::slotCopyClients( const char *_src_urls, const char *_dest_url )
{
    QString s = _src_urls;
    s.detach();
    QStrList urlList;

    QString dest = _dest_url;
    if ( dest == "trash:/" )
        dest = "file:" + KFMPaths::TrashPath();

    int i;
    while ( ( i = s.find( "\n" ) ) != -1 )
    {
        QString t = s.left( i );
        urlList.append( t.data() );
        s = s.mid( i + 1, s.length() );
    }

    urlList.append( s.data() );

    KIOJob *job = new KIOJob();
    if ( urlList.count() == 1 )
        job->copy( urlList.first(), dest.data() );
    else
        job->copy( urlList, dest.data() );
}
开发者ID:xwizard,项目名称:kde1,代码行数:26,代码来源:kfmserver.cpp

示例4: slotMove

void KFMClient::slotMove( const char *_src_urls, const char *_dest_url )
{
    QString s = _src_urls;
    s.detach();
    QStrList urlList;

    QString dest = _dest_url;
    if ( dest == "trash:/" )
        dest = "file:" + KFMPaths::TrashPath();

    int i;
    while ( ( i = s.find( "\n" ) ) != -1 )
    {
        QString t = s.left( i );
        urlList.append( t.data() );
        s = s.mid( i + 1, s.length() );
    }

    urlList.append( s.data() );

    KIOJob *job = new KIOJob();
    connect( job, SIGNAL( finished( int ) ), this, SLOT( finished( int ) ) );
    if ( urlList.count() == 1 )
        job->move( urlList.first(), dest.data() );
    else
        job->move( urlList, dest.data() );
}
开发者ID:xwizard,项目名称:kde1,代码行数:27,代码来源:kfmserver.cpp

示例5: QObject

KIconTemplateContainer::KIconTemplateContainer() : QObject()
{
  QString path;
  instances++;
  debug("KIconTemplateContainer: instances %d", instances);
  if(templatelist)
    return;

  debug("KIconTemplateContainer: Creating templates");

  templatelist = new QList<KIconTemplate>;
  templatelist->setAutoDelete(true);

  QStrList names;
  KConfig *k = kapp->getConfig();
  k->setGroup("Templates");
  k->readListEntry("Names", names);
  for(int i = 0; i < (int)names.count(); i++)
  {
    KIconTemplate *it = new KIconTemplate;
    it->path = k->readEntry(names.at(i));
    it->title = names.at(i);
    //debug("Template: %s\n%s", names.at(i), path.data());
    templatelist->append(it);
  }

  if(templatelist->count() == 0)
  {
    createStandardTemplates(templatelist);
  }
}
开发者ID:kthxbyte,项目名称:KDE1-Linaro,代码行数:31,代码来源:knew.cpp

示例6: cddb_playlist_decode

bool cddb_playlist_decode(QStrList& list, QString& str){
 
    bool isok = true;
    int pos1, pos2;
    pos1 = 0;
    pos2 = 0;

    list.clear();

    while((pos2 = str.find(",",pos1,true)) != -1){

	if(pos2 > pos1){
	    list.append(str.mid(pos1,pos2 - pos1));
	}
    
	pos1 = pos2 + 1;
    }
  
    if(pos1 <(int) str.length())
	list.append(str.mid(pos1,str.length()));

    QString check;
    bool 	ok1;
    int   num;

    for(uint i = 0; i < list.count(); i++){
	check = list.at(i);
	check = check.stripWhiteSpace();

	if(check.isEmpty()){
	    list.remove(i);
	    i--;
	    continue;
	}

	if(check == QString (",")){
	    list.remove(i);
	    i--;
	    continue;
	}
    
	num = check.toInt(&ok1);
	if(!ok1 || num < 1){
	    list.remove(i);
	    i--;
	    isok = false;
	    continue;
	}
    
	list.remove(i);
	list.insert(i, check);

    }

    /*  for(uint i = 0; i < list.count(); i++){
	printf("playlist %d=%s\n",i,list.at(i));
	}*/
    return isok;
}
开发者ID:kthxbyte,项目名称:KDE1-Linaro,代码行数:59,代码来源:cddb.cpp

示例7: clearAlignList

static void clearAlignList( QStrList &l )
{
    if ( l.count() == 1 )
	return;
    if ( l.find( "AlignAuto" ) != -1 )
	l.remove( "AlignAuto" );
    if ( l.find( "WordBreak" ) != -1 )
	l.remove( "WordBreak" );
}
开发者ID:nanzhang790,项目名称:View3dn,代码行数:9,代码来源:xmlpropertylist.cpp

示例8: setValues

bool StringListSelectSetDialog::setValues(const QStrList& values)
{
  // ############################################################################
  lbStrings->clear();
  lbStrings->insertStrList(&values);
  assert(lbStrings->count()==values.count());
  return true;
  // ############################################################################
}
开发者ID:kthxbyte,项目名称:KDE1-Linaro,代码行数:9,代码来源:StringListSelectSetDialog.cpp

示例9: matchExcludedSymbols

static bool matchExcludedSymbols(const char *name)
{
  static QStrList exclSyms;
  if (exclSyms.count()==0) return FALSE; // nothing specified
  const char *pat = exclSyms.first();
  QCString symName = name;
  while (pat)
  {
    QCString pattern = pat;
    bool forceStart=FALSE;
    bool forceEnd=FALSE;
    if (pattern.at(0)=='^') 
      pattern=pattern.mid(1),forceStart=TRUE;
    if (pattern.at(pattern.length()-1)=='$') 
      pattern=pattern.left(pattern.length()-1),forceEnd=TRUE;
    if (pattern.find('*')!=-1) // wildcard mode
    {
      QRegExp re(substitute(pattern,"*",".*"),TRUE);
      int i,pl;
      i = re.match(symName,0,&pl);
      //printf("  %d = re.match(%s) pattern=%s\n",i,symName.data(),pattern.data());
      if (i!=-1) // wildcard match
      {
        int sl=symName.length();
        // check if it is a whole word match
        if ((i==0     || pattern.at(0)=='*'    || (!isId(symName.at(i-1))  && !forceStart)) &&
            (i+pl==sl || pattern.at(i+pl)=='*' || (!isId(symName.at(i+pl)) && !forceEnd))
           )
        {
          //printf("--> name=%s pattern=%s match at %d\n",symName.data(),pattern.data(),i);
          return TRUE;
        }
      }
    }
    else if (!pattern.isEmpty()) // match words
    {
      int i = symName.find(pattern);
      if (i!=-1) // we have a match!
      {
        int pl=pattern.length();
        int sl=symName.length();
        // check if it is a whole word match
        if ((i==0     || (!isId(symName.at(i-1))  && !forceStart)) &&
            (i+pl==sl || (!isId(symName.at(i+pl)) && !forceEnd))
           )
        {
          //printf("--> name=%s pattern=%s match at %d\n",symName.data(),pattern.data(),i);
          return TRUE; 
        }
      }
    }
    pat = exclSyms.next();
  }
  //printf("--> name=%s: no match\n",name);
  return FALSE;
}
开发者ID:kevinoupeng,项目名称:mydg,代码行数:56,代码来源:definition.cpp

示例10: setValues

bool StringListSelectAndReorderSet::setValues(const QStrList& values)
{ 
  // ############################################################################
  int index;
  // -----
  possible.erase(possible.begin(), possible.end());
  selected.erase(selected.begin(), selected.end());
  lbPossible->clear();
  lbSelected->clear();
  lbPossible->insertStrList(&values);
  assert(values.count()==lbPossible->count());
  // -----
  for(index=0; (unsigned)index<values.count(); index++)
    {
      possible.push_back(index);
    }
  assert(values.count()==possible.size()); 
  enableButtons(0);
  return false; 
  // ############################################################################
}
开发者ID:kthxbyte,项目名称:KDE1-Linaro,代码行数:21,代码来源:StringListSelectAndReorderSet.cpp

示例11: contentsDropEvent

void DirectoryView::contentsDropEvent( QDropEvent *e )
{
    autoopen_timer->stop();

    if ( !QUriDrag::canDecode(e) ) {
        e->ignore();
        return;
    }

    QListViewItem *item = itemAt( contentsToViewport(e->pos()) );
    if ( item ) {

        QStrList lst;

        QUriDrag::decode( e, lst );

        QString str;

        switch ( e->action() ) {
            case QDropEvent::Copy:
            str = "Copy";
            break;
            case QDropEvent::Move:
            str = "Move";
            e->acceptAction();
            break;
            case QDropEvent::Link:
            str = "Link";
            e->acceptAction();
            break;
            default:
            str = "Unknown";
        }

        str += "\n\n";

        e->accept();

        for ( uint i = 0; i < lst.count(); ++i ) {
            QString filename = lst.at( i );
            str += filename + "\n";
        }
        str += QString( "\nTo\n\n   %1" )
               .arg( fullPath(item) );

        QMessageBox::information( this, "Drop target", str, "Not implemented" );
    } else
        e->ignore();

}
开发者ID:BackupTheBerlios,项目名称:kinneret,代码行数:50,代码来源:dirview.cpp

示例12: slotProperties

void KfmView::slotProperties()
{
	QStrList popupFiles = new QStrList();
	getActiveView()->getSelected ( popupFiles );
	if ( popupFiles.isEmpty() && popupMenuEvent )
	{
		popupFiles.append ( getURL() );
	}
    if ( popupFiles.count() != 1 )
    {
	warning(klocale->translate("ERROR: Can not open properties for multiple files"));
	return;
    }

    (void)new Properties( popupFiles.first() );
}
开发者ID:kthxbyte,项目名称:KDE1-Linaro,代码行数:16,代码来源:kfmview.cpp

示例13: it

void K2sendPlayList::write(KConfig * config,k2sendWidget * w)
{
    QListViewItemIterator it( this );
    QStrList list;
    int cnt = 0;
    int total = list.count();
    while ( it.current() ) {
        K2sendPlayListItem *item =(K2sendPlayListItem*) it.current();
        list.append(item->file().latin1());
        ++it;
        cnt++;
        w->setProgress( int((100.0 / total) * cnt));
    }
    config->setGroup("playlist");
    config->writeEntry ("files",list);
    config->sync();
}
开发者ID:BackupTheBerlios,项目名称:k2send-svn,代码行数:17,代码来源:k2sendplaylist.cpp

示例14: dropEvent

void TEWidget::dropEvent(QDropEvent* event)
{
#if 0
    // The current behaviour when URL(s) are dropped is:
    // * if there is only ONE URL and if it's a LOCAL one, ask for paste or cd
    // * in all other cases, just paste
    //   (for non-local ones, or for a list of URLs, 'cd' is nonsense)
  QStrList strlist;
  int file_count = 0;
  dropText = "";
  bool bPopup = true;

  if(QUriDrag::decode(event, strlist)) {
    if (strlist.count()) {
      for(const char* p = strlist.first(); p; p = strlist.next()) {
        if(file_count++ > 0) {
          dropText += " ";
          bPopup = false; // more than one file, don't popup
        }

/*
        KURL url(p);
        if (url.isLocalFile()) {
          dropText += url.path(); // local URL : remove protocol
        }
        else {
          dropText += url.prettyURL();
          bPopup = false; // a non-local file, don't popup
        }
*/

      }

      if (bPopup)
        // m_drop->popup(pos() + event->pos());
  //m_drop->popup(mapToGlobal(event->pos())); // reserve
      else
  {
    if (currentSession) {
      currentSession->getEmulation()->sendString(dropText.local8Bit());
    }
//    kdDebug() << "Drop:" << dropText.local8Bit() << "\n";
  }
    }
  }
  else if(QTextDrag::decode(event, dropText)) {
开发者ID:descent,项目名称:qtermwidget,代码行数:46,代码来源:TEWidget.cpp

示例15: onDrop

void TEDemo::onDrop( KDNDDropZone* _zone )
{
    // The current behaviour when url(s) are dropped is
    // * if there is only ONE url and if it's a LOCAL one, ask for paste or cd
    // * in all other cases, just paste
    //   (for non-local ones, or for a list of URLs, 'cd' is nonsense)
  QStrList strlist;
  KURL *url;
  int file_count = 0;
  char *p;
  dropText = "";
  bool bPopup = true;

  strlist = _zone->getURLList();
  if (strlist.count())
  {
    p = strlist.first();
    while(p != 0)
    {
      if(file_count++ > 0)
      {
        dropText += " ";
        bPopup = false; // more than one file, don't popup
      }
      url = new KURL( p );
      if (!strcmp(url->protocol(),"file"))
      {
        dropText += url->path(); // local URL : remove protocol
      }
      else
      {
        dropText += p;
        bPopup = false; // a non-local file, don't popup
      }
      delete url;
      p = strlist.next();
    }
    if (bPopup)
        m_drop->popup(QPoint(_zone->getMouseX(),_zone->getMouseY()));
    else
        se->getEmulation()->sendString(dropText.data());
  }
}
开发者ID:xwizard,项目名称:kde1,代码行数:43,代码来源:main.C


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