本文整理汇总了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;
}
示例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();
}
}
示例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 );
}
}
示例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:
//.........这里部分代码省略.........