Return the label counter-transform that exactly cancels the parent component's combined rotate × flip transform, keeping label text upright and unmirrored. The parent's effective linear transform is scale(sx,sy) × rotate(rot). Its inverse is rotate(-rot) × scale(sx,sy) [since scal
(rotation: float, h_flip: bool, v_flip: bool)
| 70 | |
| 71 | |
| 72 | def _counter_transform(rotation: float, h_flip: bool, v_flip: bool) -> "QTransform": |
| 73 | """ |
| 74 | Return the label counter-transform that exactly cancels the parent component's |
| 75 | combined rotate × flip transform, keeping label text upright and unmirrored. |
| 76 | |
| 77 | The parent's effective linear transform is scale(sx,sy) × rotate(rot). |
| 78 | Its inverse is rotate(-rot) × scale(sx,sy) [since scale is self-inverse here]. |
| 79 | In Qt's QTransform, .rotate().scale() post-multiplies left-to-right, giving |
| 80 | exactly rotate(-rot) × scale(sx,sy) as required. |
| 81 | """ |
| 82 | sx = -1 if h_flip else 1 |
| 83 | sy = -1 if v_flip else 1 |
| 84 | return QTransform().rotate(-rotation).scale(sx, sy) |
| 85 | |
| 86 | |
| 87 | _TEXT_RE = re.compile(rb'<text\b([^>]*)>(.*?)</text>', re.S) |
no outgoing calls
no test coverage detected