forked from qt-creator/qt-creator
ProjectNodes: Use a set of flags for bools in Node
This has the potential to save some space per node. Change-Id: I2b8b65c13b355e680965bb7307f9e8d8714dae64 Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -209,7 +209,7 @@ QString Node::tooltip() const
|
||||
|
||||
bool Node::isEnabled() const
|
||||
{
|
||||
if (!m_isEnabled)
|
||||
if (!m_flags.testFlag(FlagIsEnabled))
|
||||
return false;
|
||||
FolderNode *parent = parentFolderNode();
|
||||
return parent ? parent->isEnabled() : true;
|
||||
@@ -222,9 +222,7 @@ bool Node::supportsAction(ProjectAction, Node *) const
|
||||
|
||||
void Node::setEnabled(bool enabled)
|
||||
{
|
||||
if (m_isEnabled == enabled)
|
||||
return;
|
||||
m_isEnabled = enabled;
|
||||
m_flags.setFlag(FlagIsEnabled, enabled);
|
||||
}
|
||||
|
||||
bool Node::sortByPath(const Node *a, const Node *b)
|
||||
|
||||
@@ -161,7 +161,12 @@ private:
|
||||
int m_line = -1;
|
||||
int m_priority = DefaultPriority;
|
||||
const NodeType m_nodeType;
|
||||
bool m_isEnabled = true;
|
||||
enum NodeFlag : quint16 {
|
||||
FlagNone = 0,
|
||||
FlagIsEnabled = 1 << 0,
|
||||
};
|
||||
using NodeFlags = QFlags<NodeFlag>;
|
||||
NodeFlags m_flags = FlagIsEnabled;
|
||||
};
|
||||
|
||||
class PROJECTEXPLORER_EXPORT FileNode : public Node
|
||||
|
||||
Reference in New Issue
Block a user