Show Qt3D stuff inside QWidget in Qt5

后端 未结 2 1530
闹比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:42

    In case anybody is interested, I implemented an actual Qt3D widget. The code can be found here.

    0 讨论(0)
  • 2021-01-06 14:54

    This extraction of this post shows how it works:

    #include <QObject>
    #include <QWidget>
    #include <Qt3DExtras/Qt3DWindow>
    
    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
    }
    
    0 讨论(0)
提交回复
热议问题