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. QGLWidget displayed only in QScrollArea

QGLWidget displayed only in QScrollArea

Scheduled Pinned Locked Moved General and Desktop
5 Posts 2 Posters 2.1k 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.
  • Z Offline
    Z Offline
    zeller
    wrote on last edited by
    #1

    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

    1 Reply Last reply
    0
    • M Offline
      M Offline
      minimoog77
      wrote on last edited by
      #2

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

      1 Reply Last reply
      0
      • Z Offline
        Z Offline
        zeller
        wrote on last edited by
        #3

        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

        1 Reply Last reply
        0
        • M Offline
          M Offline
          minimoog77
          wrote on last edited by
          #4

          Check if the problem is with incorrect size policy.

          1 Reply Last reply
          0
          • Z Offline
            Z Offline
            zeller
            wrote on last edited by
            #5

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

            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