forked from qt-creator/qt-creator
ProjectExplorer: "Upstream" line number display for FileNodes
So far only used and set with QBS, but conceptually usable more generally, and harmless if not used. Change-Id: I1d2d615f5613340690de22a1c7d716a193fb1f05 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
@@ -417,6 +417,14 @@ bool FileNode::supportsAction(ProjectAction action, const Node *node) const
|
|||||||
return parentFolder && parentFolder->supportsAction(action, node);
|
return parentFolder && parentFolder->supportsAction(action, node);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString FileNode::displayName() const
|
||||||
|
{
|
||||||
|
int l = line();
|
||||||
|
if (l < 0)
|
||||||
|
return Node::displayName();
|
||||||
|
return Node::displayName() + ':' + QString::number(l);
|
||||||
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\class ProjectExplorer::FolderNode
|
\class ProjectExplorer::FolderNode
|
||||||
|
|
||||||
|
@@ -200,6 +200,7 @@ public:
|
|||||||
const std::function<FileNode *(const Utils::FileName &fileName)> factory,
|
const std::function<FileNode *(const Utils::FileName &fileName)> factory,
|
||||||
QFutureInterface<QList<FileNode *>> *future = nullptr);
|
QFutureInterface<QList<FileNode *>> *future = nullptr);
|
||||||
bool supportsAction(ProjectAction action, const Node *node) const override;
|
bool supportsAction(ProjectAction action, const Node *node) const override;
|
||||||
|
QString displayName() const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
FileType m_fileType;
|
FileType m_fileType;
|
||||||
|
@@ -242,13 +242,6 @@ QbsFileNode::QbsFileNode(const Utils::FileName &filePath,
|
|||||||
setLine(line);
|
setLine(line);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString QbsFileNode::displayName() const
|
|
||||||
{
|
|
||||||
int l = line();
|
|
||||||
if (l < 0)
|
|
||||||
return ProjectExplorer::FileNode::displayName();
|
|
||||||
return ProjectExplorer::FileNode::displayName() + QLatin1Char(':') + QString::number(l);
|
|
||||||
}
|
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
// QbsBaseProjectNode:
|
// QbsBaseProjectNode:
|
||||||
|
@@ -44,8 +44,6 @@ class QbsFileNode : public ProjectExplorer::FileNode
|
|||||||
public:
|
public:
|
||||||
QbsFileNode(const Utils::FileName &filePath, const ProjectExplorer::FileType fileType,
|
QbsFileNode(const Utils::FileName &filePath, const ProjectExplorer::FileType fileType,
|
||||||
int line);
|
int line);
|
||||||
|
|
||||||
QString displayName() const override;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
Reference in New Issue
Block a user