forked from qt-creator/qt-creator
ProjectNodes: Do not define a copy constructor for FileNode
Nodes are QObjects (still), so they should not have a copy constructor. Change-Id: I1b20663ee0ec121cda4d39ced7a9f204fb4621a1 Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -735,7 +735,7 @@ void ServerModeReader::addHeaderNodes(ProjectNode *root, const QList<FileNode *>
|
||||
const int count = seenHeaders.count();
|
||||
seenHeaders.insert(fn->filePath());
|
||||
if (seenHeaders.count() != count) {
|
||||
auto node = new FileNode(*fn);
|
||||
auto node = fn->clone();
|
||||
node->setEnabled(false);
|
||||
headerNode->addNestedNode(node);
|
||||
}
|
||||
|
||||
@@ -309,7 +309,7 @@ void TeaLeafReader::generateProjectTree(CMakeProjectNode *root, const QList<cons
|
||||
return Utils::contains(allIncludePaths, [fn](const FileName &inc) { return fn->filePath().isChildOf(inc); });
|
||||
});
|
||||
|
||||
QList<FileNode *> fileNodes = m_files + Utils::transform(missingHeaders, [](const FileNode *fn) { return new FileNode(*fn); });
|
||||
QList<FileNode *> fileNodes = m_files + Utils::transform(missingHeaders, [](const FileNode *fn) { return fn->clone(); });
|
||||
|
||||
root->addNestedNodes(fileNodes, m_parameters.sourceDirectory);
|
||||
m_files.clear(); // Some of the FileNodes in files() were deleted!
|
||||
|
||||
@@ -287,6 +287,14 @@ FileNode::FileNode(const Utils::FileName &filePath,
|
||||
setPriority(DefaultFilePriority);
|
||||
}
|
||||
|
||||
FileNode *FileNode::clone() const
|
||||
{
|
||||
auto fn = new FileNode(filePath(), fileType(), isGenerated(), line());
|
||||
fn->setEnabled(isEnabled());
|
||||
fn->setPriority(priority());
|
||||
return fn;
|
||||
}
|
||||
|
||||
FileType FileNode::fileType() const
|
||||
{
|
||||
return m_fileType;
|
||||
|
||||
@@ -168,7 +168,8 @@ class PROJECTEXPLORER_EXPORT FileNode : public Node
|
||||
{
|
||||
public:
|
||||
FileNode(const Utils::FileName &filePath, const FileType fileType, bool generated, int line = -1);
|
||||
FileNode(const FileNode &other) : FileNode(other.filePath(), other.fileType(), true) {}
|
||||
|
||||
FileNode *clone() const;
|
||||
|
||||
FileType fileType() const;
|
||||
bool isGenerated() const;
|
||||
|
||||
Reference in New Issue
Block a user