Skip to content

Commit

Permalink
Add expansion state to watch nodes.
Browse files Browse the repository at this point in the history
Only applicable to group nodes.
  • Loading branch information
cristian64 committed May 29, 2024
1 parent 7e15e25 commit 97eec51
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
8 changes: 8 additions & 0 deletions Source/MemoryWatch/MemWatchTreeNode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,10 @@ void MemWatchTreeNode::readFromJson(const QJsonObject& json, MemWatchTreeNode* p
{
m_isGroup = true;
m_groupName = json["groupName"].toString();
if (json.contains("expanded"))
{
m_expanded = json["expanded"].toBool();
}
QJsonArray groupEntries = json["groupEntries"].toArray();
for (auto i : groupEntries)
{
Expand Down Expand Up @@ -200,6 +204,10 @@ void MemWatchTreeNode::writeToJson(QJsonObject& json) const
if (isGroup())
{
json["groupName"] = m_groupName;
if (m_expanded)
{
json["expanded"] = m_expanded;
}
QJsonArray entries;
for (MemWatchTreeNode* const child : m_children)
{
Expand Down
3 changes: 3 additions & 0 deletions Source/MemoryWatch/MemWatchTreeNode.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ class MemWatchTreeNode
MemWatchTreeNode& operator=(MemWatchTreeNode&&) = delete;

bool isGroup() const;
bool isExpanded() const { return m_expanded; }
void setExpanded(const bool expanded) { m_expanded = expanded; };
QString getGroupName() const;
void setGroupName(const QString& groupName);
MemWatchEntry* getEntry() const;
Expand Down Expand Up @@ -46,6 +48,7 @@ class MemWatchTreeNode

private:
bool m_isGroup;
bool m_expanded{};
bool m_isValueEditing = false;
QString m_groupName;
MemWatchEntry* m_entry;
Expand Down

0 comments on commit 97eec51

Please sign in to comment.