PDA

View Full Version : Add OpenGl window to the grid layout of the child qwidget.



pastispast
24th November 2010, 11:26
Hi Friends,

I am facing some problem while adding the opengl window to the child qwidget. I have:

- Parent qwidget.
- 1 grid layout
- 1 opengl window
- 1 child qwidget (of parent qwidget).

1'st I am adding the opengl window to the gridlayout then I am adding the gridlayout to the child qwidget. But I did not get any view (also paintGl is not calling, if by how I call paintGl then also I am not getting the view)

Note: If I directly set the layout to the parent qwidget then I got the open gl window.

What I am missing here??? I have attached my example along with this post.

Thank you very much...5527

franz
26th November 2010, 21:09
Create a layout and add the dummy frame to it as well. Your dummy frame probably has a QSize(0,0).

IntegrateDraw::IntegrateDraw(QWidget *parent): QWidget(parent)
{
//OpenGL object
oGlDraw = new OpenGlDraw();

//QWidget
dummyFrame = new QWidget(this);
//dummyFrame->setWindowFlags( Qt::Dialog); //Point 3

//Grid layout
gLayout = new QGridLayout();
gLayout->addWidget(oGlDraw);

//setLayout(gLayout);
dummyFrame->setLayout(gLayout);

// this does it:
QGridLayout *l = new QGridLayout;
l->addWidget(dummyFrame);
setLayout(l);
};