本文整理汇总了C++中FolderNode::setDisplayName方法的典型用法代码示例。如果您正苦于以下问题:C++ FolderNode::setDisplayName方法的具体用法?C++ FolderNode::setDisplayName怎么用?C++ FolderNode::setDisplayName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FolderNode
的用法示例。
在下文中一共展示了FolderNode::setDisplayName方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: QFileInfo
FolderNode *GenericProjectNode::createFolderByName(const QStringList &components, int end)
{
if (end == 0)
return this;
QString folderName;
for (int i = 0; i < end; ++i) {
folderName.append(components.at(i));
folderName += QLatin1Char('/');
}
const QString component = components.at(end - 1);
if (component.isEmpty())
return this;
const QString baseDir = QFileInfo(path()).path();
FolderNode *folder = new FolderNode(baseDir + QLatin1Char('/') + folderName);
folder->setDisplayName(component);
FolderNode *parent = findFolderByName(components, end - 1);
if (!parent)
parent = createFolderByName(components, end - 1);
addFolderNodes(QList<FolderNode*>() << folder, parent);
return folder;
}
示例2: findOrDefault
FolderNode *setupCMakeVFolder(FolderNode *base, const Utils::FileName &basePath, int priority,
const QString &displayName, QList<FileNode *> &files)
{
if (files.isEmpty())
return nullptr;
FolderNode *folder
= findOrDefault(base->folderNodes(), [basePath](const FolderNode *fn) {
return fn->filePath() == basePath;
});
if (!folder) {
folder = new VirtualFolderNode(basePath, priority);
folder->setDisplayName(displayName);
base->addFolderNodes({ folder });
}
folder->buildTree(files);
return folder;
}