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:
hjk
2019-02-26 13:34:23 +01:00
parent 0b593951d0
commit 44a42db1ae
4 changed files with 9 additions and 9 deletions

View File

@@ -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

View File

@@ -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;

View File

@@ -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:

View File

@@ -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;
}; };
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------