mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 08:27:35 +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:
parent
2d1eff01a2
commit
8ba47facf6
6 changed files with 20 additions and 10 deletions
|
@ -539,7 +539,8 @@ void IconView::paint_event(PaintEvent& event)
|
|||
} else if (m_hovered_index.is_valid() && m_hovered_index == item_data.index) {
|
||||
painter.blit_brightened(destination.location(), *bitmap, bitmap->rect());
|
||||
} else {
|
||||
painter.blit(destination.location(), *bitmap, bitmap->rect());
|
||||
auto opacity = item_data.index.data(ModelRole::IconOpacity).as_float_or(1.0f);
|
||||
painter.blit(destination.location(), *bitmap, bitmap->rect(), opacity);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue