mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-26 06:18:59 +00:00
LibGUI: Draw a 1px line tree alongside the GTreeView icons.
This commit is contained in:
parent
f6b48ecd47
commit
eb182bcafc
Notes:
sideshowbarker
2024-07-19 14:54:02 +09:00
Author: https://github.com/awesomekling
Commit: eb182bcafc
4 changed files with 30 additions and 12 deletions
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue