[PyQt] Checking a window's state using '&' is always returning False

Florian Bruhin me at the-compiler.org
Mon Aug 21 22:00:05 BST 2017

On Mon, Aug 21, 2017 at 04:55:22PM -0400, Jayson Kempinger wrote:
> How should I be checking the window state then?  The same comparison works well for Qt alignment and Qt modifier keys:
> > if event.modifiers() & Qt.ShiftModifier:
> >     shift = True
> > if event.modifiers() & Qt.ControlModifier:
> >     ctrl = True

Not if you want to check for Qt.NoModifier which is 0 too. You can't
check for 0 with &.

> So I assumed I should be checking window state in the same way.

If you really care about Qt.WindowNoState, you'd probably need to check
for that with ==.


https://www.qutebrowser.org  | me at the-compiler.org (Mail/XMPP)
   GPG: 916E B0C8 FD55 A072  | https://the-compiler.org/pubkey.asc
         I love long mails!  | https://email.is-not-s.ms/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20170821/c4fd3b75/attachment-0001.sig>

More information about the PyQt mailing list