1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 02:07:34 +00:00

VisualBuilder: Don't allow moving/resizing widgets that are in a layout

Also paint these widgets' grabbers differently to make it stand out
visually which widgets have managed geometry. :^)
This commit is contained in:
Andreas Kling 2019-09-17 21:22:15 +02:00
parent 5e439bb3c8
commit 9d460d55d1
3 changed files with 26 additions and 2 deletions

View file

@ -105,7 +105,8 @@ void VBWidget::add_property(const String& name, Function<GVariant(const GWidget&
}
#define VB_ADD_PROPERTY(gclass, name, getter, setter, variant_type) \
add_property(name, \
add_property( \
name, \
[](auto& widget) -> GVariant { return ((const gclass&)widget).getter(); }, \
[](auto& widget, auto& value) { ((gclass&)widget).setter(value.to_##variant_type()); })
@ -206,3 +207,12 @@ void VBWidget::capture_transform_origin_rect()
{
m_transform_origin_rect = rect();
}
bool VBWidget::is_in_layout() const
{
if (auto* parent_widget = m_gwidget->parent_widget()) {
if (parent_widget->layout())
return true;
}
return false;
}