ProjectExplorer::Node::line should be a property not a virtual function

Changing it must emit the same signals as does setting path, since the
sorting might change.

Change-Id: Iaf29c0775387d623d2e611e202b63ab52e812140
Reviewed-by: Tobias Hunger <tobias.hunger@digia.com>
This commit is contained in:
Daniel Teske
2014-02-18 18:06:05 +01:00
parent 23c6a42481
commit d4ad269323
4 changed files with 36 additions and 23 deletions

View File

@@ -62,12 +62,13 @@ using namespace ProjectExplorer;
*/
Node::Node(NodeType nodeType,
const QString &filePath)
const QString &filePath, int line)
: QObject(),
m_nodeType(nodeType),
m_projectNode(0),
m_folderNode(0),
m_path(filePath)
m_path(filePath),
m_line(line)
{
}
@@ -105,6 +106,28 @@ void Node::setPath(const QString &path)
emitNodeUpdated();
}
void Node::setLine(int line)
{
if (m_line == line)
return;
emitNodeSortKeyAboutToChange();
m_line = line;
emitNodeSortKeyChanged();
emitNodeUpdated();
}
void Node::setPathAndLine(const QString &path, int line)
{
if (m_path == path
&& m_line == line)
return;
emitNodeSortKeyAboutToChange();
m_path = path;
m_line = line;
emitNodeSortKeyChanged();
emitNodeUpdated();
}
NodeType Node::nodeType() const
{
return m_nodeType;
@@ -189,8 +212,8 @@ void Node::setParentFolderNode(FolderNode *parentFolder)
FileNode::FileNode(const QString &filePath,
const FileType fileType,
bool generated)
: Node(FileNodeType, filePath),
bool generated, int line)
: Node(FileNodeType, filePath, line),
m_fileType(fileType),
m_generated(generated)
{