1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-16 10:34:58 +00:00

LibGUI: Make view widgets fill background by default

Most clients will want background autofill, so let's make it the
default mode.
This commit is contained in:
Andreas Kling 2020-04-18 21:55:37 +02:00
parent c7b7b65309
commit d17b42b28d
4 changed files with 12 additions and 4 deletions

View file

@ -53,6 +53,7 @@ TreeView::MetadataForIndex& TreeView::ensure_metadata_for_index(const ModelIndex
TreeView::TreeView()
{
set_fill_with_background_color(true);
set_background_role(ColorRole::Base);
set_foreground_role(ColorRole::BaseText);
set_size_columns_to_fit_content(true);
@ -173,7 +174,8 @@ void TreeView::paint_event(PaintEvent& event)
Painter painter(*this);
painter.add_clip_rect(frame_inner_rect());
painter.add_clip_rect(event.rect());
painter.fill_rect(event.rect(), palette().color(background_role()));
if (fill_with_background_color())
painter.fill_rect(event.rect(), palette().color(background_role()));
if (!model())
return;