Skip to content

[kcms/keyboard] tastenbrett: Further fixes on shape's bounding boxes

A few shapes and keys weren't drawn or positioned correctly as their bounding box had a non-zero offset:

  • positive: media keys on dellm65
  • negative: J-shaped return key on pc104alt
  • non-integer: vertical row on pc86

For the shape's bounding box and the outlines, use the constructor QRectF(QPointF, QPointF) to correctly translate the original bounding box, which is based on top-left, bottom-right points.

Also switch to use the non-integer versions for radius, points and sizes

Then, to fit the shape into this corrected bounding box, let's offset the context in the canvas and apply the x,y positioning outside. This is not strictly necessary for positive offsets but feels more correct and fixes the case where the offset is negative.

Test plan

tastenbrett -m <model>

Screenshots

Model Shape Definition BEFORE AFTER
dellm65 shape "MEDIA" { cornerRadius = 5, { [ 2, 2], [ 12, 12 ] } }; kbd_dellm65-media-before kbd_dellm65-media-after
pc104alt shape "RTRN" { { \[ -14,19 \], \[ -14,37 \], \[ 28,37 \], ... } kbd_pc104alt-return-before kbd_pc104alt-return-after
Edited by Ismael Asensio

Merge request reports