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

GWidget: Add set_size_policy(Orientation, Policy).

This allows you to set the policy for a single orientation rather than
both at the same time.
This commit is contained in:
Andreas Kling 2019-07-27 09:34:28 +02:00
parent 10c35d345a
commit 7dc7f11ed8
2 changed files with 9 additions and 0 deletions

View file

@ -404,6 +404,14 @@ void GWidget::set_preferred_size(const Size& size)
invalidate_layout();
}
void GWidget::set_size_policy(Orientation orientation, SizePolicy policy)
{
if (orientation == Orientation::Horizontal)
set_size_policy(policy, m_vertical_size_policy);
else
set_size_policy(m_horizontal_size_policy, policy);
}
void GWidget::set_size_policy(SizePolicy horizontal_policy, SizePolicy vertical_policy)
{
if (m_horizontal_size_policy == horizontal_policy && m_vertical_size_policy == vertical_policy)