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


C++ KviPointerList::at方法代码示例

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


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

示例1: deleteCurrent

void LogViewWindow::deleteCurrent()
{
	LogListViewItem * pItem = (LogListViewItem *)(m_pListView->currentItem());
	if(!pItem)
		return;

	if(!pItem->childCount())
	{
		if(!pItem->fileName().isNull())
		{
			if(QMessageBox::question(
				this,
				__tr2qs_ctx("Confirm Current User Log Deletion","log"),
				__tr2qs_ctx("Do you really wish to delete this log?","log"),
				__tr2qs("Yes"),__tr2qs("No"),0,1) != 0)
				return;

			KviFileUtils::removeFile(pItem->fileName());
			delete pItem;
			m_pIrcView->clearBuffer();
			if(!pItem->parent()->childCount())
				delete pItem->parent();
		}
		return;
	}

	if(QMessageBox::question(
		this,
		__tr2qs_ctx("Confirm Current User Logs Deletion","log"),
		__tr2qs_ctx("Do you really wish to delete all these logs?","log"),
		__tr2qs("Yes"),__tr2qs("No"),0,1) != 0)
		return;
	KviPointerList<LogListViewItem> itemsList;
	itemsList.setAutoDelete(false);
	for(int i=0; i < pItem->childCount(); i++)
	{
		if(!pItem->child(i)->childCount())
		{
			itemsList.append((LogListViewItem *)pItem->child(i));
			continue;
		}
		LogListViewItem * pChild = (LogListViewItem *)pItem->child(i);
		for(int j=0; j < pChild->childCount(); j++)
		{
			if(!(LogListViewItem *)pChild->child(j))
			{
				qDebug("Null pointer in logviewitem");
				continue;
			}
			itemsList.append((LogListViewItem *)pChild->child(j));
		}
	}
	for(unsigned int u=0; u < itemsList.count(); u++)
	{
		LogListViewItem * pCurItem = itemsList.at(u);
		if(!pCurItem->fileName().isNull())
			KviFileUtils::removeFile(pCurItem->fileName());
	}
	delete pItem;
}
开发者ID:philouvb,项目名称:KVIrc,代码行数:60,代码来源:LogViewWindow.cpp

示例2: exportLog

void LogViewWindow::exportLog(int iId)
{
	LogListViewItem * pItem = (LogListViewItem *)(m_pListView->currentItem());
	if(!pItem)
		return;

	if(!pItem->childCount())
	{
		// Export the log
		createLog(pItem->log(), iId);
		return;
	}

	// We selected a node in the log list, scan the children
	KviPointerList<LogListViewItem> logList;
	logList.setAutoDelete(false);
	for(int i = 0; i < pItem->childCount(); i++)
	{
		if(!pItem->child(i)->childCount())
		{
			// The child is a log file, append it to the list
			logList.append((LogListViewItem *)pItem->child(i));
			continue;
		}

		// The child is a node, scan it
		LogListViewItem * pChild = (LogListViewItem *)pItem->child(i);
		for(int j=0; j < pChild->childCount(); j++)
		{
			if(!(LogListViewItem *)pChild->child(j))
			{
				qDebug("Null pointer in logviewitem");
				continue;
			}

			// Add the child to the list
			logList.append((LogListViewItem *)pChild->child(j));
		}
	}

	// Scan the list
	for(unsigned int u = 0; u < logList.count(); u++)
	{
		LogListViewItem * pCurItem = logList.at(u);
		createLog(pCurItem->log(), iId);
	}
}
开发者ID:philouvb,项目名称:KVIrc,代码行数:47,代码来源:LogViewWindow.cpp


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