Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QGLView embedded in a guiapplication
Forum Updated to NodeBB v4.3 + New Features

QGLView embedded in a guiapplication

Scheduled Pinned Locked Moved General and Desktop
12 Posts 6 Posters 5.9k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • F Offline
    F Offline
    FreddeB
    wrote on last edited by
    #1

    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

    Regards
    Fredrik

    1 Reply Last reply
    0
    • T Offline
      T Offline
      tapadar
      wrote on last edited by
      #2

      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

      1 Reply Last reply
      0
      • F Offline
        F Offline
        FreddeB
        wrote on last edited by
        #3

        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.

        Regards
        Fredrik

        1 Reply Last reply
        0
        • D Offline
          D Offline
          deus
          wrote on last edited by
          #4

          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

          1 Reply Last reply
          0
          • W Offline
            W Offline
            wspilot
            wrote on last edited by
            #5

            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, ....);@

            1 Reply Last reply
            0
            • F Offline
              F Offline
              FreddeB
              wrote on last edited by
              #6

              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..)..

              Regards
              Fredrik

              1 Reply Last reply
              0
              • W Offline
                W Offline
                wspilot
                wrote on last edited by
                #7

                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!

                1 Reply Last reply
                0
                • D Offline
                  D Offline
                  deus
                  wrote on last edited by
                  #8

                  [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.

                  1 Reply Last reply
                  0
                  • C Offline
                    C Offline
                    cvanegas
                    wrote on last edited by
                    #9

                    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.

                    1 Reply Last reply
                    0
                    • C Offline
                      C Offline
                      cvanegas
                      wrote on last edited by
                      #10

                      It seems like this issues will be resolved soon in Qt 5.1:
                      http://blog.qt.digia.com/blog/2013/02/19/introducing-qwidgetcreatewindowcontainer/

                      1 Reply Last reply
                      0
                      • S Offline
                        S Offline
                        sunil.nair
                        wrote on last edited by
                        #11

                        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();

                        1 Reply Last reply
                        0
                        • S Offline
                          S Offline
                          sunil.nair
                          wrote on last edited by
                          #12

                          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();

                          1 Reply Last reply
                          0

                          • Login

                          • Login or register to search.
                          • First post
                            Last post
                          0
                          • Categories
                          • Recent
                          • Tags
                          • Popular
                          • Users
                          • Groups
                          • Search
                          • Get Qt Extensions
                          • Unsolved