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

LibGUI: Simplify TableCellPaintingDelegate API slightly

No need to pass the Model *and* a ModelIndex, the index knows which
model it belongs to anyway.
This commit is contained in:
Andreas Kling 2020-08-16 16:05:24 +02:00
parent f882424869
commit 96f98b1fc9
5 changed files with 8 additions and 8 deletions

View file

@ -337,12 +337,12 @@ class ProgressBarPaintingDelegate final : public GUI::TableCellPaintingDelegate
public:
virtual ~ProgressBarPaintingDelegate() override { }
virtual void paint(GUI::Painter& painter, const Gfx::IntRect& a_rect, const Palette& palette, const GUI::Model& model, const GUI::ModelIndex& index) override
virtual void paint(GUI::Painter& painter, const Gfx::IntRect& a_rect, const Palette& palette, const GUI::ModelIndex& index) override
{
auto rect = a_rect.shrunken(2, 2);
auto percentage = model.data(index, GUI::ModelRole::Custom).to_i32();
auto percentage = index.data(GUI::ModelRole::Custom).to_i32();
auto data = model.data(index, GUI::ModelRole::Display);
auto data = index.data(GUI::ModelRole::Display);
String text;
if (data.is_string())
text = data.as_string();