mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 05:37:43 +00:00
LibGUI: Use calculated_preferred_size for Progressbar default size
This commit is contained in:
parent
6d79d932f9
commit
f1271c7860
2 changed files with 11 additions and 0 deletions
|
@ -27,6 +27,8 @@ Progressbar::Progressbar(Orientation orientation)
|
||||||
{ Format::ValueSlashMax, "ValueSlashMax" });
|
{ Format::ValueSlashMax, "ValueSlashMax" });
|
||||||
REGISTER_INT_PROPERTY("min", min, set_min);
|
REGISTER_INT_PROPERTY("min", min, set_min);
|
||||||
REGISTER_INT_PROPERTY("max", max, set_max);
|
REGISTER_INT_PROPERTY("max", max, set_max);
|
||||||
|
|
||||||
|
set_preferred_size(SpecialDimension::Fit);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Progressbar::set_value(int value)
|
void Progressbar::set_value(int value)
|
||||||
|
@ -81,4 +83,11 @@ void Progressbar::set_orientation(Orientation value)
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Optional<UISize> Progressbar::calculated_preferred_size() const
|
||||||
|
{
|
||||||
|
if (orientation() == Gfx::Orientation::Vertical)
|
||||||
|
return { { 22, SpecialDimension::OpportunisticGrow } };
|
||||||
|
return { { SpecialDimension::OpportunisticGrow, 22 } };
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,6 +45,8 @@ protected:
|
||||||
virtual void paint_event(PaintEvent&) override;
|
virtual void paint_event(PaintEvent&) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
virtual Optional<UISize> calculated_preferred_size() const override;
|
||||||
|
|
||||||
Format m_format { Percentage };
|
Format m_format { Percentage };
|
||||||
int m_min { 0 };
|
int m_min { 0 };
|
||||||
int m_max { 100 };
|
int m_max { 100 };
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue