From eb182bcafc8fa0f33e79a53a45b0ac289c9be238 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Fri, 29 Mar 2019 19:48:15 +0100 Subject: LibGUI: Draw a 1px line tree alongside the GTreeView icons. --- LibGUI/GFileSystemModel.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'LibGUI/GFileSystemModel.cpp') diff --git a/LibGUI/GFileSystemModel.cpp b/LibGUI/GFileSystemModel.cpp index a50ef3b595..49ceea9b9a 100644 --- a/LibGUI/GFileSystemModel.cpp +++ b/LibGUI/GFileSystemModel.cpp @@ -18,10 +18,10 @@ struct GFileSystemModel::Node { GModelIndex index(const GFileSystemModel& model) const { if (!parent) - return { }; + return model.create_index(0, 0, (void*)this); for (int row = 0; row < parent->children.size(); ++row) { if (parent->children[row] == this) - return model.create_index(row, 0, parent); + return model.create_index(row, 0, (void*)this); } ASSERT_NOT_REACHED(); } @@ -138,8 +138,10 @@ GModelIndex GFileSystemModel::parent_index(const GModelIndex& index) const if (!index.is_valid()) return { }; auto& node = *(const Node*)index.internal_data(); - if (!node.parent) + if (!node.parent) { + ASSERT(&node == m_root); return { }; + } return node.parent->index(*this); } -- cgit v1.2.3