PyQt6: Right multiply QSize/QSizeF with a scalar raises TypeError

Ales Erjavec ales.erjavec324 at gmail.com
Fri Apr 23 09:41:27 BST 2021


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.)
```

Best wishes
Aleš Erjavec


More information about the PyQt mailing list