summaryrefslogtreecommitdiff
path: root/DevTools/Inspector/RemoteObjectGraphModel.cpp
diff options
context:
space:
mode:
authorAndreas Kling <awesomekling@gmail.com>2019-08-18 11:12:43 +0200
committerAndreas Kling <awesomekling@gmail.com>2019-08-18 11:12:43 +0200
commit68e94f0a2e27675451538a2eaf34d67728fe6a55 (patch)
tree3551d03f49fd99b1f082c533026972caa6db8dff /DevTools/Inspector/RemoteObjectGraphModel.cpp
parent2e4e4ad957ca5107fe83d095733db6fcf817d38d (diff)
downloadserenity-68e94f0a2e27675451538a2eaf34d67728fe6a55.zip
Inspector: Implement RemoteObjectGraphModel::parent_index()
This makes GTreeView paint the tree lines correctly. It's a bit weird that this is needed, but straightforward to implement so meh.
Diffstat (limited to 'DevTools/Inspector/RemoteObjectGraphModel.cpp')
-rw-r--r--DevTools/Inspector/RemoteObjectGraphModel.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/DevTools/Inspector/RemoteObjectGraphModel.cpp b/DevTools/Inspector/RemoteObjectGraphModel.cpp
index 1647a9b11a..2b0776aea9 100644
--- a/DevTools/Inspector/RemoteObjectGraphModel.cpp
+++ b/DevTools/Inspector/RemoteObjectGraphModel.cpp
@@ -26,6 +26,22 @@ GModelIndex RemoteObjectGraphModel::index(int row, int column, const GModelIndex
return create_index(row, column, remote_parent.children.at(row));
}
+GModelIndex RemoteObjectGraphModel::parent_index(const GModelIndex& index) const
+{
+ if (!index.is_valid())
+ return {};
+ auto& remote_object = *static_cast<RemoteObject*>(index.internal_data());
+ if (!remote_object.parent)
+ return {};
+ for (int row = 0; row < remote_object.parent->children.size(); ++row) {
+ if (remote_object.parent->children[row] == &remote_object)
+ return create_index(row, 0, remote_object.parent);
+ }
+
+ ASSERT_NOT_REACHED();
+ return {};
+}
+
int RemoteObjectGraphModel::row_count(const GModelIndex& index) const
{
if (!index.is_valid())