title: Enum in Qt property
body: <p>I have a code, which works with <strong>Qt 5.5</strong> and doesn't with <strong>Qt 5.2</strong>. Problem is with this <strong>enum</strong>:</p>
  
  <pre><code>#include &lt;QtCore/QMetaType&gt;
  enum Area
  {
      Area_A,
      Area_B,
      Area_C
  };
  
  Q_DECLARE_METATYPE(Area)
  </code></pre>
  
  <p>Then I have an object, which exposes this <strong>area</strong> property:</p>
  
  <pre><code>class MyClass : public QObject
  {
      Q_OBJECT
      Q_PROPERTY(Area area READ area WRITE setArea NOTIFY areaChanged)
  public:    
      explicit MyClass(QObject *parent = 0)
          : QObject(parent), m_area(Area_A){}
  
      Area area() const { return m_area; }    
      void setArea(Area area) {
          m_area = area;
          emit areaChanged(area);
      }
  
  signals:
      void areaChanged(Area area);    
  private:
      Area m_area;
  };
  </code></pre>
  
  <p>And main.cpp:</p>
  
  <pre><code>#include &lt;QtGui/QGuiApplication&gt;
  #include &lt;QtQml/QQmlApplicationEngine&gt;
  #include &lt;QtQml/QQmlContext&gt;
  #include &lt;QtQml/QtQml&gt;
  #include "MyClass.h"
  
  int main(int argc, char *argv[])
  {
      QGuiApplication app(argc, argv);
  
      qmlRegisterType&lt;MyClass&gt;("GLib", 1, 0, "MyClass");
  
      MyClass controller;
      QQmlApplicationEngine engine;
      engine.rootContext()-&gt;setContextProperty("controller", &amp;controller);
      engine.load("./main.qml");
  
      controller.setArea(Area_B);
      return app.exec();
  }
  </code></pre>
  
  <p>It compiles, everything is OK. But when I tried to use area property in <strong>qml</strong>:</p>
  
  <pre><code>import QtQuick 2.0
  import QtQuick.Window 2.0
  import GLib 1.0
  
  Window {
      visible: true
      id: root
  
      property int area: controller.area 
  
      Text {
          id: name
          text: "Test"
          x: area * 30
          y: area * 30
      }
  }
  </code></pre>
  
  <p>I have run-time errors, if Qt 5.2 is used (Linux, x64):</p>
  
  <blockquote>
    <p>QMetaProperty::read: Unable to handle unregistered datatype 'Area' for
    property 'MyClass::area'
    file:///home/yech844/devel/test_qml/main.qml:10:24: Unable to assign
    [undefined] to int QMetaProperty::read: Unable to handle unregistered
    datatype 'Area' for property 'MyClass::area'
    file:///home/yech844/devel/test_qml/main.qml:10:24: Unable to assign
    [undefined] to int</p>
  </blockquote>
  
  <p>Is it a bug in Qt? Why I can't use Enum, which is declared out of Class scope?</p>