QGLView embedded in a guiapplication
-
Hello !
Does anyone know how to put a QGLView into a standard gui application? I know that it isn't possible to use a qwidget as a parent.
Any tutorial ?
/Fredrik
-
You can have enough examples if you clone Qt3d, as QGlView contains mostly 3d support.
You can also try QGlWidget , the example is there here, http://doc.qt.digia.com/qt/qglwidget.html -
Thanks for Your reply !
Unfortunatly I haven't been successful finding a solution in the examples or demos in Qt3D. They all seem to use a QGLView as a main window.
My goal is to be able to use a QGLView in a part of the main window where I can handle it as a normal widget. I have read that the QGLView is going to replace QGLWidget in Qt5. Unfortunatly the parent must be of type QWindow.
-
Here:
"WindowWidget":http://code.google.com/p/h-qt-exercise/source/browse/qt3d/#qt3d/windowwidget
Just add this class in your project and promote that in the UI.
Then use its function to send it the qwindow.Dirty as hell, but it works.
More about it here:
https://bugreports.qt-project.org/browse/QTBUG-25643 -
As I understand your question: you want an opengl window in a parent window.
This is what works with me (using QGLWidget):
create a normal QWidget in the design editor (object name is e.g. "OGLWindow");Create a class based on QGLWidget and your OGLWindow:
oglwindow.h:
@namespace Ui {
class OGLWindow;
}
class OGLWindow : public QGLWidget, public Ui::OGLWindow
Q_OBJECT
public:
OGLWindow(TopFrame* parent, ....);
...
}
@oglwindow.cpp:
@OGLWindow::OGLWindow(TopFrame* parent, ...): QGLWidget((QWidget*)parent)
{
....
}
@In the parent (normal) QWidget:
@OGLWin = new OGLWindow( this, ....);@ -
Thanks for Your reply wspilot !
My intention however is to use the new class QGLView which inherits a QWindow in Qt5 RC1. The reason why, is that I would like to use the methods for picking, navigating etc which is allready implemented in QGLView.
http://doc-snapshot.qt-project.org/5.0-newdocs/qt3d/qglview.html#details
I do not really know how to add this QGLView into a gui application. I will look into Mr. deus suggestion however this weekend. I dont not really understand in what context the Qt community intends to use this QGLView. (Qapplication or QGuiApplication which uses QWindows..)..
-
OK.
It looks like it is a QGLWidget with some basic (openGL) viewing implemented.
If you are unable to get it working: it's not very hard to implement it in QGLWidget (mouse picking, dragging, keys, etc.).
good luck! -
[quote author="FreddeB" date="1354886431"]Thanks for Your reply wspilot !
My intention however is to use the new class QGLView which inherits a QWindow in Qt5 RC1. The reason why, is that I would like to use the methods for picking, navigating etc which is allready implemented in QGLView.
http://doc-snapshot.qt-project.org/5.0-newdocs/qt3d/qglview.html#details
I do not really know how to add this QGLView into a gui application. I will look into Mr. deus suggestion however this weekend. I dont not really understand in what context the Qt community intends to use this QGLView. (Qapplication or QGuiApplication which uses QWindows..)..
[/quote]
I'm afraid during the Nokia/Digia reshuffle the QT3D module were left in the dust.
We'll have to wait until after 5.0 gets out before we see any real progress again. -
FreddeB, did you manage to embed a QGLView into a main window? I have a similar problem and so far I've just had the QGLView in one window and the UI widgets in another window.
Once QML desktop components and Qt3D are part of Qt (maybe in 5.1 or 5.2), creating the UI for a desktop application might not require widgets at all. But until then I think we'll have to figure out how to reconcile QGLView with widgets.
-
It seems like this issues will be resolved soon in Qt 5.1:
http://blog.qt.digia.com/blog/2013/02/19/introducing-qwidgetcreatewindowcontainer/ -
Hi, there did you find an answer to your question. I am trying to do something similar,.
Hello, I have a cubeview (qt3d scene ) object view. I want to display it in the graphicsView pane of the main window.
@void MainWindow::on_pushButton_clicked()
{
if(view==NULL)
{
view=new CubeView;
view->begin(4,0);
view->resize(800, 600);
view->show();
}
}@
Instead of using view->show, I want to show it in the graphicsView space. The graphicsView object is in added in my UI file. How do I add the view->show item into the graphicsView item.
ui->graphicsView->show(); -
Hi, there did you find an answer to your question. I am trying to do something similar,.
Hello, I have a cubeview (qt3d scene ) object view. I want to display it in the graphicsView pane of the main window.
@void MainWindow::on_pushButton_clicked()
{
if(view==NULL)
{
view=new CubeView;
view->begin(4,0);
view->resize(800, 600);
view->show();
}
}@
Instead of using view->show, I want to show it in the graphicsView space. The graphicsView object is in added in my UI file. How do I add the view->show item into the graphicsView item.
ui->graphicsView->show();