Repository navigation
Commit aa1180d
committed
fix(plot_canvas): support rounded borders in canvas style sheets
A canvas style sheet with rounded borders, e.g.
plot.canvas().setStyleSheet("border: 2px solid black; border-radius: 8px;"),
raised a TypeError on each style change, resize and paint event. As these
exceptions are raised in Qt virtual methods, PyQt aborts the process with
its default exception hook (0xC0000409 on Windows).
Three porting bugs were on this code path, which the Qwt C++ code avoids
with implicit conversions:
- QwtStyleSheetRecorder.drawPath built QRectF(QPointF, QSize): the size is
now converted to a QSizeF;
- qwtCombinePathList used `rect.bottom` instead of `rect.bottom()` and
None placeholders instead of empty paths (so that any border without
all its corners failed), and reverted the input sub-paths in place: it
now works on a QRectF, empty paths and copies of the sub-paths, as in
Qwt C++;
- qwtFillBackground passed the QRectF corner rectangles of the style sheet
to QRegion.intersects, QPixmap and QWidget.mapTo, which expect integer
types: they are now converted with QRectF.toAlignedRect(), as in Qwt
C++. QRect rectangles (plain canvas with a border radius) are left
unchanged by this conversion.
Canvases without rounded style sheet borders render exactly as before:
same images, pixel for pixel, with and without backing store, for
canvases without style sheet, with non-rounded style sheets and with a
border radius set by setBorderRadius.
- Regression tests: incomplete and complete rounded corners combined
without modifying the input paths; canvases with three rounded style
sheets, with and without backing store, rendered without exception
(exceptions raised in Qt virtual methods are collected), with a border
path and a rounded corner filled with the plot background.
- Changelog entry.
Refs #115
Assisted-by: Claude Opus 5.51 parent 61c3d77 commit aa1180d
3 files changed
Lines changed: 91 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| 20 | + | |
20 | 21 | | |
21 | 22 | | |
22 | 23 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | | - | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
20 | 30 | | |
21 | 31 | | |
22 | 32 | | |
| |||
81 | 91 | | |
82 | 92 | | |
83 | 93 | | |
84 | | - | |
| 94 | + | |
85 | 95 | | |
86 | 96 | | |
87 | 97 | | |
| |||
188 | 198 | | |
189 | 199 | | |
190 | 200 | | |
191 | | - | |
| 201 | + | |
| 202 | + | |
192 | 203 | | |
193 | 204 | | |
| 205 | + | |
194 | 206 | | |
195 | 207 | | |
196 | 208 | | |
| |||
199 | 211 | | |
200 | 212 | | |
201 | 213 | | |
202 | | - | |
| 214 | + | |
203 | 215 | | |
204 | 216 | | |
205 | 217 | | |
| |||
297 | 309 | | |
298 | 310 | | |
299 | 311 | | |
300 | | - | |
| 312 | + | |
| 313 | + | |
301 | 314 | | |
302 | 315 | | |
303 | 316 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
| 40 | + | |
40 | 41 | | |
41 | 42 | | |
42 | 43 | | |
| |||
567 | 568 | | |
568 | 569 | | |
569 | 570 | | |
| 571 | + | |
| 572 | + | |
| 573 | + | |
| 574 | + | |
| 575 | + | |
| 576 | + | |
| 577 | + | |
| 578 | + | |
| 579 | + | |
| 580 | + | |
| 581 | + | |
| 582 | + | |
| 583 | + | |
| 584 | + | |
| 585 | + | |
| 586 | + | |
| 587 | + | |
| 588 | + | |
| 589 | + | |
| 590 | + | |
| 591 | + | |
| 592 | + | |
| 593 | + | |
| 594 | + | |
| 595 | + | |
| 596 | + | |
| 597 | + | |
| 598 | + | |
| 599 | + | |
| 600 | + | |
| 601 | + | |
| 602 | + | |
| 603 | + | |
| 604 | + | |
| 605 | + | |
| 606 | + | |
| 607 | + | |
| 608 | + | |
| 609 | + | |
| 610 | + | |
| 611 | + | |
| 612 | + | |
| 613 | + | |
| 614 | + | |
| 615 | + | |
| 616 | + | |
| 617 | + | |
| 618 | + | |
| 619 | + | |
| 620 | + | |
| 621 | + | |
| 622 | + | |
| 623 | + | |
| 624 | + | |
| 625 | + | |
| 626 | + | |
| 627 | + | |
| 628 | + | |
| 629 | + | |
| 630 | + | |
| 631 | + | |
| 632 | + | |
| 633 | + | |
| 634 | + | |
| 635 | + | |
| 636 | + | |
| 637 | + | |
570 | 638 | | |
571 | 639 | | |
572 | 640 | | |
| |||
586 | 654 | | |
587 | 655 | | |
588 | 656 | | |
| 657 | + | |
| 658 | + | |
| 659 | + | |
| 660 | + | |
589 | 661 | | |
0 commit comments