mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-06 08:36:15 +00:00
LibGUI: Add ModelRole::IconOpacity and support it in all views :^)
This role allows you to specify a custom opacity for icon painting. Note that the opacity is not in effect when the item is either selected and/or hovered.
This commit is contained in:
@@ -118,7 +118,8 @@ void ColumnsView::paint_event(PaintEvent& event)
|
||||
} else if (m_hovered_index.is_valid() && m_hovered_index.parent() == index.parent() && m_hovered_index.row() == index.row()) {
|
||||
painter.blit_brightened(icon_rect.location(), *bitmap, bitmap->rect());
|
||||
} else {
|
||||
painter.blit(icon_rect.location(), *bitmap, bitmap->rect());
|
||||
auto opacity = index.data(ModelRole::IconOpacity).as_float_or(1.0f);
|
||||
painter.blit(icon_rect.location(), *bitmap, bitmap->rect(), opacity);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user