Show Qt3D stuff inside QWidget in Qt5

后端 未结 2 1531
闹比i
闹比i 2021-01-06 13:56

So I felt all warm and fuzzy inside after reading that Qt3D has re-emerged in a v2.0 and is in fact becoming a part of Qt5

2条回答
  •  逝去的感伤
    2021-01-06 14:54

    This extraction of this post shows how it works:

    #include 
    #include 
    #include 
    
    class Qt3DWidget
          : public QWidget
    {
        Q_OBJECT
        QWidget *container;
    
    public:
        explicit Qt3DWidget(QWidget *parent = nullptr);
    
    };
    
    Qt3DWidget::Qt3DWidget(QWidget *parent)
       : QWidget(parent)
    {
        auto view = new Qt3DExtras::Qt3DWindow();
    
        // put Qt3DWindow into a container in order to make it possible
        // to handle the view inside a widget
        container = createWindowContainer(view,this);
    
        // ... further stuff goes here
    }
    

提交回复
热议问题