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. PaintEvent of the parent of a completely recovering child QGLWidget
Forum Updated to NodeBB v4.3 + New Features

PaintEvent of the parent of a completely recovering child QGLWidget

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

    Hi,

    I parent a QGLWidget and completely covers the parent with, with code such as:

    @
    QVBoxLayout* vbl = new QVBoxLayout;
    vbl->setContentsMargins(0, 0, 0, 0);
    vbl->addWidget(new QGLWidget);
    setLayout(vbl);
    @

    I have discovered that if I do that, the paintEvent of my parent widget never gets called. If I replace the QGLWidget with a QWidget, it is called. If I do not set the contentsMargins to 0, it is called.
    So my question is why does it do that ? Can I avoid such a behavior ?

    Thanks!

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      AFAIK, if your QGLWidget covers the entire parent surface, there's no reason for the parent widget to paint anything in that zone.

      What do you except to have and what are you currently getting ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • R Offline
        R Offline
        RedWark
        wrote on last edited by
        #3

        Hi and thanks for your reply.

        I am trying to do something inspired from this : https://github.com/xarray/osgRecipes/blob/master/cookbook/chapter9/ch09_01/osg_qt.cpp

        In this code a QWidget displays an osg (OpenSceneGraph) scene. You can see that the paintEvent of this widget has been reimplemented to command a redraw of the osg scene.

        What I am trying to do is just that, but with the containing QWidget parenting the osg qglwidget and having it filling it completely. But since the paintEvent does not get called so far, it doesn't work yet without a workaround.

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          Like I already wrote, since your widget is completely covered, there's no reason for paintEvent to be called.

          However you can try asking on the interest mailing list (you'll find there Qt's developers/mainters, this forum use more user oriented) if it's something that you can do

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0
          • R Offline
            R Offline
            RedWark
            wrote on last edited by
            #5

            Ok, I'll try that. And I'll post the result here. Thanks!

            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