1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-21 11:35:08 +00:00

LibGUI: Make GTreeView inherit from GAbstractColumnView

This makes GTreeView able to support multi-column models!

Only one column can be the "tree column", this is column 0 by default
but can be changed by overriding GModel::tree_column().
This commit is contained in:
Andreas Kling 2019-12-13 23:36:36 +01:00
parent b909d991f1
commit 0ac74d3778
7 changed files with 248 additions and 121 deletions

View file

@ -42,7 +42,7 @@ GModelIndex GModel::create_index(int row, int column, const void* data) const
GModelIndex GModel::sibling(int row, int column, const GModelIndex& parent) const
{
if (!parent.is_valid())
return {};
return index(row, column, {});
int row_count = this->row_count(parent);
if (row < 0 || row > row_count)
return {};