1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-16 18:35:07 +00:00

HackStudio: Reflect widget selections in the form widget tree view

You can now manipulate the widget selection either by clicking and
dragging the widgets using the cursor tool, or by interacting with
the form widget tree view. :^)
This commit is contained in:
Andreas Kling 2019-11-11 19:37:01 +01:00
parent 812ee330e6
commit 2fea238675
4 changed files with 51 additions and 2 deletions

View file

@ -75,3 +75,14 @@ void WidgetTreeModel::update()
{
did_update();
}
GModelIndex WidgetTreeModel::index_for_widget(GWidget& widget) const
{
int parent_child_index = 0;
for (auto& parent_child : widget.parent_widget()->child_widgets()) {
if (parent_child == &widget)
return create_index(parent_child_index, 0, &widget);
++parent_child_index;
}
return {};
}