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


C++ QListViewItem::childCount方法代码示例

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


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

示例1: getBackupFiles

/***
 * Get a list of all of the files to backup.
 */
int BackupAndRestore::getBackupFiles(QString &backupFiles, QListViewItem *parent)
{
    QListViewItem * currentItem;
    QString currentHome;
    if(!parent)
        currentItem = backupList->firstChild();
    else
    {
        currentItem = parent->firstChild();
        currentHome = parent->text(BACKUP_LOCATION);
    }

    uint count = 0;
    while( currentItem != 0 )
    {
        if(currentItem->text(HEADER_BACKUP) == "B" )
        {
            if(currentItem->childCount() == 0 )
            {
                if(parent == NULL)
                    backupFiles += currentItem->text(BACKUP_LOCATION);
                else
                    backupFiles += currentHome + currentItem->text(HEADER_NAME);
                backupFiles += " ";
                count++;
            }
            else
            {
                count += getBackupFiles(backupFiles, currentItem);
            }
        }
        currentItem = currentItem->nextSibling();
    }
    return count;
}
开发者ID:opieproject,项目名称:opie,代码行数:38,代码来源:backuprestore.cpp

示例2: loadChildren

void PlaylistSelection::loadChildren( QListViewItem* browserParent, QListViewItem* selectionParent )
{
    QListViewItem* browserChild = browserParent->firstChild();

    while( browserChild )
    {
        SelectionListItem* selectionChild = new SelectionListItem( selectionParent, browserChild->text(0), browserChild );
        if ( browserChild->pixmap(0) )
            selectionChild->setPixmap( 0, *browserChild->pixmap(0) );

        if( browserChild->childCount() > 0 )
            loadChildren( browserChild, selectionChild );

        browserChild = browserChild->nextSibling();
    }
}
开发者ID:tmarques,项目名称:waheela,代码行数:16,代码来源:playlistselection.cpp

示例3: while

void Kleo::KeyListView::scatterGathered( QListViewItem * start ) {
  QListViewItem * item = start;
  while ( item ) {
    QListViewItem * cur = item;
    item = item->nextSibling();

    scatterGathered( cur->firstChild() );
    assert( cur->childCount() == 0 );

    // ### todo: optimize by suppressing removing/adding the item to the itemMap...
    if ( cur->parent() )
      cur->parent()->takeItem( cur );
    else
      takeItem( cur );
    insertItem( cur );
  }
}
开发者ID:,项目名称:,代码行数:17,代码来源:

示例4: ProcMessage

void servercontroller::ProcMessage(QString server, int command, QString args)
{
  QListViewItem *serverItem = 0L;
  QListViewItem *item = ConnectionTree->firstChild();
  while ( item ) {
      if ( !item->parent() && item->text(0) == server ) {
	  serverItem = item;
	  break;
      }
      item = item->nextSibling();
  }

  if ( !serverItem ) {
      kdDebug(5008) << "* ProcMessage for non-existant server?! - " << server<< endl;
      return;
  }


  switch(command){


    // Nick offline and online both remove the nick first.
    // We remove the nick in case of an online so that we don't get
    // duplicates.
    // Args == nick comming on/offline.
  case ProcCommand::nickOffline:
      {
          QListViewItem *online_item = findChild(serverItem, i18n("Online"));
          if(online_item){
              item = findChild(online_item, args);
              delete item;
              if(online_item->childCount() == 0)
                  delete online_item;
              if(ksopts->runDocked && ksopts->dockPopups)
                  KPassivePopup::message(i18n("%1 just went offline on %2").arg(args).arg(server), dockWidget);
          }
          dockWidget->nickOffline(server, args);
          break;
      }
  case ProcCommand::nickOnline:
      {
          QListViewItem *online_item = findChild(serverItem, i18n("Online"));
          if(!online_item){
              online_item = new QListViewItem(serverItem, i18n("Online"));
              online_item->setPixmap( 0, pic_gf );
              online_item->setOpen( true );
          }
          else {
              item = findChild(online_item, args);
              if( item ){
                  delete item;
              }
          }
          item = new QListViewItem(online_item, args);
	  item->setPixmap( 0, pic_run );
	  if(ksopts->runDocked && ksopts->dockPopups)
	      KPassivePopup::message(i18n("%1 just came online on %2").arg(args).arg(server), dockWidget);
          dockWidget->nickOnline(server, args);
          break;
      }
      /*
    // Add new channel, first add the parent to the path
    path.push(&server);
    path.push(&online);
    path.push(&args);
    // Remove old one if it's there
    ConnectionTree->removeItem(&path); // Remove the item
    path.pop();
    // add a new child item with parent as its parent
    ConnectionTree->addChildItem(args, pic_run, &path);
    if (kSircConfig->BeepNotify) {
      KNotifyClient::beep();
    }
    break;
    */

    /**
      *  Args:
      *	   parent: the server name that the new channel is being joined on
      *    child:  the new channel name
      *  Action:
      *    Adds "child" to the list of joined channles in the main
      *    window.  Always call this on new window creation!
      */
  case ProcCommand::addTopLevel:
    // Add new channel
    if(args[0] == '!')
      args.remove(0, 1); // If the first char is !, it's control, remove it
    // add a new child item with parent as it's parent
    item = new QListViewItem( serverItem, args );
    item->setPixmap( 0, pic_ppl );

    open_toplevels++;
    break;
    /**
      *  Args:
      *    parent: the server name of which channel is closing
      *	   child: the channle that is closing. IFF Emtpy, parent is
      *	   deleted.
      *  Action:
//.........这里部分代码省略.........
开发者ID:serghei,项目名称:kde3-kdenetwork,代码行数:101,代码来源:servercontroller.cpp


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