PyQt6: Right multiply QSize/QSizeF with a scalar raises TypeError
Phil Thompson
phil at riverbankcomputing.com
Sun Apr 25 12:52:47 BST 2021
On 23/04/2021 09:41, Ales Erjavec wrote:
> Hi,
>
> In PyQt6 right multiplying a scalar with QSize/QSizeF raises a
> TypeError. This worked in PyQt5 and Qt provides both right and left
> multiply operators. Is this change intentional? QSize/QSizeF do seem
> to define __rmul__ but they just return NotImplemented.
>
> ```
> from PyQt6.QtCore import QSize, QSizeF
>
> # These work
> QSize(1, 1) * 2
> QSizeF(1., 1.) * 2.
>
> # These raise TypeError
> 2 * QSize(1, 1)
> 2. * QSizeF(1., 1.)
> ```
Should be fixed in the next snapshot.
Thanks,
Phil
More information about the PyQt
mailing list