QGLWidget displayed only in QScrollArea



  • Hello

    I have a custom QGLWidget that works fine standalone, and also if I embed it into a QScrollArea, but if I directly add it to the layout or embed it into a QWidget, it won't get displayed, it won't even take up its place in the UI. I call the resize after construction.
    I tried it several ways but nothing worked (except the scrollarea)
    My current code looks like this:
    @
    MapArea *wtf = new MapArea();
    QWidget *sa = new QWidget();
    QHBoxLayout *gl = new QHBoxLayout;
    gl->addWidget(wtf);
    sa->setLayout(gl);
    wtf->resize(640, 480);
    QTextEdit *te = new QTextEdit();
    QGridLayout *centralPartLayout = new QGridLayout();
    ui->widget->setLayout(centralPartLayout);
    centralPartLayout->addWidget(sa, 1, 1);
    wtf->update();
    centralPartLayout->addWidget(te, 1, 2);
    @

    Please tell me how should I add the widget to the layout.

    thanks
    david



  • What do you mean by: "won't get displayed"?



  • I doesn't take up its place in the layout. Maybe the resize operation is ineffective.
    On "this picture":http://borso.ole.hu/nogl.tiff it should be above the middle textedit



  • Check if the problem is with incorrect size policy.



  • Resizing the square in the grid after the QGLwidget was added solved the problem.
    I called setColumnMinimumWidth and setRowMinimumHeight, but I don't know why is this needed...


Log in to reply
 

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