Help with old example of Qt widgets embedded in OpenGL



  • Hi!

    I was following this example:
    http://labs.qt.nokia.com/2008/06/27/accelerate-your-widgets-with-opengl/

    I wanted to use QDialog to add widgets into my scene just like the article explains. I wanted each widget to have its own title bar. However, when I follow the example, I see no title bar at all. I've also tried building the example project from git but it operates differently, as well - the dialogs have close buttons even though CustomizeWindowHint is specified.

    Is there a more up to date way to accomplish this? It seems either the example is pretty far out of date (it is from 2008!) or some of the Qt functionality simply doesn't work the same way.

    Here is a quick example of my code that shows no title bars:

    @
    QGraphicsView view;

    view.setViewportUpdateMode(QGraphicsView::FullViewportUpdate);
    view.setViewport(new QGLWidget(QGLFormat(QGL::SampleBuffers)));
    view.setScene(new MyGLScene(0));
    
    QWidget *dialog = new QDialog(0, Qt::CustomizeWindowHint | Qt::WindowTitleHint);
    dialog->setWindowOpacity(0.8);
    dialog->setWindowTitle("Sample");
    dialog->setLayout(new QVBoxLayout);
    dialog->layout()->addWidget(new QLabel("Hello!"));
    
    view.scene()->addWidget(dialog);
    
    view.show();
    

    @

    [[ Mark up code, Tobias ]]


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.