def qflags_key(base, value, add_base=False, klass=None):
 if (klass is None):
  klass = value.__class__
  if (klass == int):
   raise TypeError("Can't guess enum class of an int!")
 bits = []
 names = []
 mask = 1
 value = int(value)
 while (mask <= value):
  if (value & mask):
   bits.append(mask)
  mask <<= 1
 for bit in bits:
  names.append(qenum_key(base, klass(bit), add_base))
 return '|'.join(names)

def qflags_key ( base , value , add_base = False , klass = None ) : if ( klass is None ) : klass = value . __class__ if ( klass == int ) : raise TypeError ( "Can't guess enum class of an int!" ) bits = [ ] names = [ ] mask = 1 value = int ( value ) while ( mask <= value ) : if ( value & mask ) : bits . append ( mask ) mask <<= 1 for bit in bits : names . append ( qenum_key ( base , klass ( bit ) , add_base ) ) return '|' . join ( names )
convert a qt qflags value to its keys as string .