mirror of
https://github.com/slint-ui/slint.git
synced 2025-10-01 06:11:16 +00:00
Rename Rectangle.color to Rectangle.background
Add support for built-in property aliases and rename `color` to `background` - in preparation for it also changing to type brush. Right now the alias is silent, a deprecation and overall change will come in a subsequent change.
This commit is contained in:
parent
c479fd132d
commit
1f091cb1c0
16 changed files with 250 additions and 131 deletions
|
@ -667,7 +667,7 @@ impl ItemRenderer for GLItemRenderer {
|
|||
}
|
||||
// TODO: cache path in item to avoid re-tesselation
|
||||
let mut path = rect_to_path(geometry);
|
||||
let paint = femtovg::Paint::color(rect.color().into());
|
||||
let paint = femtovg::Paint::color(rect.background().into());
|
||||
self.shared_data.canvas.borrow_mut().save_with(|canvas| {
|
||||
canvas.translate(pos.x, pos.y);
|
||||
canvas.fill_path(&mut path, paint)
|
||||
|
@ -705,7 +705,7 @@ impl ItemRenderer for GLItemRenderer {
|
|||
path.rounded_rect(x, y, width, height, border_radius);
|
||||
}
|
||||
|
||||
let fill_paint = femtovg::Paint::color(rect.color().into());
|
||||
let fill_paint = femtovg::Paint::color(rect.background().into());
|
||||
|
||||
let mut border_paint = femtovg::Paint::color(rect.border_color().into());
|
||||
border_paint.set_line_width(border_width);
|
||||
|
|
|
@ -226,7 +226,7 @@ struct QtItemRenderer<'a> {
|
|||
impl ItemRenderer for QtItemRenderer<'_> {
|
||||
fn draw_rectangle(&mut self, pos: Point, rect: Pin<&items::Rectangle>) {
|
||||
let pos = qttypes::QPoint { x: pos.x as _, y: pos.y as _ };
|
||||
let color: u32 = rect.color().as_argb_encoded();
|
||||
let color: u32 = rect.background().as_argb_encoded();
|
||||
let rect: qttypes::QRectF = get_geometry!(pos, items::Rectangle, rect);
|
||||
let painter: &mut QPainter = &mut *self.painter;
|
||||
cpp! { unsafe [painter as "QPainter*", color as "QRgb", rect as "QRectF"] {
|
||||
|
@ -237,7 +237,7 @@ impl ItemRenderer for QtItemRenderer<'_> {
|
|||
fn draw_border_rectangle(&mut self, pos: Point, rect: std::pin::Pin<&items::BorderRectangle>) {
|
||||
self.draw_rectangle_impl(
|
||||
get_geometry!(pos, items::BorderRectangle, rect),
|
||||
rect.color(),
|
||||
rect.background(),
|
||||
rect.border_color(),
|
||||
rect.border_width(),
|
||||
rect.border_radius(),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue