title: How do I use QFlags with QML?
body: <p>I have a QFlag that I have created. I would like to use this QFlag in QML. Specifically, I would like to be able to OR together a couple of flags and pass them as a parameter to a method.</p>
  
  <p>I noticed that QFlags are not explicitly listed here as a QML supported data type: <a href="http://doc.qt.nokia.com/4.7-snapshot/qtbinding.html#supported-data-types" rel="nofollow">http://doc.qt.nokia.com/4.7-snapshot/qtbinding.html#supported-data-types</a> </p>
  
  <p>Which types do I need to register or Q_MACROs do I need to use to enable this functionality?</p>
  
  <p>The goal is to have a method call I can use in QML that looks like this:</p>
  
  <pre><code>    myObject.setFlag(MyFlagType.A | MyFlagType.C)
  </code></pre>
  
  <p>My QFlag code:</p>
  
  <pre><code>#include &lt;QFlags&gt;
  #include &lt;QObject&gt;
  class ColorPickerStyle : public QObject {
  Q_OBJECT
  public:
  enum ColorPickerStyleFlag {
      None 0x00,
      MSOfficeColors = 0x01,
      RGBSlider = 0x02,
      ColorWheel = 0x04,
      CustomColorSet = 0x08
  };
  //Create ColorPickerStyle::Flags as a type
  Q_DECLARE_FLAGS(Flags, ColorPickerStyleFlag)
  //Register ColorPickerStyle::Flags with the meta-type system
  Q_FLAGS(Flags)
  Q_ENUMS(ColorPickerStyleFlag)
  
  ColorPickerStyle();
  virtual ~ColorPickerStyle();
  };
  
  //Qt requires lots of macros
  Q_DECLARE_OPERATORS_FOR_FLAGS(ColorPickerStyle::Flags)
  </code></pre>