title: Extending Surface3D with C++ loses visual parent
body: <p>I am extending Surface3D <a href="https://doc.qt.io/archives/qt-5.10/qtqml-cppintegration-definetypes.html#registering-extension-objects" rel="nofollow noreferrer">using this technique</a>  with a C++ class called Surface3DExtension. Surface3DExtension class defines a single property called “topoFile”, and contains a pointer to the “standard” Q3DSurface, per the technique referenced above:</p>
  
  <pre><code>    class Surface3DExtension : public QObject
      {
         Q_OBJECT
         Q_PROPERTY(QString topoFile READ getTopoFile WRITE setTopoFile NOTIFY topoFileChanged)
  
      public:
         explicit Surface3DExtension(QObject *parent);
  
         int getTopoFile();
         void setTopoFile(QString topoFile);
  
  
      signals:
         void topoFileChanged();
  
      public slots:
  
      private:
         // Actual Q3DSurface instance
         Q3DSurface *m_surface;
  
  };
  </code></pre>
  
  <p>I display the Surface3D with this qml:</p>
  
  <pre><code>import QtQuick 2.2
  import QtQuick.Controls 1.2
  import QtQuick.Layouts 1.3
  import QtDataVisualization 1.2
  import MyTest.test 1.0  // My Surface3D extension
  
  ApplicationWindow {
      visible: true
      title: "Basic layouts"
      property int margin: 11
      width: mainLayout.implicitWidth + 2 * margin
      height: mainLayout.implicitHeight + 2 * margin
      minimumWidth: mainLayout.Layout.minimumWidth + 2 * margin
      minimumHeight: mainLayout.Layout.minimumHeight + 2 * margin
  
      ColumnLayout {
          id: mainLayout
          anchors.fill: parent
          anchors.margins: margin
          GroupBox {
              id: rowBox
              title: "Row layout"
              Layout.fillWidth: true
  
              RowLayout {
                  id: rowLayout
                  anchors.fill: parent
                  Surface3D {
                      objectName: "mySurface"
                      // parent: rowLayout
                      width: 640
                      height: 480
                      visible: true
                      topoFile: "myfile"
                  }
                  Button {
                      text: "Button"
                  }
              }
          }
      }
  </code></pre>
  
  <p>If the qml file does NOT import my extended Surface3D type, Surface3D is displayed as expected within the main application window. However when main.qml imports my extended Surface3D type, the Surface3D appears in a separate borderless window. Debugging the C++ code shows that m_surface->getParent() returns nullptr, i.e. has no visual parent. How can fix this?</p>
  
  <p>Thanks
  Tom</p>