title: Expose abstract type as Q_PROPERTY to QML
body: <p>I am using Qt 4.8 with BB10. </p>
  
  <p>I defined a base interface for classes to implement:</p>
  
  <pre><code>class AbstractImageProcessor : public QObject
  {
  public:
      AbstractImageProcessor(QObject * parent) : QObject(parent) {}
      virtual QImage process(const QByteArray &amp;data) = 0;
      virtual ~AbstractImageProcessor(){ }
  };
  </code></pre>
  
  <p>One such implementation that I want usable from QML looks like this:</p>
  
  <pre><code>class WebImageProcessor : public AbstractImageProcessor
  {
      Q_OBJECT
      Q_PROPERTY(int maxHeight READ getMaxHeight WRITE setMaxHeight NOTIFY maxHeightChanged)
      Q_PROPERTY(int maxWidth READ getMaxWidth WRITE setMaxWidth NOTIFY maxWidthChanged)
      Q_PROPERTY(bool fit READ isFit NOTIFY fitChanged)
      public WebImageProcessor(QObject * parent = 0) : AbstractImageProcessor(parent) {}
      virtual ~WebImageProcessor() {}
      /* rest of code omitted */ 
  };
  </code></pre>
  
  <p>I want to expose this <strong><em>AbstractImageProcessor</em></strong> as a property on another QML type:</p>
  
  <pre><code>class WebImageView : public bb::cascades::ImageView {
      Q_OBJECT
      Q_PROPERTY(AbstractImageProcessor* processor READ getProcessor WRITE setProcessor NOTIFY processorChanged)
      WebImageView(bb::cascades::Container * parent) : bb::cascades::ImageView(parent)  {}
      virtual WebImageView() {}
      /* rest of code omitted */
  };
  </code></pre>
  
  <p>So I register my custom types with QML</p>
  
  <pre><code>//application.cpp
  qmlRegisterUncreatableType&lt;AbstractImageProcessor&gt;("foo.controls", 1, 0, "AbstractImageProcessor", ""); ;
  qmlRegisterType&lt;WebImageProcessor&gt;("foo.controls", 1, 0, "WebImageProcessor");
  qmlRegisterType&lt;WebImageView&gt;("foo.controls", 1, 0, "WebImageView");
  </code></pre>
  
  <p>How I want to use it in QML</p>
  
  <pre><code>//main.qml
  import foo.controls 1.0
  /* omitted containers */
  
  WebImageView { 
    processor: WebImageProcessor {
       maxHeight: 500
       maxWidth: 300
    } 
    /* rest of properties omitted */
  }
  </code></pre>
  
  <p>But once I launch my application it fails to parse the qml document. </p>
  
  <p><em>bb::cascades::QmlDocument: error when loading QML from:   QUrl( "asset:///main.qml" )<br>
  --- errors:  (asset:///main.qml:138:57: Cannot assign object to property) 
  bb::cascades::QmlDocument:createRootObject document is not loaded or has errors, can't create root</em></p>
  
  <p>In fact if I hover over the WebImageProcessor class in the editor, it says:</p>
  
  <p><em>The super type of the component WebImageProcessor is unknown, some of its properties are not validated.</em></p>
  
  <p>Now the thing is that the for example the built in cascades ListView exposes an abstract type as a Q_PROPERTY:</p>
  
  <p><a href="http://developer.blackberry.com/native/reference/cascades/bb__cascades__listview.html#property-datamodel">http://developer.blackberry.com/native/reference/cascades/bb_<em>cascades</em>_listview.html#property-datamodel</a></p>
  
  <p>Event inspecting the header files of bb::cascades::ListView and bb::cascades::DataModel gives me no other clues because it's done essentially the same way.</p>
  
  <p>Could it be that I have to register the types in a different way? If so how?</p>
  
  <p>If I use WebImageProcessor in the Q_PROPERTY instead of the AbstractImageProcessor then it works as expected, but I want to expose the abstract type, and given that cascades does it then it's definitely possible somehow</p>
  
  <p>Thanks</p>