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


C++ ProjectViewItem::text方法代码示例

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


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

示例1: folder

ProjectViewItem* ProjectView::folder(const KileProjectItem *pi, ProjectViewItem *item)
{
	ProjectViewItem *parent = parentFor(pi, item);

	if(!parent) {
		kError() << "no parent for " << pi->url().toLocalFile();
		return NULL;
	}

	// we have already found the parent folder
	if(parent->type() == KileType::Folder) {
		return parent;
	}

	// we are looking at the children, if there is an existing folder for this type
	ProjectViewItem *folder;

	// determine the foldername for this type
	QString foldername;
	switch(pi->type()) {
		case (KileProjectItem::ProjectFile):
			foldername = i18n("projectfile");
		break;
		case (KileProjectItem::Package):
			foldername = i18n("packages");
		break;
		case (KileProjectItem::Image):
			foldername = i18n("images");
		break;
		case (KileProjectItem::Other):
		default :
			foldername = i18n("other");
		break;
	}

	// if there already a folder for this type on this level?
	bool found = false;
	QTreeWidgetItemIterator it(parent);
	++it; // skip 'parent'
	while(*it) {
		folder = dynamic_cast<ProjectViewItem*>(*it);
		if(folder && folder->text(0) == foldername) {
			found = true;
			break;
		}
		++it;
	}
	
	// if no folder was found, we must create a new one
	if(!found) {
		folder = new ProjectViewItem(parent, foldername);
		KILE_DEBUG() << "new folder: parent=" << parent->url().url()
		             << ", foldername=" << foldername;

		folder->setFolder(pi->type());
		folder->setType(KileType::Folder);
	}

	return folder;
}
开发者ID:puneetsl,项目名称:Mikhail,代码行数:60,代码来源:projectview.cpp

示例2: slotProjectItem

void ProjectView::slotProjectItem(int id)
{
	ProjectViewItem *item = dynamic_cast<ProjectViewItem*>(currentItem());
	if(item) {
		if(item->type() == KileType::ProjectItem || item->type() == KileType::ProjectExtra) {
			switch(id) {
				case KPV_ID_OPEN:
					emit(fileSelected(item->projectItem()));
				break;
				case KPV_ID_SAVE:
					emit(saveURL(item->url()));
				break;
				case KPV_ID_REMOVE:
					emit(removeFromProject(item->projectItem()));
				break;
				case KPV_ID_INCLUDE :
					if(item->text(1) == "*") {
						item->setText(1, "");
					}
					else {
						item->setText(1, "*");
					}
					emit(toggleArchive(item->projectItem()));
				break;
				case KPV_ID_CLOSE:
					emit(closeURL(item->url()));
				break; //we can access "item" later as it isn't deleted
				case KPV_ID_OPENWITH:
					KRun::displayOpenWithDialog(item->url(), this);
				break;
				default:
				break;
			}
		}
	}
}
开发者ID:puneetsl,项目名称:Mikhail,代码行数:36,代码来源:projectview.cpp


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