[prev in list] [next in list] [prev in thread] [next in thread]
List: pykde
Subject: Re: QListWidgetItem::ItemType broken
From: Phil Thompson <phil () riverbankcomputing ! com>
Date: 2021-11-24 11:01:37
Message-ID: 31a2976dd46a097ee28c069e66694a83 () riverbankcomputing ! com
[Download RAW message or body]
On 24/11/2021 08:02, Kovid Goyal wrote:
> python -c 'from PyQt6.QtWidgets import *; l = QListWidgetItem(None,
> QListWidgetItem.ItemType.UserType)'
> Traceback (most recent call last):
> File "<string>", line 1, in <module>
> TypeError: arguments did not match any overloaded call:
> QListWidgetItem(parent: QListWidget = None, type: int =
> QListWidgetItem.Type): argument 2 has unexpected type 'ItemType'
> QListWidgetItem(str, parent: QListWidget = None, type: int =
> QListWidgetItem.Type): argument 2 has unexpected type 'ItemType'
> QListWidgetItem(QIcon, str, parent: QListWidget = None, type: int =
> QListWidgetItem.Type): argument 1 has unexpected type 'NoneType'
> QListWidgetItem(QListWidgetItem): argument 1 has unexpected type
> 'NoneType'
>
>
> This is because in Qt the type argument is an int not an enum. So this
> is technically not a bug in PyQt6. However, its extremely un-intuitive.
> Maybe make OListWidgetItem.ItemType an IntEnum and have
> QListWidgetItemType::type() also return the intenum not an int.
Any enum that has a member that corresponds to some user extendable base
value should be an IntEnum.
Fixed in the next snapshot - although I haven't changed the type
returned by type().
Thanks,
Phil
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic