[PyQt] Latest PyQt fails compile OSX10.7.5 Qt5.3b conversion from 'long' to 'QFlag' is ambiguous

lloyd konneker bootch at nc.rr.com
Tue Apr 22 02:15:26 BST 2014

See my previous posts in this thread for context.

I hacked this code in Qt's qflag.h:

class QFlag
int i;
#if !defined(__LP64__) && !defined(Q_QDOC)
Q_DECL_CONSTEXPR inline QFlag(long ai) : i(int(ai)) {}
Q_DECL_CONSTEXPR inline QFlag(ulong ai) : i(int(long(ai))) {}

I removed the #if and #endif.  Now PyQt5.2.2 compiles without complaint 
on Qt5.3beta on OSX.

Again, I have limited understanding of both Qt and PyQt internals, but 
now I think this is a bug in Qt.
On a 64 bit-machine where type long is 64-bit (e.g. OSX) and where QFlag 
should be a 32-bit type, it seems one would need the code bracketed by 
#if and #endif.  But in such a situation,  __LP64__ should be defined 
(by the compiler I believe) and the code would not be compiled.  So I 
think the #if is in error.

The Qt code in question dates from June 2013.

More information about the PyQt mailing list