diff options
author | Andreas Kling <awesomekling@gmail.com> | 2019-03-29 19:48:15 +0100 |
---|---|---|
committer | Andreas Kling <awesomekling@gmail.com> | 2019-03-29 19:48:15 +0100 |
commit | eb182bcafc8fa0f33e79a53a45b0ac289c9be238 (patch) | |
tree | 886f3a61a63ceaf0f2469b08f5c620fa754e33c9 /LibGUI/GFileSystemModel.cpp | |
parent | f6b48ecd4772a57dd10542a76881b32860cb40d3 (diff) | |
download | serenity-eb182bcafc8fa0f33e79a53a45b0ac289c9be238.zip |
LibGUI: Draw a 1px line tree alongside the GTreeView icons.
Diffstat (limited to 'LibGUI/GFileSystemModel.cpp')
-rw-r--r-- | LibGUI/GFileSystemModel.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
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); } |