本文整理汇总了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;
}
示例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;
}
}
}
}