I'm starting out in Qt. I'm trying to render a 3D view from Qt3d on the MainWindow of a QApplication.
The examples I've found are all based on QGuiApplications without widgets using Qt Quick and QML but I'm aiming to use widgets since this is going to be a desktop application.
I have used Qt designer for my MainWindow UI form, On the central widget I have used Vertical layout to place tabs on my left and an empty widget with expansive horizontal size policy on the right. My goal is to create a Class that is based on an existing Qt class that will support Qt3d while also being able to handle widgets. Then from the Mainwindow form I want to promote the Widget to that class.
I've tried QWindow but it doesn't allow widgets, am I suppose to Use QGlview to get access to the widgets?I'm not really looking to mess with opengl and isn't that deprecated now? Can someone direct me to an example that implements this?
Thank you
If you want to use a QWidget then the easiest way is to create a Qt3DWindow and convert it into a QWidget using createWindowContainer. You can use the returned QWidget like any other (add it to layouts or whatever).
Qt3DExtras::Qt3DWindow *view = new Qt3DExtras::Qt3DWindow();
QWidget *container = QWidget::createWindowContainer(view);
The only problem with this approach is that it isn't quite so straightforward to use Qt Designer. I tend to just use a placeholder QWidget in Qt Designer and then use code like the above in the MainWindow constructor to create the required QWidget and either replace my placeholder or put this new widget inside the placeholder widget
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With