[PyQt] Qt.MatchFlags AND comparison

Phil Thompson phil at riverbankcomputing.com
Sun Sep 5 18:18:27 BST 2010

On Sun, 5 Sep 2010 09:37:19 -0700 (PDT), Demetrius Cassidy
<dcassidy36 at mass.rr.com> wrote:
> Having a hard time figuring something that should be simple.
> If I do Qt.MatchWildcard & Qt.MatchContains, it returns 1, but if I do
> Qt.MatchContains & anything else (other than Qt.MatchContains itself) it
> returns 0 as expected. What am I doing wrong, and how am I supposed to
> compare my flags to a specific flag other than doing bitwise AND against
> the
> other flag?

You need to read the docs more closely - particularly related to the
actual numerical value. It's a badly designed type - the lower 3 bits
behave like an enum (ie. mutually exclusive), the remaining bits behave
like flags. It should really be split into a MatchType enum and a
MatchModifier set of flags.


More information about the PyQt mailing list