本文整理汇总了C++中FolderNode::icon方法的典型用法代码示例。如果您正苦于以下问题:C++ FolderNode::icon方法的具体用法?C++ FolderNode::icon怎么用?C++ FolderNode::icon使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FolderNode
的用法示例。
在下文中一共展示了FolderNode::icon方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: data
QVariant FlatModel::data(const QModelIndex &index, int role) const
{
QVariant result;
if (Node *node = nodeForIndex(index)) {
FolderNode *folderNode = node->asFolderNode();
switch (role) {
case Qt::DisplayRole: {
QString name = node->displayName();
if (node->nodeType() == NodeType::Project
&& node->parentFolderNode()
&& node->parentFolderNode()->nodeType() == NodeType::Session) {
const QString vcsTopic = static_cast<ProjectNode *>(node)->vcsTopic();
if (!vcsTopic.isEmpty())
name += QLatin1String(" [") + vcsTopic + QLatin1Char(']');
}
result = name;
break;
}
case Qt::EditRole: {
result = node->filePath().fileName();
break;
}
case Qt::ToolTipRole: {
result = node->tooltip();
break;
}
case Qt::DecorationRole: {
if (folderNode)
result = folderNode->icon();
else
result = Core::FileIconProvider::icon(node->filePath().toString());
break;
}
case Qt::FontRole: {
QFont font;
if (node == m_startupProject)
font.setBold(true);
result = font;
break;
}
case Project::FilePathRole: {
result = node->filePath().toString();
break;
}
case Project::EnabledRole: {
result = node->isEnabled();
break;
}
}
}
return result;
}
示例2: data
QVariant FlatModel::data(const QModelIndex &index, int role) const
{
QVariant result;
if (Node *node = nodeForIndex(index)) {
FolderNode *folderNode = qobject_cast<FolderNode*>(node);
switch (role) {
case Qt::DisplayRole: {
QString name = node->displayName();
if (node->parentFolderNode()
&& node->parentFolderNode()->nodeType() == SessionNodeType) {
const QString vcsTopic = node->vcsTopic();
if (!vcsTopic.isEmpty())
name += " (" + vcsTopic + ")";
}
result = name;
break;
}
case Qt::EditRole: {
result = node->displayName();
break;
}
case Qt::ToolTipRole: {
result = node->tooltip();
break;
}
case Qt::DecorationRole: {
if (folderNode)
result = folderNode->icon();
else
result = FileIconProvider::instance()->icon(QFileInfo(node->path()));
break;
}
case Qt::FontRole: {
QFont font;
if (node == m_startupProject)
font.setBold(true);
result = font;
break;
}
case ProjectExplorer::Project::FilePathRole: {
result = node->path();
break;
}
}
}
return result;
}
示例3: data
QVariant FlatModel::data(const QModelIndex &index, int role) const
{
QVariant result;
if (Node *node = nodeForIndex(index)) {
FolderNode *folderNode = qobject_cast<FolderNode*>(node);
switch (role) {
case Qt::DisplayRole:
case Qt::EditRole: {
if (folderNode)
result = folderNode->displayName();
else
result = QFileInfo(node->path()).fileName(); //TODO cache that?
break;
}
case Qt::ToolTipRole: {
result = QDir::toNativeSeparators(node->path());
break;
}
case Qt::DecorationRole: {
if (folderNode)
result = folderNode->icon();
else
result = FileIconProvider::instance()->icon(QFileInfo(node->path()));
break;
}
case Qt::FontRole: {
QFont font;
if (node == m_startupProject)
font.setBold(true);
result = font;
break;
}
case ProjectExplorer::Project::FilePathRole: {
result = node->path();
break;
}
}
}
return result;
}