[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pykde
Subject:    Re: PyQt5: QKeySequence.StandardKey.* peculiar equality comparison
From:       Phil Thompson <phil () riverbankcomputing ! com>
Date:       2022-02-26 14:33:05
Message-ID: f8abee77106cd06c260b0fba6e848589 () riverbankcomputing ! com
[Download RAW message or body]

On 01/02/2022 13:46, Ales Erjavec wrote:
> Hi,
> 
> `PyQt5.QtGui.QKeySequence.StandardKey` members do not compare equally
> if accessed as `StandardKey` members multiple times.
> 
> ```
> from PyQt5.QtGui import QKeySequence
> 
> Cancel = QKeySequence.StandardKey.Cancel
> assert Cancel == Cancel  # this works
> assert QKeySequence.Cancel == QKeySequence.Cancel  # this works
> assert QKeySequence.StandardKey.Cancel ==
> QKeySequence.StandardKey.Cancel  # this does not
> ```
> sip.enumtypes seem to create new instances when accessed from the
> type, but other enums
> seem to work correctly i.e. have defined equality.
> 
> This might be due to
> ```
> bool operator==(QKeyEvent *e, QKeySequence::StandardKey key);
> bool operator==(QKeySequence::StandardKey key, QKeyEvent *e);
> ```
> overloads defined in qevent.sip
> 
> OS: Linux
> Python: 3.10.1
> PyQt5: 5.15.6
> 
> Thanks.

Fixed in the next SIP snapshot.

Thanks,
Phil
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic